[vtkusers] Set window/level and convert image DICOM

David Gobbi david.gobbi at gmail.com
Thu Jan 21 17:00:29 EST 2016


Just to clarify my previous email, all CT and PET DICOM images have
RescaleIntercept/RescaleSlope, but for CT, it is not uncommon to have
RescaleIntercept = 0 and RescaleSlope = 1.  In any case, these fields
cannot be ignored if you plan to use WindowCenter and WindowWidth.

On Thu, Jan 21, 2016 at 2:47 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Pedro,
>
> I recommend using vtkImageMapToColors to apply a greyscale lookup table.
> In python, for example, it would look like this:
>
> from vtk import *
>
> greymap = vtkScalarsToColors()
> greymap.SetRange(wl - 0.5*ww, wl + 0.5*ww)
>
> applymap = vtkImageMapToColors()
> applymap.SetInputConnection(...)
> applymap.SetLookupTable(greymap)
> applymap.SetOutputFormatToRGB() # or use SetOutputFormatToLuminance()
> applymap.Update()
>
> Be careful, though, because according to the DICOM standard the
> VOI LUT (i.e. window/level) should only be applied after the Modality LUT
> (i.e. the RescaleIntercept/RescaleSlope).  Probably around half of the
> CT images and nearly all PET images have RescaleIntercept/RescaleSlope,
> so if you do not take these into account, you'll get an incorrect result.
> You'd
> be safe with MRI, which does not have RescaleIntercept/Slope.
>
> So, of course, I'd suggest that you use my vtk-dicom package ;-)
> https://github.com/dgobbi/vtk-dicom
> It has a filter called vtkDICOMApplyRescale that will correctly apply the
> rescale information.
>
>  - David
>
>
> On Thu, Jan 21, 2016 at 2:22 PM, Pedro Paulo <pedropaulobmjr at hotmail.com>
> wrote:
>
>> Hi people, I want to convert a DICOM image to a png, but, before
>> converting, I would like to set the parameters of Window Width and Window
>> Center, to that the png image looks like if the parameters of ww/wl were
>> seen in a viewer, does anyone know how could I do this?
>> Thanks!
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160121/0496a986/attachment.html>


More information about the vtkusers mailing list