[Insight-users] ResampleImageFilter crashes in release mode

Michael Schildt michael.schildt at ifn-magdeburg.de
Fri Jun 26 06:42:36 EDT 2009


Hello!

I have some trouble with ResampleImageFilter. I'm not sure if it is a
bug in my program or in ITK. It works as expected in Debug configuration
but crashes in Release mode. I traced to the source line in ITK were it
appear in RelWithDebMode configuration. I attach some information and
source.

Best reguards,
    Michael Schildt

The method based on the example in the itkSoftwareGuide:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename dataT, typename TrfType>
typename itk::Image<dataT,3>::Pointer transformImage(typename
itk::Image<dataT,3>::Pointer fixedIm,
                                                     typename
itk::Image<dataT,3>::Pointer movingIm,
                                                     typename
TrfType::ConstPointer transform)
{
  typedef itk::Image<dataT, 3> ImageType;
  typedef TrfType TransformType;
  typedef itk::LinearInterpolateImageFunction<ImageType,double>
InterpolatorType;
  //typedef itk::WindowedSincInterpolateImageFunction<ImageType,3>
InterpolatorType;

  typedef itk::ResampleImageFilter<ImageType,ImageType> ResamplerType;

  typename InterpolatorType::Pointer interpolator = InterpolatorType::New();

  typename ResamplerType::Pointer resampler = ResamplerType::New();
  resampler->SetInput( movingIm );

  resampler->SetTransform( transform.GetPointer() );
  resampler->SetInterpolator( interpolator.GetPointer() );
  resampler->SetSize( fixedIm->GetLargestPossibleRegion().GetSize() );
  resampler->SetOutputOrigin( fixedIm->GetOrigin() );
  resampler->SetOutputSpacing( fixedIm->GetSpacing() );
  resampler->SetDefaultPixelValue( 0 );

  // resample the moving image
  resampler->Update();

  return resampler->GetOutput();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

It appears in the Update() method of the resampler. While debugging it
seems like a problem in itkDataObject.cxx at line marked with **

//----------------------------------------------------------------------------
void
DataObject
::UpdateOutputData()
{
  // If we need to update due to PipelineMTime, or the fact that our
  // data was released, then propagate the UpdateOutputData to the source
  // if there is one.
  if ( m_UpdateMTime < m_PipelineMTime || m_DataReleased ||
       this->RequestedRegionIsOutsideOfTheBufferedRegion() )
    {
    if ( m_Source )      // <---m_Source is valid, but when i step over
here, it gets an invalid pointer
      {
**      m_Source->UpdateOutputData(this);      // maybe call on invalid
pointer?
      }
    }
}
//----------------------------------------------------------------------------

Stack backtrace:

     BrainGUI.exe!std::_Vector_iterator<unsigned
int,std::allocator<unsigned int> >::operator+()  + 0x17 Bytes    C++
>    BrainGUI.exe!std::vector<unsigned int,std::allocator<unsigned int> 
>::resize(unsigned int _Newsize=1, unsigned int _Val=0)  Zeile 721 + 
0x36 Bytes    C++
     BrainGUI.exe!std::vector<bool,std::allocator<bool>
>::_Insert_x(std::_Vb_const_iterator<unsigned 
int,int,std::vector<bool,std::allocator<bool> > > _Where=..., unsigned
int _Count=1)  Zeile 2312    C++
     BrainGUI.exe!std::vector<bool,std::allocator<bool>
>::_Insert_n(std::_Vb_const_iterator<unsigned 
int,int,std::vector<bool,std::allocator<bool> > > _Where=..., unsigned
int _Count=1, bool _Val=false)  Zeile 2292    C++
     BrainGUI.exe!std::vector<bool,std::allocator<bool>
>::resize(unsigned int _Newsize=1, bool _Val=false)  Zeile 2044    C++
     BrainGUI.exe!itk::ProcessObject::CacheInputReleaseDataFlags()
Zeile 1055    C++
     BrainGUI.exe!itk::ProcessObject::UpdateOutputData(itk::DataObject *
__formal=0x02079270)  Zeile 964    C++
     BrainGUI.exe!itk::DataObject::UpdateOutputData()  Zeile 420 + 0x8
Bytes    C++

BrainGUI.exe!transformImage<float,itk::VersorRigid3DTransform<double>
>(itk::SmartPointer<itk::Image<float,3> > fixedIm={...}, 
itk::SmartPointer<itk::Image<float,3> > movingIm={...},
itk::SmartPointer<itk::VersorRigid3DTransform<double> const >
transform={...})  Zeile 123    C++
     BrainGUI.exe!VersorRigid3DRegistration::doRegistration(bool
newVolume=true, void (const double &, const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &)*
progress=0x004029e1)  Zeile 254 + 0x81 Bytes    C++
     BrainGUI.exe!RegThread::Entry()  Zeile 273 + 0xf Bytes    C++
     BrainGUI.exe!wxThreadInternal::DoThreadStart()  + 0xa5 Bytes    C++
     BrainGUI.exe!wxThreadInternal::WinThreadStart()  + 0x6a Bytes    C++
     BrainGUI.exe!_callthreadstartex()  Zeile 348 + 0x6 Bytes    C
     BrainGUI.exe!_threadstartex(void * ptd=0x04ef1118)  Zeile 326 + 0x5
Bytes    C

System:
    - Windows XP Prof SP3
    - Visual Studio 2008 Express Edition
    - ITK 3.14
    - CMake 2.6.4
    - wxWidgets 2.8.9 (wxPack Installer)
    - Pentium 4
    - 2GB Ram




More information about the Insight-users mailing list