2404 indexing enable

This commit is contained in:
2024-04-11 09:25:48 +02:00
parent f2be4c677d
commit 82a2d9a7bf
13 changed files with 73 additions and 14 deletions

View File

@@ -20,6 +20,7 @@ inline SpotFindingSettings Convert(const org::openapitools::server::model::Spot_
ret.high_resolution_limit = input.getHighResolutionLimit();
ret.low_resolution_limit = input.getLowResolutionLimit();
ret.enable = input.isEnable();
ret.indexing = input.isIndexing();
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.setEnable(input.enable);
ret.setIndexing(input.indexing);
return ret;
}

View File

@@ -22,6 +22,7 @@ namespace org::openapitools::server::model
Spot_finding_settings::Spot_finding_settings()
{
m_Enable = true;
m_Indexing = true;
m_Signal_to_noise_threshold = 0.0f;
m_Photon_count_threshold = 0L;
m_Min_pix_per_spot = 0L;
@@ -50,7 +51,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;
@@ -118,6 +119,9 @@ bool Spot_finding_settings::operator==(const Spot_finding_settings& rhs) const
(isEnable() == rhs.isEnable())
&&
(isIndexing() == rhs.isIndexing())
&&
(getSignalToNoiseThreshold() == rhs.getSignalToNoiseThreshold())
&&
@@ -148,6 +152,7 @@ void to_json(nlohmann::json& j, const Spot_finding_settings& o)
{
j = nlohmann::json();
j["enable"] = o.m_Enable;
j["indexing"] = o.m_Indexing;
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;
@@ -160,6 +165,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("indexing").get_to(o.m_Indexing);
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);
@@ -177,6 +183,14 @@ void Spot_finding_settings::setEnable(bool const value)
{
m_Enable = value;
}
bool Spot_finding_settings::isIndexing() const
{
return m_Indexing;
}
void Spot_finding_settings::setIndexing(bool const value)
{
m_Indexing = value;
}
float Spot_finding_settings::getSignalToNoiseThreshold() const
{
return m_Signal_to_noise_threshold;

View File

@@ -58,11 +58,16 @@ public:
/// Spot_finding_settings members
/// <summary>
///
/// Enable spot finding
/// </summary>
bool isEnable() const;
void setEnable(bool const value);
/// <summary>
/// Enable indexing
/// </summary>
bool isIndexing() const;
void setIndexing(bool const value);
/// <summary>
///
/// </summary>
float getSignalToNoiseThreshold() const;
@@ -98,6 +103,8 @@ public:
protected:
bool m_Enable;
bool m_Indexing;
float m_Signal_to_noise_threshold;
int64_t m_Photon_count_threshold;

View File

@@ -312,6 +312,7 @@ components:
type: object
required:
- enable
- indexing
- signal_to_noise_threshold
- photon_count_threshold
- max_pix_per_spot
@@ -322,6 +323,11 @@ components:
enable:
type: boolean
default: true
description: Enable spot finding
indexing:
type: boolean
default: true
description: Enable indexing
signal_to_noise_threshold:
type: number
format: float

File diff suppressed because one or more lines are too long

View File

@@ -16,6 +16,7 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
state : MyState = {
s: {
enable: true,
indexing: true,
photon_count_threshold: 8,
signal_to_noise_threshold: 3.0,
min_pix_per_spot: 2,
@@ -110,6 +111,13 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
this.getValues();
}
enableIndexingToggle = (event: React.ChangeEvent<HTMLInputElement>) => {
let x = this.state;
x.s.indexing = event.target.checked;
this.putValues2(x);
this.getValues();
}
render() {
return <Paper style={{textAlign: 'center'}} sx={{ height: 630, width: '100%' }}>
<Grid container spacing={0}>
@@ -119,7 +127,11 @@ class DataProcessingSettings extends Component<MyProps, MyState> {
<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/>
Enable spot finding &nbsp;
<Switch onChange={this.enableIndexingToggle} checked={this.state.s.indexing}
disabled={this.state.connection_error || !this.state.s.enable}/>
Enable indexing <br/><br/>
<Typography gutterBottom> Count threshold </Typography>
<Slider disabled={this.state.connection_error || !this.state.s.enable}
value={Number(this.state.s.photon_count_threshold)}

View File

@@ -93,7 +93,10 @@ class PreviewImage extends Component<MyProps, MyState> {
.then(data => data.blob())
.then(data => {
const url = URL.createObjectURL(data);
let tmp = this.state.s_url;
this.setState({s: data, s_url: url, connection_error: false});
if (tmp !== null)
URL.revokeObjectURL(tmp);
}).catch(error => {
this.setState({connection_error: true});
})

View File

@@ -4,7 +4,14 @@
/* eslint-disable */
export type spot_finding_settings = {
/**
* Enable spot finding
*/
enable: boolean;
/**
* Enable indexing
*/
indexing: boolean;
signal_to_noise_threshold: number;
photon_count_threshold: number;
min_pix_per_spot: number;

View File

@@ -39,7 +39,8 @@ void MXAnalyzer::ReadFromCPU(const int16_t *image, const SpotFindingSettings &se
ReadFromFPGA(&output, settings, module_number);
}
bool MXAnalyzer::Process(DataMessage &message) {
bool MXAnalyzer::Process(DataMessage &message,
const SpotFindingSettings& settings) {
message.indexing_result = 0;
if (!find_spots)
return false;
@@ -52,7 +53,7 @@ bool MXAnalyzer::Process(DataMessage &message) {
for (const auto &spot: spots_out)
message.spots.push_back(spot);
if (do_indexing) {
if (do_indexing && settings.indexing) {
std::vector<Coord> recip;
for (const auto &i: spots_out)
recip.push_back(i.ReciprocalCoord(experiment));

View File

@@ -17,13 +17,15 @@ public:
explicit MXAnalyzer(const DiffractionExperiment& experiment);
void ReadFromFPGA(const DeviceOutput* output,
const SpotFindingSettings& settings,
size_t module_number);
const SpotFindingSettings& settings,
size_t module_number);
void ReadFromCPU(const int16_t *image,
const SpotFindingSettings& settings,
size_t module_number);
bool Process(DataMessage &message);
bool Process(DataMessage &message,
const SpotFindingSettings& settings);
};

View File

@@ -7,6 +7,7 @@
struct SpotFindingSettings {
bool enable = true;
bool indexing = 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

View File

@@ -346,7 +346,7 @@ void JFJochReceiver::FrameTransformationThread() {
continue;
}
bool indexed = analyzer.Process(message);
bool indexed = analyzer.Process(message, local_spot_finding_settings);
message.az_int_profile = az_int_profile_image.GetResult();
message.bkg_estimate = az_int_profile_image.GetMeanValueOfBins(az_int_min_bin, az_int_max_bin);

View File

@@ -197,7 +197,7 @@ int main(int argc, char **argv) {
message.image = image;
message.number = i;
analyzer.Process(message);
analyzer.Process(message, settings);
if (write_jpeg) {
preview.UpdateImage(transformation.GetImage(), message.spots);