[Insight-users] Writing Resampled Images With New Orientation

Andreas Schuh andreas.schuh.84 at googlemail.com
Mon May 18 08:05:55 EDT 2009


Hi Kon,

this actually is exactly what I reported yet as bug .. However, 
unfortunately it wasn't addressed so far nor did I get any response 
whether I'm right or not. So I would appreciate if you had a look at 
this bug report and whether it fixes your problem when you apply the 
code fixes which I proposed in the comments.

http://public.kitware.com/Bug/view_all_bug_page.php?filter=20444

regards
Andreas

Kon Z schrieb:
> Hello ALL,
> 
> When I use ResampleImageFilter to resample an 3D image with a new 
> direction matrix
> 
> resampler->SetOutputDirection(directionMatrix);
> 
> the filter output shows the specified orientation (with the values I 
> specify in the direction matrix):
> 
>   Direction:
> 0.529919 0.46188 -0.711233
> 0 0.838671 0.544639
> 0.848048 -0.288615 0.444428
> 
> However, when I pass resample filter output to a writer connected to 
> GDCMImageIO, the saved volume has this orientation (the direction matrix 
> is transposed!):
> 
>   Direction:
> 0.529919 0 0.848048
> 0.46188 0.838671 -0.288615
> -0.711233 0.544639 0.444428
> 
> Am I doing something wrong? Or am I not doing something I'm supposed to 
> do with the image before passing it to the writer? Can someone please 
> explain it to me?
> 
> For the moment I use this workaround I found in the ITK Guide:
> itk::EncapsulateMetaData<std::string>(
>     resampler->GetOutput()->GetMetaDataDictionary(),
>     "0020|0037", // Patient orientation tag.
>     directionStream.str().c_str());
> 
> where directionStream contains the correct string representation of the 
> directionMatrix.
> 
> Thanks.
> 
> Best regards,
> Kon Z
> 
> 
> 
> _____________________________________
> 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