<br>Hi Michael,<br><br><br>       This looks like a bug in your code      :-(<br><br><br><br>Typical suspects are:<br><br><br>A) The fixed image is not available yet at<br>     the time you call GetLargestPossibleRegion(),<br>
     GetOrigin(), GetSpacing().<br><br>      You should call   <br><br>                    fixedIm-&gt;Update()<br><br>        before you call any of the above methods.<br><br><br>We will learn a lot about other possible causes if<br>
you add to your code the following:<br><br>        fixedIm-&gt;Print( std::cout );<br>        movingIm-&gt;Print( std::cout );<br>        resampler-&gt;Print( std::cout );<br><br>before the line<br><br>         resampler-&gt;Update();<br>
<br>and if you post the resulting output text to the<br>mailing list.<br><br><br>      Please let us know what you find.<br><br><br>           Thanks<br><br><br>                 Luis<br><br><br>----------------------------------------------------------------<br>
<div class="gmail_quote">On Fri, Jun 26, 2009 at 6:42 AM, Michael Schildt <span dir="ltr">&lt;<a href="mailto:michael.schildt@ifn-magdeburg.de">michael.schildt@ifn-magdeburg.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello!<br>
<br>
I have some trouble with ResampleImageFilter. I&#39;m not sure if it is a<br>
bug in my program or in ITK. It works as expected in Debug configuration<br>
but crashes in Release mode. I traced to the source line in ITK were it<br>
appear in RelWithDebMode configuration. I attach some information and<br>
source.<br>
<br>
Best reguards,<br>
   Michael Schildt<br>
<br>
The method based on the example in the itkSoftwareGuide:<br>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>
template &lt;typename dataT, typename TrfType&gt;<br>
typename itk::Image&lt;dataT,3&gt;::Pointer transformImage(typename<br>
itk::Image&lt;dataT,3&gt;::Pointer fixedIm,<br>
                                                    typename<br>
itk::Image&lt;dataT,3&gt;::Pointer movingIm,<br>
                                                    typename<br>
TrfType::ConstPointer transform)<br>
{<br>
 typedef itk::Image&lt;dataT, 3&gt; ImageType;<br>
 typedef TrfType TransformType;<br>
 typedef itk::LinearInterpolateImageFunction&lt;ImageType,double&gt;<br>
InterpolatorType;<br>
 //typedef itk::WindowedSincInterpolateImageFunction&lt;ImageType,3&gt;<br>
InterpolatorType;<br>
<br>
 typedef itk::ResampleImageFilter&lt;ImageType,ImageType&gt; ResamplerType;<br>
<br>
 typename InterpolatorType::Pointer interpolator = InterpolatorType::New();<br>
<br>
 typename ResamplerType::Pointer resampler = ResamplerType::New();<br>
 resampler-&gt;SetInput( movingIm );<br>
<br>
 resampler-&gt;SetTransform( transform.GetPointer() );<br>
 resampler-&gt;SetInterpolator( interpolator.GetPointer() );<br>
 resampler-&gt;SetSize( fixedIm-&gt;GetLargestPossibleRegion().GetSize() );<br>
 resampler-&gt;SetOutputOrigin( fixedIm-&gt;GetOrigin() );<br>
 resampler-&gt;SetOutputSpacing( fixedIm-&gt;GetSpacing() );<br>
 resampler-&gt;SetDefaultPixelValue( 0 );<br>
<br>
 // resample the moving image<br>
 resampler-&gt;Update();<br>
<br>
 return resampler-&gt;GetOutput();<br>
}<br>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>
<br>
It appears in the Update() method of the resampler. While debugging it<br>
seems like a problem in itkDataObject.cxx at line marked with **<br>
<br>
//----------------------------------------------------------------------------<br>
void<br>
DataObject<br>
::UpdateOutputData()<br>
{<br>
 // If we need to update due to PipelineMTime, or the fact that our<br>
 // data was released, then propagate the UpdateOutputData to the source<br>
 // if there is one.<br>
 if ( m_UpdateMTime &lt; m_PipelineMTime || m_DataReleased ||<br>
      this-&gt;RequestedRegionIsOutsideOfTheBufferedRegion() )<br>
   {<br>
   if ( m_Source )      // &lt;---m_Source is valid, but when i step over<br>
here, it gets an invalid pointer<br>
     {<br>
**      m_Source-&gt;UpdateOutputData(this);      // maybe call on invalid<br>
pointer?<br>
     }<br>
   }<br>
}<br>
//----------------------------------------------------------------------------<br>
<br>
Stack backtrace:<br>
<br>
    BrainGUI.exe!std::_Vector_iterator&lt;unsigned<br>
int,std::allocator&lt;unsigned int&gt; &gt;::operator+()  + 0x17 Bytes    C++<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
   BrainGUI.exe!std::vector&lt;unsigned int,std::allocator&lt;unsigned int&gt; ::resize(unsigned int _Newsize=1, unsigned int _Val=0)  Zeile 721 + <br>
</blockquote>
0x36 Bytes    C++<br>
    BrainGUI.exe!std::vector&lt;bool,std::allocator&lt;bool&gt;<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
::_Insert_x(std::_Vb_const_iterator&lt;unsigned <br>
</blockquote>
int,int,std::vector&lt;bool,std::allocator&lt;bool&gt; &gt; &gt; _Where=..., unsigned<br>
int _Count=1)  Zeile 2312    C++<br>
    BrainGUI.exe!std::vector&lt;bool,std::allocator&lt;bool&gt;<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
::_Insert_n(std::_Vb_const_iterator&lt;unsigned <br>
</blockquote>
int,int,std::vector&lt;bool,std::allocator&lt;bool&gt; &gt; &gt; _Where=..., unsigned<br>
int _Count=1, bool _Val=false)  Zeile 2292    C++<br>
    BrainGUI.exe!std::vector&lt;bool,std::allocator&lt;bool&gt;<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
::resize(unsigned int _Newsize=1, bool _Val=false)  Zeile 2044    C++<br>
</blockquote>
    BrainGUI.exe!itk::ProcessObject::CacheInputReleaseDataFlags()<br>
Zeile 1055    C++<br>
    BrainGUI.exe!itk::ProcessObject::UpdateOutputData(itk::DataObject *<br>
__formal=0x02079270)  Zeile 964    C++<br>
    BrainGUI.exe!itk::DataObject::UpdateOutputData()  Zeile 420 + 0x8<br>
Bytes    C++<br>
<br>
BrainGUI.exe!transformImage&lt;float,itk::VersorRigid3DTransform&lt;double&gt;<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
(itk::SmartPointer&lt;itk::Image&lt;float,3&gt; &gt; fixedIm={...}, <br>
</blockquote>
itk::SmartPointer&lt;itk::Image&lt;float,3&gt; &gt; movingIm={...},<br>
itk::SmartPointer&lt;itk::VersorRigid3DTransform&lt;double&gt; const &gt;<br>
transform={...})  Zeile 123    C++<br>
    BrainGUI.exe!VersorRigid3DRegistration::doRegistration(bool<br>
newVolume=true, void (const double &amp;, const<br>
std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt; &amp;)*<br>
progress=0x004029e1)  Zeile 254 + 0x81 Bytes    C++<br>
    BrainGUI.exe!RegThread::Entry()  Zeile 273 + 0xf Bytes    C++<br>
    BrainGUI.exe!wxThreadInternal::DoThreadStart()  + 0xa5 Bytes    C++<br>
    BrainGUI.exe!wxThreadInternal::WinThreadStart()  + 0x6a Bytes    C++<br>
    BrainGUI.exe!_callthreadstartex()  Zeile 348 + 0x6 Bytes    C<br>
    BrainGUI.exe!_threadstartex(void * ptd=0x04ef1118)  Zeile 326 + 0x5<br>
Bytes    C<br>
<br>
System:<br>
   - Windows XP Prof SP3<br>
   - Visual Studio 2008 Express Edition<br>
   - ITK 3.14<br>
   - CMake 2.6.4<br>
   - wxWidgets 2.8.9 (wxPack Installer)<br>
   - Pentium 4<br>
   - 2GB Ram<br>
<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br>