[Insight-users] How to get Image Orientaion, Image Postion etc. for a dicom image using itk
Luis Ibanez
luis.ibanez at kitware.com
Tue Oct 20 18:00:36 EDT 2009
Hi Hui,
The methods that you are looking for,
are in the base class of itkGDCMImageIO:
The itkImageIOBase class.
In particular, you want to use:
A) GetNumberOfDimensions()
B) GetDimensions( i ); // number of pixels along dimension "i"
C) GetOrigin( i ); // i-th component of origin coordinates
D) GetSpacing( i ); // pixel spacing along dimension "i"
E) GetDirection( i ); // Direction cosine of dimension "i"
Regarding parameters such as
1) Field of View
2) Slice thickness
You can get them by using their DICOM tags with the method:
bool GetValueFromTag(const std::string & tag, std::string & value);
For example:
std::string sliceThickness;
imageIO->SetFileName();
imageIO->ReadImageInformation();
imageIO->GetValueFromTag("0018:0050", sliceThickness);
Please note that you MUST call ReadImageInfromation()
before you attempt to gather any data from the ImageIO
class. Otherwise the information from the file will not be
available yet in the ImageIO instance.
Regards,
Luis
------------------------------------------------------------------
On Tue, Oct 20, 2009 at 4:48 PM, Hui Wang <cougarhui at yahoo.com> wrote:
> Hi, All
>
> I am trying to get some header information for a dicom image using itk.
>
> Now I tried itk::GDCMImageIO class. And I can get image dimention using
> GetDimensions function.
>
> spacing using GetSpacing function.
>
> How to get the following information?
>
> Image Orientation
> Image Position
> Slice Thickness
> Slice Location
> Field of View
>
> I didn't find function in itk::GDCMImageIO class to do this.
> Any help is appreciated. Thanks.
>
> Hui
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list