NeuralNetInferenceClient: Handle case of unsigned data
This commit is contained in:
@@ -242,13 +242,22 @@ std::optional<float> NeuralNetInferenceClient::Inference(const DiffractionExperi
|
||||
|
||||
switch (experiment.GetByteDepthImage()) {
|
||||
case 1:
|
||||
v = PrepareInternal(experiment, (int8_t *) image, q);
|
||||
if (experiment.IsPixelSigned())
|
||||
v = PrepareInternal(experiment, (int8_t *) image, q);
|
||||
else
|
||||
v = PrepareInternal(experiment, (uint8_t *) image, q);
|
||||
break;
|
||||
case 2:
|
||||
v = PrepareInternal(experiment, (int16_t *) image, q);
|
||||
if (experiment.IsPixelSigned())
|
||||
v = PrepareInternal(experiment, (int16_t *) image, q);
|
||||
else
|
||||
v = PrepareInternal(experiment, (uint16_t *) image, q);
|
||||
break;
|
||||
case 4:
|
||||
v = PrepareInternal(experiment, (int32_t *) image, q);
|
||||
if (experiment.IsPixelSigned())
|
||||
v = PrepareInternal(experiment, (int32_t *) image, q);
|
||||
else
|
||||
v = PrepareInternal(experiment, (uint32_t *) image, q);
|
||||
break;
|
||||
default:
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Bit depth not supported");
|
||||
@@ -259,7 +268,8 @@ std::optional<float> NeuralNetInferenceClient::Inference(const DiffractionExperi
|
||||
return {};
|
||||
|
||||
float two_theta = atanf(
|
||||
((2.0f * experiment.GetPixelSize_mm() / experiment.GetDetectorDistance_mm()) * resp.value()));
|
||||
((2.0f * GetMaxPoolFactor(experiment) * experiment.GetPixelSize_mm()
|
||||
/ experiment.GetDetectorDistance_mm()) * resp.value()));
|
||||
float stheta = sinf(two_theta * 0.5f);
|
||||
float resolution = experiment.GetWavelength_A() / (2.0f * stheta);
|
||||
return resolution;
|
||||
|
||||
Reference in New Issue
Block a user