JFJochHDF5Reader: Guard for peak count datasets being not present

This commit is contained in:
2026-04-21 10:12:41 +02:00
parent c1c170112c
commit c2de9c2b67
+11 -6
View File
@@ -155,7 +155,7 @@ void JFJochHDF5Reader::ReadFile(const std::string& filename) {
dataset->spot_count_low_res = master_file->ReadOptVector<float>("/entry/MX/peakCountLowRes");
dataset->spot_count_indexed = master_file->ReadOptVector<float>("/entry/MX/peakCountIndexed");
dataset->spot_count_ice_rings = master_file->ReadOptVector<float>("/entry/MX/peakCountIceRing");
dataset->spot_count_ice_rings = master_file->ReadOptVector<float>("/entry/MX/peakCountIceRingRes");
dataset->indexing_result = master_file->ReadOptVector<float>("/entry/MX/imageIndexed");
dataset->bkg_estimate = master_file->ReadOptVector<float>("/entry/MX/bkgEstimate");
@@ -610,11 +610,16 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset
s.ice_ring = (spot_ice.at(i) != 0);
message.spots.emplace_back(s);
}
message.spot_count = source_file->ReadElement<uint32_t>("/entry/MX/peakCountUnfiltered", image_id);
message.spot_count_ice_rings = source_file->ReadElement<uint32_t>("/entry/MX/peakCountIceRingRes", image_id);
message.spot_count_low_res = source_file->ReadElement<uint32_t>("/entry/MX/peakCountLowRes", image_id);
message.spot_count_indexed = source_file->ReadElement<uint32_t>("/entry/MX/peakCountIndexed", image_id);
if (source_file->Exists("/entry/MX/peakCountUnfiltered"))
message.spot_count = source_file->ReadElement<uint32_t>("/entry/MX/peakCountUnfiltered", image_id);
else
message.spot_count = source_file->ReadElement<uint32_t>("/entry/MX/nPeaks", image_id);
if (source_file->Exists("/entry/MX/peakCountIceRingRes"))
message.spot_count_ice_rings = source_file->ReadElement<uint32_t>("/entry/MX/peakCountIceRingRes", image_id);
if (source_file->Exists("/entry/MX/peakCountLowRes"))
message.spot_count_low_res = source_file->ReadElement<uint32_t>("/entry/MX/peakCountLowRes", image_id);
if (source_file->Exists("/entry/MX/peakCountIndexed"))
message.spot_count_indexed = source_file->ReadElement<uint32_t>("/entry/MX/peakCountIndexed", image_id);
GenerateSpotPlot(message, 1.5);
}