ITK  6.0.0
Insight Toolkit
itkConditionalConstIterator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkConditionalConstIterator_h
19 #define itkConditionalConstIterator_h
20 
21 #include "itkIndex.h"
22 
23 namespace itk
24 {
37 template <typename TImage>
38 class ITK_TEMPLATE_EXPORT ConditionalConstIterator
39 {
40 public:
43 
48  static constexpr unsigned int NDimension = TImage::ImageDimension;
49 
51  using IndexType = typename TImage::IndexType;
52 
54  using SizeType = typename TImage::SizeType;
55 
57  using RegionType = typename TImage::RegionType;
58 
60  using ImageType = TImage;
61 
63  using InternalPixelType = typename TImage::InternalPixelType;
64 
66  using PixelType = typename TImage::PixelType;
67 
69  virtual bool
70  IsPixelIncluded(const IndexType & index) const = 0;
71 
74  Self &
75  operator=(const Self & it)
76  {
77  m_IsAtEnd = it.m_IsAtEnd; // copy the end flag
78  m_Image = it.m_Image; // copy the smart pointer
79  m_Region = it.m_Region; // copy the region
80  return *this;
81  }
82 
84  static unsigned int
86  {
87  return Self::NDimension;
88  }
89 
91  virtual const IndexType
92  GetIndex() = 0;
93 
95  virtual const PixelType
96  Get() const = 0;
97 
99  virtual bool
100  IsAtEnd() const = 0;
101 
103  virtual void
104  operator++() = 0;
105 
107  ConditionalConstIterator() = default;
108 
110  virtual ~ConditionalConstIterator() = default;
111 
112 protected: // made protected so other iterators can access
114  // SmartPointer<const ImageType> m_Image;
115  typename ImageType::ConstWeakPointer m_Image{};
116 
118  RegionType m_Region{};
119 
121  bool m_IsAtEnd{ false };
122 };
123 } // end namespace itk
124 
125 #endif
itk::ConditionalConstIterator::m_Region
RegionType m_Region
Definition: itkConditionalConstIterator.h:118
itk::ConditionalConstIterator::IndexType
typename TImage::IndexType IndexType
Definition: itkConditionalConstIterator.h:51
itk::ConditionalConstIterator::ImageType
TImage ImageType
Definition: itkConditionalConstIterator.h:60
itk::ConditionalConstIterator::InternalPixelType
typename TImage::InternalPixelType InternalPixelType
Definition: itkConditionalConstIterator.h:63
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::ConditionalConstIterator::m_IsAtEnd
bool m_IsAtEnd
Definition: itkConditionalConstIterator.h:121
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ConditionalConstIterator::m_Image
ImageType::ConstWeakPointer m_Image
Definition: itkConditionalConstIterator.h:115
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ConditionalConstIterator::RegionType
typename TImage::RegionType RegionType
Definition: itkConditionalConstIterator.h:57
itkIndex.h
itk::ConditionalConstIterator::SizeType
typename TImage::SizeType SizeType
Definition: itkConditionalConstIterator.h:54
itk::ConditionalConstIterator::operator=
Self & operator=(const Self &it)
Definition: itkConditionalConstIterator.h:75
itk::ConditionalConstIterator
A base class for other iterators where membership in the set of output pixels is conditional upon som...
Definition: itkConditionalConstIterator.h:38
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ConditionalConstIterator::GetIteratorDimension
static unsigned int GetIteratorDimension()
Definition: itkConditionalConstIterator.h:85
itk::ConditionalConstIterator::PixelType
typename TImage::PixelType PixelType
Definition: itkConditionalConstIterator.h:66