18 #ifndef itkSubsample_h
19 #define itkSubsample_h
40 template<
typename TSample >
78 #if defined(__clang__) && defined(__has_warning)
79 # if __has_warning("-Winconsistent-missing-override")
80 # pragma clang diagnostic push
81 # pragma clang diagnostic ignored "-Winconsistent-missing-override"
88 return this->m_IdHolder;
91 #if defined(__clang__) && defined(__has_warning)
92 # if __has_warning("-Winconsistent-missing-override")
93 # pragma clang diagnostic pop
98 void SetSample(
const TSample *sample);
100 const TSample * GetSample()
const;
103 void InitializeWithAllInstances();
106 void AddInstance(InstanceIdentifier
id);
110 InstanceIdentifier
Size() const ITK_OVERRIDE;
117 const MeasurementVectorType & GetMeasurementVector(InstanceIdentifier
id) const ITK_OVERRIDE;
120 AbsoluteFrequencyType GetFrequency(InstanceIdentifier
id) const ITK_OVERRIDE;
123 TotalAbsoluteFrequencyType GetTotalFrequency() const ITK_OVERRIDE;
125 void Swap(
unsigned int index1,
unsigned int index2);
127 InstanceIdentifier GetInstanceIdentifier(
unsigned int index);
129 const MeasurementVectorType & GetMeasurementVectorByIndex(
unsigned int index) const;
131 AbsoluteFrequencyType GetFrequencyByIndex(
unsigned int index) const;
134 virtual
void Graft(const
DataObject *thatObject) ITK_OVERRIDE;
144 *
this = sample->
Begin();
164 return ( m_Iter != it.
m_Iter );
169 return ( m_Iter == it.
m_Iter );
180 return m_Sample->GetFrequency(*m_Iter);
185 return m_Sample->GetMeasurementVector(*m_Iter);
190 return ( m_Iter - m_Subsample->GetIdHolder().begin() );
199 const Self *classSample):
200 m_Iter(iter), m_Subsample(classSample), m_Sample( classSample->GetSample() )
204 typename InstanceIdentifierHolder::const_iterator
m_Iter;
227 this->ConstIterator::operator=(iter);
236 Iterator(
typename InstanceIdentifierHolder::const_iterator iter,
237 const Self *classSample);
242 Iterator(
typename InstanceIdentifierHolder::iterator iter,
254 Iterator iter(m_IdHolder.begin(),
this);
263 Iterator iter(m_IdHolder.end(),
this);
285 void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
298 #ifndef ITK_MANUAL_INSTANTIATION
299 #include "itkSubsample.hxx"
virtual ~Subsample() override
ConstIterator(typename InstanceIdentifierHolder::const_iterator iter, const Self *classSample)
const MeasurementVectorType & GetMeasurementVector() const
Iterator(const Iterator &iter)
Represent the size (bounds) of a n-dimensional image.
TSample::MeasurementType MeasurementType
bool operator==(const ConstIterator &it)
bool operator!=(const ConstIterator &it)
SmartPointer< const Self > ConstPointer
This class stores a subset of instance identifiers from another sample object. You can create a subsa...
TSample::InstanceIdentifier InstanceIdentifier
TSample::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType
unsigned int m_ActiveDimension
ConstIterator & operator++()
Iterator & operator=(const Iterator &iter)
InstanceIdentifierHolder m_IdHolder
InstanceIdentifier GetInstanceIdentifier() const
TSample::Pointer SamplePointer
InstanceIdentifierHolder::const_iterator m_Iter
TSample::AbsoluteFrequencyType AbsoluteFrequencyType
ConstIterator(const Self *sample)
SmartPointer< Self > Pointer
MeasurementVectorType ValueType
ConstIterator(const ConstIterator &iter)
TotalAbsoluteFrequencyType m_TotalFrequency
TSample::MeasurementVectorType MeasurementVectorType
AbsoluteFrequencyType GetFrequency() const
ConstIterator & operator=(const ConstIterator &iter)
ConstIterator End() const
virtual const InstanceIdentifierHolder & GetIdHolder() const
Control indentation during Print() invocation.
Iterator(typename InstanceIdentifierHolder::iterator iter, Self *classSample)
ConstIterator Begin() const
Base class for all data objects in ITK.
std::vector< InstanceIdentifier > InstanceIdentifierHolder