vtkImageMapToWindowLevelColors can do win/level on RGB data with no LUT
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
In vtkImageMapToWindowLevelColors, if there is no lookup table but the input image data is RGB/RGBA, all the color channel data is set to the same win/level, making it appear greyscale when drawn to screen (at least through vtkImageViewer2 anyways).
Instead, in this case where there is no LUT but the image data is in the RGB/RGBA format, can we just do the scaling per component so that the color data is retained:
*optr = result_val; case VTK_RGB: *(optr+1) = result_val; *(optr+2) = result_val;
to:
unsigned char rgb_lvl[3];
case VTK_RGB:
for (int i = 0; i < 3; i++) {
if (*(iptr + i) <= lower) {
rgb[i] = lower_val;
}
else if (*(iptr + i) >= upper) {
rgb[i] = upper_val;
}
else {
rgb[i] = (unsigned char) ((*(iptr + i) + shift)*scale);
}
}
*(optr+0) = rgb_lvl[0];
*(optr+1) = rgb_lvl[1];
*(optr+2) = rgb_lvl[2];
break;
and so forth for RGBA/LUMINANCE cases. I just put that in to see if it works and the output looks ok.