AzimuthalIntegrationProfile: Add standard deviation + save pixel count + improve handling of special cases (missing image)
This commit is contained in:
@@ -25,6 +25,14 @@ void HDF5DataFilePluginAzInt::OpenFile(HDF5File &data_file, const DataMessage &m
|
||||
data_file.SaveVector("/entry/azint/bin_to_phi", az_int_bin_to_phi, dim);
|
||||
|
||||
az_int_image.reserve(images_per_file * azimuthal_bins * q_bins);
|
||||
if (!msg.az_int_profile_count.empty()) {
|
||||
save_profile_count = true;
|
||||
az_int_image_count.reserve(images_per_file * azimuthal_bins * q_bins);
|
||||
}
|
||||
if (!msg.az_int_profile_std.empty()) {
|
||||
save_profile_std = true;
|
||||
az_int_image_std.reserve(images_per_file * azimuthal_bins * q_bins);
|
||||
}
|
||||
}
|
||||
|
||||
void HDF5DataFilePluginAzInt::Write(const DataMessage &msg, uint64_t image_number) {
|
||||
@@ -33,17 +41,41 @@ void HDF5DataFilePluginAzInt::Write(const DataMessage &msg, uint64_t image_numbe
|
||||
|
||||
if (image_number >= max_image_number || (max_image_number == 0)) {
|
||||
max_image_number = image_number;
|
||||
az_int_image.resize((max_image_number + 1) * azimuthal_bins * q_bins);
|
||||
az_int_image.resize((max_image_number + 1) * azimuthal_bins * q_bins, NAN);
|
||||
if (save_profile_count)
|
||||
az_int_image_count.resize((max_image_number + 1) * azimuthal_bins * q_bins, 0);
|
||||
if (save_profile_std)
|
||||
az_int_image_std.resize((max_image_number + 1) * azimuthal_bins * q_bins, NAN);
|
||||
}
|
||||
|
||||
if (!msg.az_int_profile.empty() && (msg.az_int_profile.size() == azimuthal_bins * q_bins)) {
|
||||
for (int i = 0; i < azimuthal_bins * q_bins; i++)
|
||||
az_int_image[image_number * azimuthal_bins * q_bins + i] = msg.az_int_profile[i];
|
||||
}
|
||||
|
||||
if (save_profile_count
|
||||
&& !msg.az_int_profile_count.empty()
|
||||
&& (msg.az_int_profile_count.size() == azimuthal_bins * q_bins)) {
|
||||
for (int i = 0; i < azimuthal_bins * q_bins; i++)
|
||||
az_int_image_count[image_number * azimuthal_bins * q_bins + i] = msg.az_int_profile_count[i];
|
||||
}
|
||||
|
||||
if (save_profile_std
|
||||
&& !msg.az_int_profile_std.empty()
|
||||
&& (msg.az_int_profile_std.size() == azimuthal_bins * q_bins)) {
|
||||
for (int i = 0; i < azimuthal_bins * q_bins; i++)
|
||||
az_int_image_std[image_number * azimuthal_bins * q_bins + i] = msg.az_int_profile_std[i];
|
||||
}
|
||||
}
|
||||
|
||||
void HDF5DataFilePluginAzInt::WriteFinal(HDF5File &data_file) {
|
||||
if (!az_int_image.empty())
|
||||
data_file.SaveVector("/entry/azint/image", az_int_image,
|
||||
{(hsize_t) (max_image_number + 1), azimuthal_bins, q_bins});
|
||||
if (!az_int_image_std.empty())
|
||||
data_file.SaveVector("/entry/azint/image_std", az_int_image_std,
|
||||
{(hsize_t) (max_image_number + 1), azimuthal_bins, q_bins});
|
||||
if (!az_int_image_count.empty())
|
||||
data_file.SaveVector("/entry/azint/image_count", az_int_image_count,
|
||||
{(hsize_t) (max_image_number + 1), azimuthal_bins, q_bins});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user