<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,&nbsp;<div>I'm using this code and works ok for me:</div><div><br></div><div><div>typedef itk::InterpolateImageFunction&lt; MovingImageType,double&gt; InterpolatorType;</div><div>typename InterpolatorType::Pointer &nbsp; interpolator;</div><div><br></div><div>.....</div><div>.....</div><div><br></div><div>interpolator = BsplineInterpolatorType::New(); //Generic interpolator type</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>typedef &nbsp; BsplineInterpolatorType * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InterpolatorPointer;</div><div>InterpolatorPointer int_aux = dynamic_cast&lt; InterpolatorPointer&gt;(interpolator.GetPointer());</div><div>int_aux-&gt;SetSplineOrder(3);</div><div><br></div><div><br></div><div>typedef itk::ResampleImageFilter&lt;FixedImageType,MovingImageType &gt;ResampleFilterType;</div><div><br></div><div>typename ResampleFilterType::Pointer resample_grid = ResampleFilterType::New();</div><div><br></div><div>resampleGridImages.push_back(resample_grid);</div><div><br></div><div>resample_grid-&gt;SetTransform( transform );</div><div>resample_grid-&gt;SetInput( gridImage );</div><div><br></div><div>resample_grid-&gt;SetSize( &nbsp; &nbsp;fixedImage-&gt;GetLargestPossibleRegion().GetSize() );</div><div>resample_grid-&gt;SetOutputOrigin( &nbsp;fixedImage-&gt;GetOrigin() );</div><div>resample_grid-&gt;SetOutputSpacing( fixedImage-&gt;GetSpacing() );</div><div>resample_grid-&gt;SetOutputDirection( fixedImage-&gt;GetDirection() );</div><div>resample_grid-&gt;SetDefaultPixelValue( 100 );</div><div>resample_grid-&gt;Update();</div></div><div><br></div><div><br><div apple-content-edited="true">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; "><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">Saludos</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">__________________________________<br><font class="Apple-style-span" color="#b7bfc5">|</font>&nbsp;Ariel Hernán Curiale Ph.D Student<br><font class="Apple-style-span" color="#b7bfc5">|</font>&nbsp;ETSI Telecomunicación<br><font class="Apple-style-span" color="#b7bfc5">|</font>&nbsp;Universidad de Valladolid<br><font class="Apple-style-span" color="#b7bfc5">|</font>&nbsp;Campus Miguel Delibes<br><font class="Apple-style-span" color="#b7bfc5">|</font>&nbsp;47011 Valladolid, Spain<br><font class="Apple-style-span" color="#b7bfc5">|</font>&nbsp;Phone: 983-423000 ext. 5590</div><div><font class="Apple-style-span" color="#b7b7b7" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">|</font>&nbsp;Web:&nbsp;<a href="http://www.curiale.com.ar/"><font class="Apple-style-span" color="#084ebe">www.curiale.com.ar</font></a><br><font class="Apple-style-span" color="#b7b7b7" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">|</font><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; color: rgb(0, 0, 0); ">_________________________________</span></div></div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></div>
</div>
<br><div><div>El 02/10/2012, a las 12:47, alex Dowson escribió:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><br>Hi<br><br>You didn’t set the Transformation anywhere. Can you show me code again with correction .<br><br><br>-----Original Message----- From: Alessandro<br>Sent: Tuesday, October 02, 2012 4:15 PM<br>To: Insight User<br>Subject: Re: [Insight-users] ResamplingFilter problem<br><br>Hi,<br><br>I tried but still nothing seems to come out...<br><br>Ale<br><br>Il giorno 02/ott/2012, alle ore 12.39, alex Dowson ha scritto:<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">Hi<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Try calling the resample-&gt;Update() before the resample-&gt;GetOutput()<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-----Original Message----- From: Alessandro<br></blockquote><blockquote type="cite">Sent: Tuesday, October 02, 2012 4:07 PM<br></blockquote><blockquote type="cite">To: Insight User<br></blockquote><blockquote type="cite">Subject: [Insight-users] ResamplingFilter problem<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hello,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I tried to Resample a 3d Slice Volume using a reference image. I wrote the following function (inside a class) to perform the task:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">ImageVolumeType::Pointer VolumeRetriever::applyResamplingFromImage (ImageVolumeType::Pointer img, ImageVolumeType::Pointer ref) {<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;typedef itk::IdentityTransform&lt;double, 3&gt; TransformType;<br></blockquote><blockquote type="cite"> &nbsp;typedef itk::ResampleImageFilter&lt;ImageVolumeType, ImageVolumeType&gt; ResampleImageFilterType;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;resample-&gt;SetInput(img);<br></blockquote><blockquote type="cite"> &nbsp;resample-&gt;UseReferenceImageOn();<br></blockquote><blockquote type="cite"> &nbsp;resample-&gt;SetReferenceImage(ref);<br></blockquote><blockquote type="cite"> &nbsp;resample-&gt;UpdateLargestPossibleRegion();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> &nbsp;return resample-&gt;GetOutput();<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">where ImageVolumeType is &nbsp;typedef itk::Image&lt; InputPixelType, 3 &gt; ImageVolumeType;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Problem is: when I run it the return is a NULL pointer...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">What am I missing?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks,<br></blockquote><blockquote type="cite">Ale<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_____________________________________<br></blockquote><blockquote type="cite">Powered by <a href="http://www.kitware.com">www.kitware.com</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Visit other Kitware open-source projects at<br></blockquote><blockquote type="cite"><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Kitware offers ITK Training Courses, for more information visit:<br></blockquote><blockquote type="cite"><a href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Please keep messages on-topic and check the ITK FAQ at:<br></blockquote><blockquote type="cite"><a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Follow this link to subscribe/unsubscribe:<br></blockquote><blockquote type="cite"><a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote><br>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<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>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at<br>http://www.kitware.com/opensource/opensource.html<br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<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></div></blockquote></div><br></div></body></html>