[Insight-users] How to get Image Orientaion, Image Postion etc. for a dicom image using itk

Luis Ibanez luis.ibanez at kitware.com
Wed Oct 21 11:30:56 EDT 2009


Hi Hui,

Thanks for clarifying that the correct tag to use is:

                             "0018|0050"

Instead of "0018:0050"


      Regards,


                Luis


--------------------------------------------------------------------------------
On Tue, Oct 20, 2009 at 10:01 PM, Hui Wang <cougarhui at yahoo.com> wrote:
> Hi, Louis,
>
> Thank you very much. The explanation is very clear and informative.
>
> For the function,
>   bool GetValueFromTag(const std::string & tag, std::string & value);
> The tag string should be "0018|0050" . Otherwise it
> will produce
> empty string. Hope this is helpful for the people who have similar problems.
>
> Thanks again.
>
> Hui
>
>
> ________________________________
> From: Luis Ibanez <luis.ibanez at kitware.com>
> To: Hui Wang <cougarhui at yahoo.com>
> Cc: insight-users at itk.org
> Sent: Tue, October 20, 2009 6:00:36 PM
> Subject: Re: [Insight-users] How to get Image Orientaion, Image Postion etc.
> for a dicom image using itk
>
> 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