[ITK] change orientation of images with OrientImageFilter

Butlers Home butlershomecoffee at gmail.com
Tue Jul 29 11:13:15 EDT 2014


>From what I read so far, there is a clarification with respect to the
difference between the interpretation of the orientation within metaimages
files and DICOM images. However, I cannot find clear information on how to
tackle the issue of metaimage orientation adjustment.

Are the answers for the following questions clearly established?:
1. is the itk::OrientImageFilter fully effective on a metaimage when one
desires to change the image orientation both visually and within the stored
information?
2. If no, is there a workaround for this problem that allows me to still
use metaimages?
3. Do the ITK registration algorithms, by any chance, match internally the
orientations between images?

Thank you for your help!

Best,


On 29 July 2014 16:53, Andras Lasso <lasso at queensu.ca> wrote:

>  We experienced the same issue in Slicer (see
> http://www.na-mic.org/Bug/view.php?id=2173). ITK ignores anatomical
> orientation in MetaIO images, while ITK properly uses anatomical
> orientation information in some other file formats (e.g., NRRD).
>
>  Andras
>
>  *From:* Butlers Home <butlershomecoffee at gmail.com>
> *Sent:* ‎Tuesday‎, ‎July‎ ‎29‎, ‎2014 ‎10‎:‎13‎ ‎AM
> *To:* community at itk.org
>
>   I would like to know how I can change the orientation of two 3D images.
> Scenario:
> - both images are .mha
> - one image has RAI as the initial orientation
> - 2nd image has LPS as the initial orientation
>
>  I would like to set the same orientation RAI for both images before
> processing them (i.e., registering them in my case). With the below
> mentioned code I manage to change the orientation specified textually in
> the .mha files but visually they do not change. Why is that? Is the
> orientation changing just within the header specifications without actually
> changing the visualization part? For visualization I used ITK-SNAP.
>
>  Here is a code snippet from what I do:
>
>  [...]
>
>  typedef itk::ImageFileReader< ImageType2 > ImageReaderType1;
> typedef itk::ImageFileReader< ImageType1 > ImageReaderType2;
>
>  ImageReaderType1::Pointer imReader1 = ImageReaderType1::New();
> ImageReaderType2::Pointer imReader2 = ImageReaderType2::New();
>
>  imReader1->SetFileName("im1.mha");
>  imReader2->SetFileName("im2.mha");
>
>  imReader1->Update();
>
>  // set both images to same orientation
>
>  // orientation filter for 1st image
> itk::OrientImageFilter<ImageType1, ImageType1>::Pointer orienter1 =
> itk::OrientImageFilter<ImageType1, ImageType1>::New();
>  orienter1->UseImageDirectionOn();
>
> orienter1->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAI);
> orienter1->SetInput(imReader1->GetOutput());
> orienter1->Update();
>
>  // orientation filter for 2nd image
> itk::OrientImageFilter<ImageType2, ImageType2>::Pointer orienter2 =
> itk::OrientImageFilter<ImageType2, ImageType2>::New();
>  orienter2->UseImageDirectionOn();
>
> orienter2->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAI);
> orienter2->SetInput(imReader2->GetOutput());
> orienter2->Update();
>
>  [...]
>
>  I tried not using the cosine-based approach, i.e., use the
> itk::AnalyzeImageIO class together with itk::ExposeMetaData<>() but for
> some unknown reason, the orientation is not determined appropriately. I
> would also prefer not using them at all because, as far as I understood,
> they are deprecated.
>
>  Thank you.
>
>  Best regards,
> --
> Butlers
>



-- 
Butlers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140729/2d7a16c1/attachment-0002.html>


More information about the Community mailing list