[Insight-users] DICOM : ITK or VTK
Frank Gao
gao at mdimaging.com
Mon Mar 13 13:33:08 EST 2006
This does fix the problem!
Thanks to all of you. It's a lot of fun in this community.
Frank
-----Original Message-----
From: Andinet Enquobahrie [mailto:andinet.enqu at kitware.com]
Sent: Monday, March 13, 2006 7:28 AM
To: Ana Sandro
Cc: mathieu.malaterre at kitware.com; gao at mdimaging.com; insight-users at itk.org
Subject: Re: [Insight-users] DICOM : ITK or VTK
Hi Ana,
When reading dicom images you have to use the correct data type that
corresponds to the modality type. CT values measured in HU can be
negative as you can see from the HU values of typical materials listed in
http://www.itk.org/Wiki/ITK_Hounsfield_Units
Linear transformation is applied to the CT values when the data is
written to a dicom file (intercept and slope dicom tags in the header
correspond to this transformation). When you read a dicom image in ITK
using GDCM, the image are rescaled back to the HU unit range.
Therefore, you should use a signed short type to correctly visualize
your CT image. If you use unsigned short type, the pixels in the
negative HU range will be casted to a large positive value and that is
the reason why you are getting a white background...
Having said that, if you would like to do your image analysis task on a
different data type, you can use one of the intensity mapping filters
available in ITK to rescale your data.
itk::RrescaleIntensityImageFilter
itk::ShiftScaleImageFilter...
etc...
HTH,
-Andinet
> Hello,i'm vtkuser too and I've exactly the same problem.I read Dicom
> files of a CT study using ITK and I convert them to VTK with the same
> classes that Frank ( you can see that fragment code below). I don´t
> understand what the solution is,Do I have to convert them to png files
> with DicomImageReadWrite?
> I've observed that if I read them like images of signed short type
> there's no problem and I can see them whit the correct gray map but if
> I read them like images of unsigned short type (and that's what I
> need) I see them with the inverted gray map as Frank does. The code I
> use is:
>
> typedef itk::Image<unsigned short,2> ImageType; //if I use here signed
> short there's no problem.
> typedef itk::ImageFileReader<ImageType> ReaderType;
> typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
>
> ReaderType::Pointer reader= ReaderType::New();
> ConnectorType::Pointer connector= ConnectorType::New();
> reader->SetFileName( argv[1]);
> connector->SetInput( reader->GetOutput() );
>
> Could you help me?I don't understan what have you done to correct it?
> Thank you very much.
> Regards.
>
>
>
>> From: Mathieu Malaterre <mathieu.malaterre at kitware.com>
>> To: gao at mdimaging.com
>> CC: insight-users at itk.org
>> Subject: Re: [Insight-users] DICOM : ITK or VTK
>> Date: Fri, 10 Mar 2006 17:17:10 -0500
>>
>> Frank,
>>
>> Thanks for tending the image, it makes testing much easier.
>> Without any change I ran the DicomImageReadWrite.cxx example,
>> like this:
>>
>> $ ./bin/DicomImageReadWrite IM-0001-0052.dcm my.dcm my.png my2.dcm
>>
>> Looking at the file my.png I don't anything odd with it. Could
>> you confirm ?
>>
>> Thanks
>> Mathieu
>>
>> Frank Gao wrote:
>>
>>> Hi Mathieu,
>>>
>>> Attached please find the source code, the picture in pic.doc, and
>>> the dicom
>>> file I used.
>>>
>>> I am using VTK 5.0, ITK 2.4.0.
>>>
>>> By the way, I went to ITK download web page, filled in all the data,
>>> but
>>> could never get out of the page to start downloading.
>>>
>>> Thanks,
>>>
>>> Frank
>>>
>>> -----Original Message-----
>>> From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
>>> Sent: Thursday, March 09, 2006 5:34 AM
>>> To: gao at mdimaging.com
>>> Cc: insight-users at itk.org
>>> Subject: Re: [Insight-users] DICOM : ITK or VTK
>>>
>>> Frank,
>>>
>>> Do you have permission to share this image ? If so could you
>>> send it
>>> to
>>> me ? That'd be the easiest way.
>>>
>>> If not, could you send us a dump of the header using
>>> 'DicomImageReadPrintTags' (you can find it in the Examples/IO dir). And
>>> parallel to that send us how you instanciate the itk::Image.
>>>
>>> Thanks
>>> Mathieu
>>>
>>> Frank Gao wrote:
>>>
>>>> Hi,
>>>>
>>>>
>>>>
>>>> Can anyone please help with this?
>>>>
>>>>
>>>>
>>>> First, I use VTK to load 2D DICOM file and display it. Everything
>>>> is good.
>>>>
>>>>
>>>>
>>>> Then I try to read 2D DICOM file with itkImageFileReader, and then use
>>>> itkImageTOVTKImagefilter to load the data into VTK and display it.
>>>> I got
>>>> a picture with inverted gray maps (black turns into white).
>>>>
>>>>
>>>>
>>>> Is there any option in either ITK or VTK side to correct this? Do I
>>>> have
>>>> to use any filter to reverse the picture?
>>>>
>>>>
>>>>
>>>> Your help is really appreciated.
>>>>
>>>>
>>>>
>>>> Frank
>>>>
>>>>
>>>>
>>>>
>>>> -----------------------------------------------------------------------
-
>>>>
>>>>
>>>> _______________________________________________
>>>> Insight-users mailing list
>>>> Insight-users at itk.org
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>
>
> _________________________________________________________________
> Dale rienda suelta a tu tiempo libre. Mil ideas para exprimir tu ocio
> con MSN Entretenimiento. http://entretenimiento.msn.es/
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list