<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<b>I included some code (used in a templated function) to clarify my question:</b><br><i><br> // ImageTypes<br> typedef itk::Image<PixelType, Dimension> InputImageType;<br> <br> // Read<br> typedef itk::ImageFileReader<InputImageType> InputReaderType;<br> typename InputReaderType::Pointer reader = InputReaderType::New();<br> reader->SetFileName( m_InputFileName);<br> reader->Update();<br> typename InputImageType::Pointer input= reader->GetOutput();<br> std::cout<<"Input Origin is "<<input->GetOrigin()<<std::endl;<br> <br> // Filter<br> typedef itk::MirrorPadImageFilter<InputImageType, InputImageType> MirrorPadImageFilterType;<br> typename MirrorPadImageFilterType::Pointer mirrorFilter=MirrorPadImageFilterType::New();<br> mirrorFilter->SetInput(input);<br> typename InputImageType::SizeType size;<br> size.Fill(10);<br> mirrorFilter->SetPadLowerBound(size);<br> mirrorFilter->Update();<br><br> // Output<br> typename InputImageType::Pointer output=mirrorFilter->GetOutput();<br> std::cout<<"Output Origin is "<<output->GetOrigin()<<std::endl;<br> output->Update();<br> std::cout<<"Output Origin is "<<output->GetOrigin()<<std::endl;<br><br> // Write<br> typedef itk::ImageFileWriter<InputImageType> WriterType;<br> typename WriterType::Pointer writer = WriterType::New();<br> writer->SetFileName(m_ArgsInfo.output_arg);<br> writer->SetInput(output);<br> writer->Update();</i><br><br><b>Output of this piece of code is </b><br><br><i>Input Origin is [0, 0, -282]<br>Output Origin is [0, 0, -282]<br>Output Origin is [0, 0, -282]</i><br><b><br><br>However the written output has header file:<br></b><br><i>ObjectType = Image<br>NDims = 3<br>BinaryData = True<br>BinaryDataByteOrderMSB = False<br>CompressedData = False<br>TransformMatrix = 1 0 0 0 1 0 0 0 1<br>Offset = -20 -20 -302<br>CenterOfRotation = 0 0 0<br>AnatomicalOrientation = RAI<br>ElementSpacing = 2 2 2<br>DimSize = 245 186 292<br>ElementType = MET_FLOAT<br>ElementDataFile = air_padded.raw</i><br><br><b>In this header, the origin HAS changed according to the padding size at the lower end?<br><br>Thank you in advance for your help,<br>Jef</b><br><br><br><br>> Date: Tue, 15 Sep 2009 08:22:50 -0400<br>> Subject: Re: [Insight-users] Get and Set itk Origin<br>> From: bill.lorensen@gmail.com<a title="Send" href="javascript:;" onclick="if(window.ComposeContactPicker)return Control.invokeStatic('ComposeContactPicker', 'sendMessagePrep', event, null);" id="SendMessage">
<span class="Label">Send</span></a><br>> To: jvdmb@hotmail.com<br>> CC: insight-users@itk.org<br>> <br>> Maybe you should post some code. What you describe should work.<br>> <br>> Bill<br>> <br>> On Tue, Sep 15, 2009 at 5:32 AM, jef vdmb <jvdmb@hotmail.com> wrote:<br>> > Hi,<br>> ><br>> > I am having a hard time understanding the way meta data like the image<br>> > origin is updated after a pipeline execution.<br>> ><br>> > My situation is the following:<br>> ><br>> > * an image is read<br>> > * next passed as input to a filter (in this case MirrorPadImageFilter, but I<br>> > have seen it for others as well)<br>> > * the filter is updated (->Update());<br>> > * the output retrieved using ->GetOutput()<br>> ><br>> > The initial input had origin (0,0,0). The output however should have an<br>> > origin different from zero (with the parameters I used for the<br>> > MirrorPadImageFilter). When the output is interrogated for its origin<br>> > (->GetOrigin() ), it (wrongly) shows all zeros. When writing the image<br>> > afterwards, it was written with the correct origin ( offset field of the<br>> > .mhd image format).<br>> ><br>> > It would seem my output image is not yet updated at the time I performed the<br>> > ->GetOrigin(). The last filter was however explicitly updated just before<br>> > and even an "->Update()" on the output image itself doesn't modify this<br>> > behaviour.<br>> ><br>> > I would like to retrieve the origin for further processing but seem to end<br>> > up with the uninitialized (0,0,0). I would appreciate any suggestions on<br>> > how to assure the meta information is fully updated.<br>> ><br>> > Regards,<br>> > Jef<br>> ><br>> ><br>> ><br>> > ________________________________<br>> > Hotmail: Powerful Free email with security by Microsoft. Get it now.<br>> > _____________________________________<br>> > Powered by www.kitware.com<br>> ><br>> > Visit other Kitware open-source projects at<br>> > http://www.kitware.com/opensource/opensource.html<br>> ><br>> > Please keep messages on-topic and check the ITK FAQ at:<br>> > http://www.itk.org/Wiki/ITK_FAQ<br>> ><br>> > Follow this link to subscribe/unsubscribe:<br>> > http://www.itk.org/mailman/listinfo/insight-users<br>> ><br>> ><br><br /><hr />Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. <a href='http://clk.atdmt.com/GBL/go/171222985/direct/01/' target='_new'>Sign up now.</a></body>
</html>