[vtkusers] Bug in vtkImageMapToColors

Nicolas Rannou nicolas_rannou at hms.harvard.edu
Fri May 6 17:00:36 EDT 2011


Hello,

I'm experiencing a strange behavior in VTK which might be a bug.
It took me a while to locate the issue:

if I create a LUT with a *NULL red component*:
   iRed = 0;
   iGreen = 255;
   iBlue = 255;
   iAlpha = 255;
   double iRange[2] = {0, 255};

   vtkSmartPointer<*vtkLookupTable*> lut =
       vtkSmartPointer<*vtkLookupTable*>::New();
   double* HSV = vtkMath::RGBToHSV(iRed,iGreen,iBlue);
   lut->SetAlpha(iAlpha);
   lut->SetHueRange(HSV[0], HSV[0]);
   lut->SetSaturationRange(1, 1);
   lut->SetValueRange(0, 1);
   lut->SetRange(iRange);
   lut->Build();

I color my image with this LUT:

   vtkSmartPointer<*vtkImageMapToColors*> coloredImage =
       vtkSmartPointer<*vtkImageMapToColors*>::New();
   coloredImage->SetLookupTable(iLUT);
   coloredImage->SetInput( iImage );
   coloredImage->PassAlphaToOutputOff();
   coloredImage->SetOutputFormatToRGB();
   coloredImage->Update();

then:
   double* range = coloredImage->GetOutput()->GetScalarRange();
returns [0,0].
then everything I do with this image is messed up...

If *iRed != 0*, the scalar range of the "coloredImage" will be correct 
then my pipeline is working.

Am I doing something wrong?

Thanks,

Nicolas




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110506/eedfbdb1/attachment.htm>


More information about the vtkusers mailing list