SpotToSave: Add image number

This commit is contained in:
2025-11-29 15:53:36 +01:00
parent 020b5d6651
commit c9ffe8d60e
8 changed files with 22 additions and 14 deletions
+10 -9
View File
@@ -65,16 +65,17 @@ void DiffractionSpot::ConvertToImageCoordinates(const DiffractionExperiment &exp
this->y = c_out.y * (float) photons;
}
SpotToSave DiffractionSpot::Export(const DiffractionGeometry &geometry) const {
auto d = geometry.PxlToRes(x / (float)photons, y / (float)photons);
SpotToSave DiffractionSpot::Export(const DiffractionGeometry &geometry, int64_t image_num) const {
auto d = geometry.PxlToRes(x / (float) photons, y / (float) photons);
return {
.x = x / static_cast<float>(photons),
.y = y / static_cast<float>(photons),
.intensity = static_cast<float>(photons),
.maxc = max_photons,
.d_A = d,
.ice_ring = false,
.indexed = false,
.x = x / static_cast<float>(photons),
.y = y / static_cast<float>(photons),
.intensity = static_cast<float>(photons),
.maxc = max_photons,
.d_A = d,
.ice_ring = false,
.indexed = false,
.image = image_num
};
}
+1 -1
View File
@@ -29,7 +29,7 @@ public:
int64_t MaxCount() const;
Coord RawCoord() const;
void ConvertToImageCoordinates(const DiffractionExperiment& experiment, uint16_t module_number);
SpotToSave Export(const DiffractionGeometry &geometry) const;
SpotToSave Export(const DiffractionGeometry &geometry, int64_t image_num = 0) const;
void AddPixel(uint32_t col, uint32_t line, int64_t photons);
};
+1
View File
@@ -14,6 +14,7 @@ struct SpotToSave {
float d_A = 0.0;
bool ice_ring = false;
bool indexed = false;
int64_t image = 0;
int64_t h = 0, k = 0, l= 0;
float dist_ewald_sphere = 0.0;
@@ -418,6 +418,8 @@ namespace {
s.l = GetCBORInt(map_value);
else if (key == "dist_ewald")
s.dist_ewald_sphere = GetCBORFloat(map_value);
else if (key == "image")
s.image = GetCBORInt(map_value);
else
cbor_value_advance(&map_value);
}
@@ -207,6 +207,7 @@ inline void CBOR_ENC(CborEncoder &encoder, const SpotToSave& spot) {
CBOR_ENC(mapEncoder, "maxc", spot.maxc);
CBOR_ENC(mapEncoder, "ice_ring", spot.ice_ring);
CBOR_ENC(mapEncoder, "indexed", spot.indexed);
CBOR_ENC(mapEncoder, "image", spot.image);
if (spot.indexed) {
CBOR_ENC(mapEncoder, "h", spot.h);
CBOR_ENC(mapEncoder, "k", spot.k);
+1 -1
View File
@@ -135,7 +135,7 @@ void SpotAnalyze(const DiffractionExperiment &experiment,
std::vector<SpotToSave> spots_out;
for (const auto &spot: spots)
spots_out.push_back(spot.Export(geom));
spots_out.push_back(spot.Export(geom, output.number));
if (spot_finding_settings.high_res_gap_Q_recipA.has_value())
FilterSpuriousHighResolutionSpots(spots_out, spot_finding_settings.high_res_gap_Q_recipA.value());
+4 -2
View File
@@ -28,7 +28,9 @@ void FilterSpuriousHighResolutionSpots(std::vector<SpotToSave> &spots, float thr
// For 20 spots or more - take the 95% percentile best high resolution spot
std::optional<float> GetResolution(const std::vector<SpotToSave> &spots);
void SpotAnalyze(const DiffractionExperiment &experiment, const SpotFindingSettings &settings,
const std::vector<DiffractionSpot> &spots, DataMessage &message);
void SpotAnalyze(const DiffractionExperiment &experiment,
const SpotFindingSettings &settings,
const std::vector<DiffractionSpot> &spots,
DataMessage &message);
#endif //JFJOCH_SPOTANALYSIS_H
+2 -1
View File
@@ -537,7 +537,8 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset
.x = x,
.y = y,
.intensity = spot_intensity.at(i),
.d_A = d
.d_A = d,
.image = image_number
};
if (spot_indexed.size() > i)
s.indexed = (spot_indexed.at(i) != 0);