[vtkusers] No LookupTable was set but input data is not VTK_UNSIGNED_CHAR

David Gobbi david.gobbi at gmail.com
Tue May 10 08:19:55 EDT 2016


On Tue, May 10, 2016 at 5:53 AM, Flaviu2 via vtkusers <vtkusers at vtk.org>
wrote:

> My question is, it is OK to give up of lookup table ?

If the input is 16-bit data (like most DICOM) then it needs a lookup table.

> And how to setup VTK_UNSIGNED_CHAR at my input image data ?

Don't!  If the DICOM file is 16-bit data, then use 16-bit data in VTK.

> I have tried this:
>
> m_pDICOMReader->GetOutput()->AllocateScalars(VTK_UNSIGNED_CHAR, 3);

This will not work.  The reader cannot read a 16-bit file into an 8-bit
output.

> Not working .... can you help me, please ?

Create a vtkLookupTable for vtkImageMapToColors.

table->SetValueRange(0.0, 1.0);
table->SetSaturationRange(0.0, 0.0);
table->SetRampToLinear();
table->Build();

Also, use table->SetRange(min, max) to tell the lookup table the min and max
values in the image, e.g. something like table->SetRange(0, 2047).

Cheers,
 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160510/268d01ea/attachment.html>


More information about the vtkusers mailing list