[Insight-users] Debug / Release Problem in ITK

Michael Schildt michael.schildt at ifn-magdeburg.de
Tue Feb 19 12:04:42 EST 2008


Hello!

I have a problem with my ITK regsitration program. It runes fine in 
Debug Mode. But when I change to Release Mode it crashes when starting 
landmark based registration. When i compile in Debug mode i link debug 
version of ITK and when i compile in Release mode i use release version 
of ITK.
I tracked the problem to happen at a cout statement for an ITK 
LandmarkSpatialObject: std::cout << "Number of Points in the fixed 
landmark: " << fixedLandmarks << std::endl;
(More info is attached at the end of the email.)

Has anybody experienced similar problems and can somebody shade some 
light on that issue?

Best reguards,
	Michael Schildt

Environment:
- Windows XP Prof SP2
- MSVS C++ 2008 Express Edition
- ITK 3.4.0
- CMake 2.4.8
Also tested with:
- MSVS C++ 2005 Express Edition
- ITK 3.2.0
- CMake 2.4.7

Here is the source context and definitions. ("Landmark" is a simple C++ 
Class just holding position and color of a landmark in non ITK related 
sections of the program.)

// Set fixed and moving landmarks
typedef itk::LandmarkSpatialObject<Dimension> 	PointSetType;
typedef PointSetType::SpatialObjectPointType	PointType;
PointSetType::Pointer fixedLandmarks = PointSetType::New();
PointSetType::Pointer movingLandmarks = PointSetType::New();
PointType p;
PointSetType::PointListType list,list2;

vector<Landmark>::size_type numOfLandmarks = 
min(reference->landmarks.size(),floating->landmarks.size());

for( unsigned int i=0; i<numOfLandmarks; i++)
{
	// reference + without transform
	Landmark lw = reference->landmarks[i];
	//tPt4 pw;
	//matXvect(pw,reference->transformD2W,lw.vec);
	//p.SetPosition(pw[0],pw[1],pw[2]);
	p.SetPosition(lw.vec[0],lw.vec[1],lw.vec[2]);
	list.push_back(p);
}
fixedLandmarks->SetPoints(list);
std::cout << "Number of Points in the fixed landmark: " << 
fixedLandmarks << std::endl;	

The error i get is:
"Unbehandelte Ausnahme bei 0x0054f8bc in VoxelViewer.exe: 0xC0000005: 
Zugriffsverletzung beim Lesen an Position 0xbaadf00d."

This is in itkLightObject.cxx at line 235:

/**
  * Define a default print header for all objects.
  */
void
LightObject
::PrintHeader(std::ostream& os, Indent indent) const
{
   os << indent << this->GetNameOfClass() << " (" << this << ")\n";
}



The calling stack is
 > 
ITKCommon.dll!itk::LightObject::PrintHeader(std::basic_ostream<char,std::char_traits<char> 
 > & os={...}, itk::Indent indent={...})  Zeile 235 + 0x51 Bytes	C++
 
ITKCommon.dll!itk::LightObject::Print(std::basic_ostream<char,std::char_traits<char> 
 > & os={...}, itk::Indent indent={...})  Zeile 113 + 0x17 Bytes	C++
  	VoxelViewer.exe!itk::SmartPointer<itk::BoundingBox<unsigned 
long,3,double,itk::VectorContainer<unsigned long,itk::Point<double,3> > 
 > >::Print(std::basic_ostream<char,std::char_traits<char> > & os={...}) 
  Zeile 134	C++
  	VoxelViewer.exe!itk::operator<<<itk::LandmarkSpatialObject<3> 
 >(std::basic_ostream<char,std::char_traits<char> > & os={...}, 
itk::SmartPointer<itk::LandmarkSpatialObject<3> > p={...})  Zeile 157	C++
  	VoxelViewer.exe!registerLandmarksAndRigid(float [4][4]& 
rotation=0x0012fbb4, float [4][4]& translation=0x0012fb74, const 
Description3D * reference=0x004d5e28, const Description3D * 
floating=0x004d60f8)  Zeile 586 + 0x50 Bytes	C++


More information about the Insight-users mailing list