[Insight-users] Debug / Release Problem in ITK

Michael Schildt michael.schildt at ifn-magdeburg.de
Mon Feb 25 06:24:30 EST 2008


Hello,

thank you for your answer. Yes the number of landmarks is identical in 
fixed and moving data set and there is a direct correlation between 
landmarks with same index by definition of my landmarks. Thats why i 
have choosen this landmark algorithm instead of ICP which just minimizes 
the distance between some points without known correspondence. But the 
algorithm itself is working fine. The resulting transform is correct. 
The problem araises when i do a simple cout of the itk-object in release 
mode. The identical source code is working fine in debug mode. When i 
comment out just the "cout" line the programm runs fine in release mode 
too. So something strange is happening in line "std::cout << "Number of 
Points in the fixed landmark: " << fixedLandmarks << std::endl;" in 
release mode. I have no clue about the reason...

Best reguards,
    Michael Schildt

Luis Ibanez schrieb:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">
> Hi Michael,
>
>
> Thanks for the detailed description of your problem.
>
> Is it possible that you may be feeding the Landmark registration class
> with lists of fixed landmarks and moving landmarks that *do not* have
> the same number of points ?
>
> This class expects the two lists to have the same size (that is, the
> same number of landmarks). It also assumes that the landmarks have a
> defined correspondence:
>
>    fixedLandmark 0  ---->  movingLandmark 0
>    fixedLandmark 1  ---->  movingLandmark 1
>    fixedLandmark 2  ---->  movingLandmark 2
>    .....
>
>
> If you have two sets of points of different sizes, then
> you probably don't have predefined correspondences, and
> you should consider using the ICP (iterative closest point)
> method instead.  You will find examples on the use of ICP
> in the directory:
>
>         Insight/Code/Examples/Patented
>
>
> Note that the patent for ICP expired recently.
>
>
>
> Regards,
>
>
>     Luis
>
>
>
> -----------------------
> Michael Schildt wrote:
>> 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++
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>
>
> </div>


More information about the Insight-users mailing list