Improve plotting
This commit is contained in:
@@ -14,25 +14,6 @@ template <class T> void FillVector(std::vector<char> &v, T fill_value) {
|
||||
ptr[i] = fill_value;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
int64_t calc_roi(const void* array, size_t width,
|
||||
const ROIRectangle &input,
|
||||
int64_t min_val, int64_t max_val) {
|
||||
int64_t ret = 0;
|
||||
for (size_t y = input.y_min; y <= input.y_max; y++) {
|
||||
for (size_t x = input.x_min; x <= input.x_max; x++) {
|
||||
int64_t val = ((T *)array)[y * width + x];
|
||||
if ((ret == INT64_MIN) || (val < min_val))
|
||||
ret = INT64_MIN;
|
||||
else if ((ret == INT64_MAX) || (val > max_val))
|
||||
ret = INT64_MAX;
|
||||
else
|
||||
ret += val;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
FrameTransformation::FrameTransformation(const DiffractionExperiment &in_experiment) :
|
||||
experiment(in_experiment),
|
||||
pixel_depth(experiment.GetPixelDepth()), pixel_signed(experiment.IsPixelSigned()),
|
||||
@@ -138,23 +119,3 @@ const void *FrameTransformation::GetImage() const {
|
||||
void FrameTransformation::FillNotCollectedModule(uint16_t module_number, int data_stream) {
|
||||
ProcessModule(err_value.data(), module_number, data_stream);
|
||||
}
|
||||
|
||||
int64_t FrameTransformation::CalculateROISum(const ROIRectangle &input) {
|
||||
if ((input.x_min > input.x_max) || (input.y_min > input.y_max))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Mismatch in min/max ROI size");
|
||||
if ((input.x_max >= experiment.GetXPixelsNum()) || (input.y_max >= experiment.GetYPixelsNum()))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Max pixel value for ROI sum outside of the detector range");
|
||||
if (pixel_depth == 2) {
|
||||
if (pixel_signed)
|
||||
return calc_roi<int16_t>(precompression_buffer.data(), experiment.GetXPixelsNum(), input, INT16_MIN + 1, INT16_MAX - 1);
|
||||
else
|
||||
return calc_roi<uint16_t>(precompression_buffer.data(), experiment.GetXPixelsNum(), input, 0, UINT16_MAX - 2);
|
||||
} else if (pixel_depth == 4) {
|
||||
if (pixel_signed)
|
||||
return calc_roi<int32_t>(precompression_buffer.data(), experiment.GetXPixelsNum(), input, INT32_MIN + 1, INT32_MAX - 1);
|
||||
else
|
||||
return calc_roi<uint32_t>(precompression_buffer.data(), experiment.GetXPixelsNum(), input, 0, UINT32_MAX - 2);
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user