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

David Gobbi david.gobbi at gmail.com
Wed May 11 09:53:25 EDT 2016


Since you're already using vtk-dicom, you can use vtkDICOMApplyRescale
to convert your CT image to Hounsfield units (if you use this filter, you
should
also call AutoRescaleOff() on the reader).

After the image has been converted to Hounsfield units, you can use the
"Window Center" and "Window Width" presets that are stored in the meta
data to set the range for the lookup table.

However, I usually ignore these presets, and instead use the VTK class
vtkImageHistogramStatistics to compute the range.  Its GetAutoRange()
computes a range by doing some simple histogram analysis.

If you enjoy doing a lot of reading, the relevant parts the DICOM standard
are here:
http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html

After the image goes through vtkImageMapToColors, how are you
rendering it?

 - David

On Wed, May 11, 2016 at 6:19 AM, Flaviu2 <flaviu2 at yahoo.com> wrote:

> I have tried this:
> <raw>
> // Create a greyscale lookup m_pLUTAxial
> m_pLUTAxial->SetValueRange(0.0, 1.0); // from black to white
> m_pLUTAxial->SetSaturationRange(0.0, 0.0); // no color saturation
> double dRange[2];
> m_pDICOMReader->Update();
> m_pDICOMReader->GetOutput()->GetScalarRange(dRange);
> m_pLUTAxial->SetRange(dRange); // image intensity range
> m_pLUTAxial->SetRampToLinear();
> m_pLUTAxial->Build();
> m_pColorAxial->SetLookupTable(m_pLUTAxial);
> </raw>
> The trouble is that image m_pColorAxial which is vtkMapImageToColors, is
> still whiter ... I noticed that dRange is between 0 and 3913 ...
>
> I guess that is more than that ... I will try to dig into converting
> pixels to Hounsfield units ... aIs nybody done this before ?
>
> Flaviu.
>
>
>
>
> On Tuesday, May 10, 2016 5:15 PM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>
> On Tue, May 10, 2016 at 7:37 AM, Flaviu2 <flaviu2 at yahoo.com> wrote:
> >
> > Very useful your comments ! I have learned something here.
> >
> > The line
> >
> > > table->SetRange(0, 2047)
>
> Try something like the code below, it is simple but it often works fine.
> If it doesn't work for your image, there are more sophisticated methods
> that can be used, but they involve computing some statistics on the
> image and using the metadata to convert pixels to Hounsfield units.
>
> m_pDICOMReader->Update();
> double range[2];
> m_pDICOMReader->GetOutput()->GetScalarRange(range);
> table->SetRange(range);
>
>  - David
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160511/dd5b2635/attachment.html>


More information about the vtkusers mailing list