18 #ifndef itkImageRandomNonRepeatingConstIteratorWithIndex_h
19 #define itkImageRandomNonRepeatingConstIteratorWithIndex_h
100 std::ostringstream ostrm;
101 ostrm <<
"Error: RandomPermuation does not have " << i <<
" elements" << std::endl;
102 throw std::runtime_error(ostrm.str());
214 template<
typename TImage >
241 delete m_Permutation;
259 m_Permutation =
nullptr;
263 Self & operator=(
const Self & it);
268 m_NumberOfSamplesDone = 0L;
269 this->UpdatePosition();
276 m_NumberOfSamplesDone = m_NumberOfSamplesRequested;
277 this->UpdatePosition();
284 return ( m_NumberOfSamplesDone == 0L );
290 return ( m_NumberOfSamplesDone >= m_NumberOfSamplesRequested );
294 static constexpr
unsigned int ImageDimension = TImage::ImageDimension;
310 m_NumberOfSamplesDone++;
311 this->UpdatePosition();
320 m_NumberOfSamplesDone--;
321 this->UpdatePosition();
332 void ReinitializeSeed();
336 void ReinitializeSeed(
int);
339 void UpdatePosition();
348 #ifndef ITK_MANUAL_INSTANTIATION
349 #include "itkImageRandomNonRepeatingConstIteratorWithIndex.hxx"
typename TImage::SizeType SizeType
typename SizeType::SizeValueType SizeValueType
typename IndexType::IndexValueType IndexValueType
void SetPriority(SizeValueType i, SizeValueType priority)
NodeOfPermutation * m_Permutation
A multi-dimensional image iterator that visits a random set of pixels within an image region...
ImageRandomNonRepeatingConstIteratorWithIndex(const ImageConstIteratorWithIndex< TImage > &it)
unsigned long SizeValueType
typename PixelContainer::Pointer PixelContainerPointer
RandomPermutation(SizeValueType sz)
RandomPermutation * m_Permutation
SmartPointer< Self > Pointer
A node to be used when computing permutations.
typename TImage::InternalPixelType InternalPixelType
typename OffsetType::OffsetValueType OffsetValueType
typename TImage::PixelType PixelType
static Pointer New()
Method for creation through the object factory.
bool operator<(const NodeOfPermutation &b) const
A base class for multi-dimensional iterators templated over image type that are designed to efficient...
ImageBaseType::SizeType SizeType
ImageBaseType::IndexType IndexType
signed long IndexValueType
typename TImage::IndexType IndexType
typename TImage::RegionType RegionType
typename TImage::AccessorType AccessorType
SizeValueType operator[](SizeValueType i)
Produce a random permutation of a collection.
RandomPermutation & operator=(const RandomPermutation &it)
SizeValueType m_NumberOfSamplesRequested
GeneratorPointer m_Generator
void ReinitializeSeed(unsigned int seed)
typename TImage::PixelContainer PixelContainer
~ImageRandomNonRepeatingConstIteratorWithIndex() override
ImageBaseType::RegionType RegionType
Self & operator=(const Self &it)
typename TImage::OffsetType OffsetType
signed long OffsetValueType
SizeValueType m_NumberOfPixelsInRegion
SizeValueType m_NumberOfSamplesDone
Templated n-dimensional image class.
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer GeneratorPointer