18 #ifndef itkSubsample_h
19 #define itkSubsample_h
40 template<
typename TSample >
80 #if defined(__clang__) && defined(__has_warning)
81 # if __has_warning("-Winconsistent-missing-override")
82 # pragma clang diagnostic push
83 # pragma clang diagnostic ignored "-Winconsistent-missing-override"
90 return this->m_IdHolder;
93 #if defined(__clang__) && defined(__has_warning)
94 # if __has_warning("-Winconsistent-missing-override")
95 # pragma clang diagnostic pop
100 void SetSample(
const TSample *sample);
102 const TSample * GetSample()
const;
105 void InitializeWithAllInstances();
108 void AddInstance(InstanceIdentifier
id);
112 InstanceIdentifier
Size()
const override;
119 const MeasurementVectorType & GetMeasurementVector(InstanceIdentifier
id)
const override;
122 AbsoluteFrequencyType GetFrequency(InstanceIdentifier
id)
const override;
125 TotalAbsoluteFrequencyType GetTotalFrequency()
const override;
127 void Swap(
unsigned int index1,
unsigned int index2);
129 InstanceIdentifier GetInstanceIdentifier(
unsigned int index);
131 const MeasurementVectorType & GetMeasurementVectorByIndex(
unsigned int index)
const;
133 AbsoluteFrequencyType GetFrequencyByIndex(
unsigned int index)
const;
136 void Graft(
const DataObject *thatObject)
override;
146 *
this = sample->
Begin();
166 return ( m_Iter != it.
m_Iter );
171 return ( m_Iter == it.
m_Iter );
182 return m_Sample->GetFrequency(*m_Iter);
187 return m_Sample->GetMeasurementVector(*m_Iter);
192 return ( m_Iter - m_Subsample->GetIdHolder().begin() );
201 const Self *classSample):
202 m_Iter(iter), m_Subsample(classSample), m_Sample( classSample->GetSample() )
206 typename InstanceIdentifierHolder::const_iterator
m_Iter;
229 this->ConstIterator::operator=(iter);
238 Iterator(
typename InstanceIdentifierHolder::const_iterator iter,
239 const Self *classSample);
244 Iterator(
typename InstanceIdentifierHolder::iterator iter,
256 Iterator iter(m_IdHolder.begin(),
this);
265 Iterator iter(m_IdHolder.end(),
this);
287 void PrintSelf(std::ostream & os,
Indent indent)
const override;
298 #ifndef ITK_MANUAL_INSTANTIATION
299 #include "itkSubsample.hxx"
ConstIterator(typename InstanceIdentifierHolder::const_iterator iter, const Self *classSample)
const MeasurementVectorType & GetMeasurementVector() const
std::vector< InstanceIdentifier > InstanceIdentifierHolder
Iterator(const Iterator &iter)
bool operator==(const ConstIterator &it)
bool operator!=(const ConstIterator &it)
typename TSample::InstanceIdentifier InstanceIdentifier
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
const InstanceIdentifierHolder & GetIdHolder() const
typename TSample::Pointer SamplePointer
unsigned int m_ActiveDimension
ConstIterator & operator++()
Iterator & operator=(const Iterator &iter)
InstanceIdentifierHolder m_IdHolder
InstanceIdentifier GetInstanceIdentifier() const
InstanceIdentifierHolder::const_iterator m_Iter
Represent a n-dimensional size (bounds) of a n-dimensional image.
ConstIterator(const Self *sample)
typename TSample::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType
typename TSample::MeasurementType MeasurementType
ConstIterator(const ConstIterator &iter)
TotalAbsoluteFrequencyType m_TotalFrequency
AbsoluteFrequencyType GetFrequency() const
MeasurementVectorType ValueType
typename TSample::MeasurementVectorType MeasurementVectorType
ConstIterator & operator=(const ConstIterator &iter)
ConstIterator End() const
Control indentation during Print() invocation.
Iterator(typename InstanceIdentifierHolder::iterator iter, Self *classSample)
typename TSample::AbsoluteFrequencyType AbsoluteFrequencyType
ConstIterator Begin() const
Base class for all data objects in ITK.