Commit 43cb0292 authored by Sean McBride's avatar Sean McBride

Fixed division by zero found by cppcheck

Change-Id: I4a1d34098aa1ea7975c200dfdad86190b382fc29
parent 9cee046a
......@@ -208,16 +208,21 @@ void vtkImageMapToWindowLevelClamps ( vtkImageData *data, double w,
}
// now compute the lower and upper values
if (w >= 0)
if (w > 0.0)
{
f_lower_val = 255.0*(adjustedLower - f_lower)/w;
f_upper_val = 255.0*(adjustedUpper - f_lower)/w;
}
else
else if (w < 0.0)
{
f_lower_val = 255.0 + 255.0*(adjustedLower - f_lower)/w;
f_upper_val = 255.0 + 255.0*(adjustedUpper - f_lower)/w;
}
else
{
f_lower_val = 0.0;
f_upper_val = 255.0;
}
if (f_upper_val > 255)
{
......
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