[vtkusers] Problem with vtkImageMapToColors

Jothy jothybasu at gmail.com
Tue Feb 22 11:50:25 EST 2011


Hi all,

I have a vtkImageData and slicing it using vtkImageReslice to display axial
slices.

But the problem is, there is no color difference between the pixels. I have
a scalar values from 0 to 50.

Here is the code I use to map through the colors.I am resclaing the
vtkImageData before slicing using vtkImageShiftScale (I set
SetOutputScalarTypeToUnsignedShort()).

Can some none have a look at this?

// Create a  lookup table

    vtkSmartPointer<vtkLookupTable> table =

      vtkSmartPointer<vtkLookupTable>::New();

    table->SetRange(0,50);

    table->SetValueRange(0.5, 1.0);

    table->SetSaturationRange(1.0, 1.0);

    table->SetHueRange(0.666, 0.0);

//    table->SetAlpha(0.8);

    table->SetRampToLinear();

    table->Build();

     // Map the image through the lookup table

    vtkSmartPointer<vtkImageMapToColors> color =

      vtkSmartPointer<vtkImageMapToColors>::New();

    color->SetLookupTable(table);

    color->SetInputConnection(reslice->GetOutputPort());

    color->Update();

and rescaling code:

 vtkSmartPointer<vtkImageShiftScale> scaler=
vtkSmartPointer<vtkImageShiftScale>::New();
scaler->SetInput(imgData);    scaler->SetScale(factor);
scaler->SetOutputScalarTypeToUnsignedShort();    scaler->Update();
this->rtDose=scaler->GetOutput();



Thanks

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


More information about the vtkusers mailing list