SpotToSave: Add image number
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user