OpenAPI: Add spot finding enable/disable option
This commit is contained in:
@@ -19,7 +19,8 @@ inline SpotFindingSettings Convert(const org::openapitools::server::model::Spot_
|
||||
ret.max_pix_per_spot = input.getMaxPixPerSpot();
|
||||
ret.high_resolution_limit = input.getHighResolutionLimit();
|
||||
ret.low_resolution_limit = input.getLowResolutionLimit();
|
||||
ret.preview_indexed_only = input.previewIndexedOnlyIsSet() ? input.isPreviewIndexedOnly() : false;
|
||||
ret.preview_indexed_only = input.isPreviewIndexedOnly();
|
||||
ret.enable = input.isEnable();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -32,6 +33,7 @@ inline org::openapitools::server::model::Spot_finding_settings Convert(const Spo
|
||||
ret.setHighResolutionLimit(input.high_resolution_limit);
|
||||
ret.setLowResolutionLimit(input.low_resolution_limit);
|
||||
ret.setPreviewIndexedOnly(input.preview_indexed_only);
|
||||
ret.setEnable(input.enable);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace org::openapitools::server::model
|
||||
|
||||
Spot_finding_settings::Spot_finding_settings()
|
||||
{
|
||||
m_Enable = true;
|
||||
m_Signal_to_noise_threshold = 0.0f;
|
||||
m_Photon_count_threshold = 0L;
|
||||
m_Min_pix_per_spot = 0L;
|
||||
@@ -51,7 +52,7 @@ bool Spot_finding_settings::validate(std::stringstream& msg, const std::string&
|
||||
bool success = true;
|
||||
const std::string _pathPrefix = pathPrefix.empty() ? "Spot_finding_settings" : pathPrefix;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Signal_to_noise_threshold */ {
|
||||
const float& value = m_Signal_to_noise_threshold;
|
||||
@@ -116,6 +117,9 @@ bool Spot_finding_settings::operator==(const Spot_finding_settings& rhs) const
|
||||
return
|
||||
|
||||
|
||||
(isEnable() == rhs.isEnable())
|
||||
&&
|
||||
|
||||
(getSignalToNoiseThreshold() == rhs.getSignalToNoiseThreshold())
|
||||
&&
|
||||
|
||||
@@ -148,6 +152,7 @@ bool Spot_finding_settings::operator!=(const Spot_finding_settings& rhs) const
|
||||
void to_json(nlohmann::json& j, const Spot_finding_settings& o)
|
||||
{
|
||||
j = nlohmann::json();
|
||||
j["enable"] = o.m_Enable;
|
||||
j["signal_to_noise_threshold"] = o.m_Signal_to_noise_threshold;
|
||||
j["photon_count_threshold"] = o.m_Photon_count_threshold;
|
||||
j["min_pix_per_spot"] = o.m_Min_pix_per_spot;
|
||||
@@ -161,6 +166,7 @@ void to_json(nlohmann::json& j, const Spot_finding_settings& o)
|
||||
|
||||
void from_json(const nlohmann::json& j, Spot_finding_settings& o)
|
||||
{
|
||||
j.at("enable").get_to(o.m_Enable);
|
||||
j.at("signal_to_noise_threshold").get_to(o.m_Signal_to_noise_threshold);
|
||||
j.at("photon_count_threshold").get_to(o.m_Photon_count_threshold);
|
||||
j.at("min_pix_per_spot").get_to(o.m_Min_pix_per_spot);
|
||||
@@ -175,6 +181,14 @@ void from_json(const nlohmann::json& j, Spot_finding_settings& o)
|
||||
|
||||
}
|
||||
|
||||
bool Spot_finding_settings::isEnable() const
|
||||
{
|
||||
return m_Enable;
|
||||
}
|
||||
void Spot_finding_settings::setEnable(bool const value)
|
||||
{
|
||||
m_Enable = value;
|
||||
}
|
||||
float Spot_finding_settings::getSignalToNoiseThreshold() const
|
||||
{
|
||||
return m_Signal_to_noise_threshold;
|
||||
|
||||
@@ -57,6 +57,11 @@ public:
|
||||
/////////////////////////////////////////////
|
||||
/// Spot_finding_settings members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
bool isEnable() const;
|
||||
void setEnable(bool const value);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -98,6 +103,8 @@ public:
|
||||
friend void to_json(nlohmann::json& j, const Spot_finding_settings& o);
|
||||
friend void from_json(const nlohmann::json& j, Spot_finding_settings& o);
|
||||
protected:
|
||||
bool m_Enable;
|
||||
|
||||
float m_Signal_to_noise_threshold;
|
||||
|
||||
int64_t m_Photon_count_threshold;
|
||||
|
||||
@@ -311,6 +311,7 @@ components:
|
||||
spot_finding_settings:
|
||||
type: object
|
||||
required:
|
||||
- enable
|
||||
- signal_to_noise_threshold
|
||||
- photon_count_threshold
|
||||
- max_pix_per_spot
|
||||
@@ -318,6 +319,9 @@ components:
|
||||
- high_resolution_limit
|
||||
- low_resolution_limit
|
||||
properties:
|
||||
enable:
|
||||
type: boolean
|
||||
default: true
|
||||
signal_to_noise_threshold:
|
||||
type: number
|
||||
format: float
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -665,14 +665,7 @@ void DiffractionExperiment::CheckDataProcessingSettings(const SpotFindingSetting
|
||||
}
|
||||
|
||||
SpotFindingSettings DiffractionExperiment::DefaultDataProcessingSettings() {
|
||||
SpotFindingSettings ret{};
|
||||
ret.signal_to_noise_threshold = 3;
|
||||
ret.photon_count_threshold = 16;
|
||||
ret.min_pix_per_spot = 2;
|
||||
ret.max_pix_per_spot = 50;
|
||||
ret.low_resolution_limit = 20.0;
|
||||
ret.high_resolution_limit = 2.5;
|
||||
return ret;
|
||||
return {};
|
||||
}
|
||||
|
||||
void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
|
||||
@@ -15,6 +15,7 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
|
||||
interval : NodeJS.Timer | undefined;
|
||||
state : MyState = {
|
||||
s: {
|
||||
enable: true,
|
||||
photon_count_threshold: 8,
|
||||
signal_to_noise_threshold: 3.0,
|
||||
min_pix_per_spot: 2,
|
||||
@@ -74,6 +75,7 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
|
||||
}
|
||||
));
|
||||
this.putValues();
|
||||
this.getValues();
|
||||
}
|
||||
|
||||
setMinPixPerSpot = (event: Event, newValue: number | number[]) => {
|
||||
@@ -86,6 +88,7 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
|
||||
}
|
||||
));
|
||||
this.putValues();
|
||||
this.getValues();
|
||||
}
|
||||
|
||||
setHighResolutionLimit = (event: Event, newValue: number | number[]) => {
|
||||
@@ -98,12 +101,23 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
|
||||
}
|
||||
));
|
||||
this.putValues();
|
||||
this.getValues();
|
||||
}
|
||||
|
||||
enableSpotFindingToggle = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
let x = this.state;
|
||||
x.s.enable = event.target.checked;
|
||||
if (!x.s.enable)
|
||||
x.s.preview_indexed_only = false;
|
||||
this.putValues2(x);
|
||||
this.getValues();
|
||||
}
|
||||
|
||||
previewIndexedToggle = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
let x = this.state;
|
||||
x.s.preview_indexed_only = event.target.checked;
|
||||
this.putValues2(x);
|
||||
this.getValues();
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -112,32 +126,35 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
|
||||
|
||||
<Grid item xs={1}/>
|
||||
<Grid item xs={10}>
|
||||
<br/><strong>Data processing parameters</strong><br/><br/>
|
||||
<br/><strong>Spot finding parameters</strong><br/><br/>
|
||||
<Switch onChange={this.enableSpotFindingToggle} checked={this.state.s.enable}
|
||||
disabled={this.state.connection_error}/>
|
||||
Enable spot finding <br/><br/>
|
||||
<Typography gutterBottom> Count threshold </Typography>
|
||||
<Slider disabled={this.state.connection_error}
|
||||
<Slider disabled={this.state.connection_error || !this.state.s.enable}
|
||||
value={Number(this.state.s.photon_count_threshold)}
|
||||
onChange={this.setPhotonCountThreshold}
|
||||
min={1} max={50} step={1} valueLabelDisplay="auto" />
|
||||
|
||||
<br/><Typography> Signal-to-noise threshold </Typography>
|
||||
<Slider disabled={this.state.connection_error}
|
||||
<Slider disabled={this.state.connection_error || !this.state.s.enable}
|
||||
value={Number(this.state.s.signal_to_noise_threshold)}
|
||||
onChange={this.setSignalToNoiseThreshold}
|
||||
min={2} max={10} step={0.5} valueLabelDisplay="auto" />
|
||||
|
||||
<br/><Typography> Minimum pixel / spot </Typography>
|
||||
<Slider disabled={this.state.connection_error}
|
||||
<Slider disabled={this.state.connection_error || !this.state.s.enable}
|
||||
value={Number(this.state.s.min_pix_per_spot)}
|
||||
onChange={this.setMinPixPerSpot}
|
||||
min={1} max={8} step={1} valueLabelDisplay="auto" />
|
||||
<Typography> High resolution limit [Å] </Typography>
|
||||
<Slider disabled={this.state.connection_error}
|
||||
<Slider disabled={this.state.connection_error || !this.state.s.enable}
|
||||
value={Number(this.state.s.high_resolution_limit)}
|
||||
onChange={this.setHighResolutionLimit}
|
||||
min={1} max={5} step={0.2} valueLabelDisplay="auto" />
|
||||
<br/>
|
||||
<Switch onChange={this.previewIndexedToggle} checked={this.state.s.preview_indexed_only}
|
||||
disabled={this.state.connection_error}/>
|
||||
disabled={this.state.connection_error || !this.state.s.enable}/>
|
||||
Preview only indexed frames <br/><br/>
|
||||
</Grid>
|
||||
<Grid item xs={1}/>
|
||||
|
||||
@@ -49,9 +49,9 @@ export type dataset_settings = {
|
||||
*/
|
||||
file_prefix?: string;
|
||||
/**
|
||||
* Number of round-robin data files
|
||||
* Number of files in a single HDF5 data file (0 = write all images to a single data file).
|
||||
*/
|
||||
data_file_count?: number;
|
||||
images_per_file?: number;
|
||||
space_group_number?: number;
|
||||
/**
|
||||
* /entry/sample/name in NXmx
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/* eslint-disable */
|
||||
|
||||
export type spot_finding_settings = {
|
||||
enable: boolean;
|
||||
signal_to_noise_threshold: number;
|
||||
photon_count_threshold: number;
|
||||
min_pix_per_spot: number;
|
||||
|
||||
@@ -17,7 +17,7 @@ MXAnalyzer::MXAnalyzer(const DiffractionExperiment &in_experiment)
|
||||
}
|
||||
|
||||
void MXAnalyzer::ReadFromFPGA(const DeviceOutput *output, const SpotFindingSettings &settings, size_t module_number) {
|
||||
if (!find_spots)
|
||||
if (!find_spots || !settings.enable)
|
||||
return;
|
||||
StrongPixelSet strong_pixel_set;
|
||||
strong_pixel_set.ReadFPGAOutput(experiment, *output);
|
||||
@@ -29,7 +29,7 @@ void MXAnalyzer::ReadFromCPU(const int16_t *image, const SpotFindingSettings &se
|
||||
return;
|
||||
std::vector<float> d_map(RAW_MODULE_SIZE);
|
||||
|
||||
DeviceOutput output;
|
||||
DeviceOutput output{};
|
||||
memcpy(output.pixels, image, RAW_MODULE_SIZE * sizeof(int16_t));
|
||||
|
||||
CalcSpotFinderResolutionMap(d_map.data(), experiment, module_number);
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
#include <cstdint>
|
||||
|
||||
struct SpotFindingSettings {
|
||||
float signal_to_noise_threshold; // STRONG_PIXEL in XDS
|
||||
int64_t photon_count_threshold; // Threshold in photon counts
|
||||
int64_t min_pix_per_spot; // Minimum pixels per spot
|
||||
int64_t max_pix_per_spot; // Maximum pixels per spot
|
||||
float high_resolution_limit;
|
||||
float low_resolution_limit;
|
||||
bool preview_indexed_only;
|
||||
bool enable = true;
|
||||
float signal_to_noise_threshold = 3; // STRONG_PIXEL in XDS
|
||||
int64_t photon_count_threshold = 10; // Threshold in photon counts
|
||||
int64_t min_pix_per_spot = 2; // Minimum pixels per spot
|
||||
int64_t max_pix_per_spot = 50; // Maximum pixels per spot
|
||||
float high_resolution_limit = 2.5;
|
||||
float low_resolution_limit = 50.0;
|
||||
bool preview_indexed_only = false;
|
||||
};
|
||||
|
||||
#endif //JUNGFRAUJOCH_SPOTFINDINGSETTINGS_H
|
||||
|
||||
Reference in New Issue
Block a user