[Insight-developers] ImageRandomNonRepeatingConstIteratorWithIndex segfault
David Doria
daviddoria at gmail.com
Sat Feb 26 15:36:53 EST 2011
If I create this iterator with:
itk::ImageRandomNonRepeatingConstIteratorWithIndex<ImageType>
imageIterator(image, image->GetLargestPossibleRegion());
everything works fine. However, if I do this:
itk::ImageRandomNonRepeatingConstIteratorWithIndex<ImageType> imageIterator;
imageIterator =
itk::ImageRandomNonRepeatingConstIteratorWithIndex<ImageType>(image,
image->GetLargestPossibleRegion());
it segfaults on the GoToBegin() call.
The crash is at this line of UpdatePosition():
PositionValueType position = ( *( this->m_Permutation )
)[m_NumberOfSamplesDone % m_NumberOfSamplesRequested];
m_Permutation is valid (it was set when the (image, region) constructor was
called), but m_Permutation->m_Permutation is NULL. It is valid when I create
the iterator with the first version (above). The default constructor just
sets everything to NULL, so I don't see any reason why calling the (image,
region) constructor after the default constructor wouldn't work.
Any thoughts?
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110226/894c57f3/attachment.htm>
More information about the Insight-developers
mailing list