Commit a4d1bea8 authored by David Gobbi's avatar David Gobbi

If a SetInterpolator() is used, then clamp the results.

This fixes a numerical overflow issue.  The code skips the clamping step
for linear and NN interpolation for better performance, but for high-order
interpolation, it needs to clamp the result to the range of the output
scalar type.  A bug caused it to incorrectly skip the clamping if a high
order interpolator was set with SetInterpolator(), but only for the
"PermuteExecute" code path that is used for rotations that are precise
multiples of 90 degrees.
parent 51c49664
......@@ -2824,8 +2824,16 @@ void vtkReslicePermuteExecute(vtkImageReslice *self,
bool rescaleScalars = (scalarShift != 0.0 || scalarScale != 1.0);
// get the interpolation mode from the interpolator
int interpolationMode = VTK_INT_MAX;
if (interpolator->IsA("vtkImageInterpolator"))
{
interpolationMode =
static_cast<vtkImageInterpolator *>(interpolator)
->GetInterpolationMode();
}
// if doConversion is false, a special fast-path will be used
int interpolationMode = self->GetInterpolationMode();
bool doConversion = true;
int inputScalarType = scalars->GetDataType();
if (interpolationMode == VTK_NEAREST_INTERPOLATION &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment