[Insight-users] Get and Set itk Origin
jef vdmb
jvdmb at hotmail.com
Tue Sep 15 13:37:51 EDT 2009
Indeed, the index is negative. Thanks for the hint!
Looking at itk::ImageFileWriter::Write()
// BUG 8436: Wrong origin when writing a file with non-zero index
// origin = input->GetOrigin();
const typename TInputImage::IndexType& startIndex = largestRegion.GetIndex();
typename TInputImage::PointType origin;
input->TransformIndexToPhysicalPoint(startIndex, origin);
A non-zero index explicitely needs to be converted to a new origin.
So when using the origin (of an image with non-zero index), one should also pass the index... this is a bit dangerous no?
Thanks again,
Jef
> Subject: Re: [Insight-users] Get and Set itk Origin
> From: hobbsk at ohiou.edu
> To: jvdmb at hotmail.com
> CC: insight-users at itk.org
> Date: Tue, 15 Sep 2009 12:57:43 -0400
>
> On Tue, 2009-09-15 at 09:32 +0000, jef vdmb wrote:
>
> > The initial input had origin (0,0,0). The output however should have
> > an origin different from zero (with the parameters I used for the
> > MirrorPadImageFilter). When the output is interrogated for its origin
> > (->GetOrigin() ), it (wrongly) shows all zeros. When writing the image
> > afterwards, it was written with the correct origin ( offset field of
> > the .mhd image format).
>
>
> I bet that if you get the index of the region of the output image, you
> will see that it has negative numbers.
>
> Only when the image is written is the new origin calculated.
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/171222984/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090915/fdd46a7c/attachment.htm>
More information about the Insight-users
mailing list