[Insight-users] Reading Dicom files

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Jun 5 18:22:41 EDT 2006


Andrew,

	Thanks for the information. You are completely right, gdcm does not 
handle RT objects. Please open a bug at:

	http://itk.org/Bug

	And assign it to me. Please include the two tags for origin and 
spacing. I did check those are the rights ones

Mathieu
Ps: You are missing the Z spacing which is specified in 3004,000c

Bill Lorensen wrote:
> Andrew,
> You can still get at this information. We store all dicom tags in the 
> meta data dictionary for the image. Look at the dicom processing 
> examples in Examples/IO to see how to get the meta data dictionary. Once 
> you have it, you can use the ExposeMetaData method to get the values for 
> a given tag.
>  
> Bill
> 
>  
> On 6/1/06, *Hoole, Andrew* <andrew.hoole at addenbrookes.nhs.uk 
> <mailto:andrew.hoole at addenbrookes.nhs.uk>> wrote:
> 
>     Hi Bill
> 
>      
> 
>     The image which I have been using is a DRR from our planning system
>     - RTImage modality. I have looked in the DICOM and the spacing is in
>     (0x3002,0x0011) and the position is in  (0x3002,0x0012). This is
>     probably the issue - it handles normal images not DICOM RT images.
> 
>      
> 
>     *Andrew Hoole *
> 
>     -------------------------------------------------------------------------
> 
> 
>     Medical Physics, Box 152
> 
>     Cambridge University Hospitals NHS Trust
>     Addenbrooke's Hospital
> 
>     Hills Rd
> 
>     Cambridge         Tel: (+44) (0)1223-216544
> 
>     CB2 2QQ           Fax: (+44) (0)1223-257137
> 
>     UK                    Email: andrew.hoole at addenbrookes.nhs.uk
>     <mailto:andrew.hoole at addenbrookes.nhs.uk>
> 
>     --------------------------------------------------------------------------
> 
> 
>     The information contained in this EMAIL and any attachments is
>     confidential and intended solely for the attention and use of the
>     intended recipient. If you are not the intended recipient and have
>     received this email in error you may not disclose, copy, distribute
>     or retain this message or any part of it.
>     See _Email disclaimer <_
>     http://www.addenbrookes.org.uk/email_disclaimer.html_ >_
> 
>     -----Original Message-----
>     *From:* Bill Lorensen [mailto: bill.lorensen at gmail.com
>     <mailto:bill.lorensen at gmail.com>]
>     *Sent:* 01 June 2006 17:35
>     * To:* Hoole, Andrew
>     *Cc:* insight-users at itk.org <mailto:insight-users at itk.org>
>     * Subject:* Re: [Insight-users] Reading Dicom files
> 
>      
> 
>     Andrew,
> 
>      
> 
>     The reader does read the pixel spacing and origin. What is the
>     source of your dicom images?
> 
>      
> 
>     Bill
> 
>      
> 
>     On 6/1/06, *Hoole, Andrew* < andrew.hoole at addenbrookes.nhs.uk
>     <mailto:andrew.hoole at addenbrookes.nhs.uk>> wrote:
> 
>     Hi All
> 
>      
> 
>     I'm new to the ITK stuff and having been working through the User
>     guide. I have used the code in the guide to read a DICOM file and
>     display it in a window. When I read the file it doesn't appear to
>     read the information related to the pixel size or the origin of the
>     image. This information is embedded in the DICOM is there a way to
>     make the reader get this data or is the problem with the image which
>     I hook onto the output of the reader. The code I am using is as
>     follows:
> 
>      
> 
>                 typedef signed short InputPixelType;
> 
>                 const unsigned int   InputDimension = 2;
> 
>      
> 
>                 typedef itk::Image< InputPixelType, InputDimension >
>     InputImageType;
> 
>                 typedef itk::ImageFileReader< InputImageType > ReaderType;
> 
>      
> 
>                 ReaderType::Pointer reader = ReaderType::New();
> 
>                 reader->SetFileName("c:\\temp\\test.dcm");
> 
>                 typedef itk::GDCMImageIO           ImageIOType;
> 
>      
> 
>                 ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
> 
>      
> 
>                 reader->SetImageIO( gdcmImageIO );
> 
>                 try {
> 
>                             reader->Update();
> 
>                 }
> 
>                 catch (itk::ExceptionObject & e){
> 
>                             AfxMessageBox("Exception in file reader
>     ",MB_OK,NULL);
> 
>                             return;
> 
>                 }
> 
>      
> 
>                 typedef itk::Point< double,
>     InputImageType::ImageDimension > PointType;
> 
>                 PointType point;
> 
>                 InputImageType::IndexType pixelIndex;
> 
>                 InputImageType::PixelType pixelValue;
> 
>                 InputImageType::Pointer image = reader->GetOutput();
> 
>      
> 
>                 InputImageType::SpacingType spacing;
> 
>                 spacing[0] = 0.5; // spacing along X
> 
>                 spacing[1] = 0.5; // spacing along Y
> 
>                 image->SetSpacing( spacing );
> 
>                
> 
>                 InputImageType::PointType origin;
> 
>                 origin[0] = -128.0; // coordinates of the
> 
>                 origin[1] = -128.0; // first pixel in N-D
> 
>                 image->SetOrigin( origin );         
> 
>                
> 
>     As you can see I am manually setting the pixel size and origin which
>     is not ideal.
> 
>      
> 
>     Regards
> 
>      
> 
>     *Andrew Hoole *
> 
>     -------------------------------------------------------------------------
> 
> 
>     Medical Physics, Box 152
> 
>     Cambridge University Hospitals NHS Trust
>     Addenbrooke's Hospital
> 
>     Hills Rd
> 
>     Cambridge         Tel: (+44) (0)1223-216544
> 
>     CB2 2QQ           Fax: (+44) (0)1223-257137
> 
>     UK                    Email: andrew.hoole at addenbrookes.nhs.uk
>     <mailto:andrew.hoole at addenbrookes.nhs.uk>
> 
>     --------------------------------------------------------------------------
> 
> 
>     The information contained in this EMAIL and any attachments is
>     confidential and intended solely for the attention and use of the
>     intended recipient. If you are not the intended recipient and have
>     received this email in error you may not disclose, copy, distribute
>     or retain this message or any part of it.
>     See _Email disclaimer <_
>     http://www.addenbrookes.org.uk/email_disclaimer.html_>_
> 
>      
> 
> 
>     _______________________________________________
>     Insight-users mailing list
>     Insight-users at itk.org <mailto: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



More information about the Insight-users mailing list