[Insight-users] Reading Dicom files
Mathieu Malaterre
mathieu.malaterre at kitware.com
Thu Jun 1 13:30:57 EDT 2006
Andrew,
Could you share a copy of a DICOM RT image. I would like to add it to
the gdcmData baseline to run regression testing on it. So that in the
future we directly support this DICOM IOD.
Thanks for your help
Mathieu
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