[Insight-users] segfault with itkMIRegistrationFunction -itkImageRandomIteratorWithIndex
cyrille Valladeau
cyrille.valladeau at c-s.fr
Thu Jun 11 13:15:53 EDT 2009
Hello,
I am trying to use the class itkMIRegistrationFunction but an unexpected
segfault occurs in the method ComputeUpdate() (mono channel images, size
: 256*256).
The debugger shows me that the problem is coming from the Mercennes
generator of the itkImageRandomIteratorWithIndex class.
I finally found 2 ways to avoid this segfault (modifing the
itkMIRegistrationFunction::ComputeUpdate method):
- First solution:
I change the initialization value of numberOfSamples in:
/l.286 ImageRandomIteratorWithIndex<FixedImageType>
randasamit(img,region);
l.287 unsigned int numberOfSamples=20;
l.288 randasamit.SetNumberOfSamples( numberOfSamples );/
A upper value does not change anything, but a lower one works...!!!
- Second solution:
I initialize the iterator generator seed (without changing the
numerOfSamples):
/ l.286 ImageRandomIteratorWithIndex<FixedImageType>
randasamit(img,region);
l.287 unsigned int numberOfSamples=20;
l.288 randasamit.SetNumberOfSamples( numberOfSamples );
l.289 randasamit.ReinitializeSeed();/
Do you have any idea of what happens?
Do you think it is a real ITK bug or am I using the class in a wrong way?
Thanks,
Guillaume
More information about the Insight-users
mailing list