[Insight-users] Reading Dicom files

Bill Lorensen bill.lorensen at gmail.com
Thu Jun 1 13:02:36 EDT 2006


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> 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
>
> --------------------------------------------------------------------------
>
> 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]
> *Sent:* 01 June 2006 17:35
> *To:* Hoole, Andrew
> *Cc:* 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> 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
>
> --------------------------------------------------------------------------
>
> 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
> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060601/e8a5b9ec/attachment.html


More information about the Insight-users mailing list