ITK  5.2.0
Insight Toolkit
itkAttributeSelectionLabelMapFilter.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  * http://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 itkAttributeSelectionLabelMapFilter_h
19 #define itkAttributeSelectionLabelMapFilter_h
20 
23 #include <set>
24 
25 
26 namespace itk
27 {
51 template <typename TImage,
52  typename TAttributeAccessor =
53  typename Functor::AttributeLabelObjectAccessor<typename TImage::LabelObjectType>>
54 class ITK_TEMPLATE_EXPORT AttributeSelectionLabelMapFilter : public InPlaceLabelMapFilter<TImage>
55 {
56 public:
57  ITK_DISALLOW_COPY_AND_MOVE(AttributeSelectionLabelMapFilter);
58 
64 
66  using ImageType = TImage;
67  using ImagePointer = typename ImageType::Pointer;
68  using ImageConstPointer = typename ImageType::ConstPointer;
69  using PixelType = typename ImageType::PixelType;
70  using IndexType = typename ImageType::IndexType;
71  using LabelObjectType = typename ImageType::LabelObjectType;
72 
73  using AttributeAccessorType = TAttributeAccessor;
75 
76  using AttributeSetType = typename std::set<AttributeValueType>;
77 
79  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
80 
82  itkNewMacro(Self);
83 
86 
87 #ifdef ITK_USE_CONCEPT_CHECKING
88  // Begin concept checking
89  /* itkConceptMacro(InputEqualityComparableCheck,
90  (Concept::EqualityComparable<InputImagePixelType>));
91  itkConceptMacro(IntConvertibleToInputCheck,
92  (Concept::Convertible<int, InputImagePixelType>));
93  itkConceptMacro(InputOStreamWritableCheck,
94  (Concept::OStreamWritable<InputImagePixelType>));*/
95  // End concept checking
96 #endif
97 
101  const AttributeSetType &
103  {
104  return m_AttributeSet;
105  }
106  void
108  {
109  m_AttributeSet = set;
110  this->Modified();
111  }
113 
118  itkGetConstMacro(Exclude, bool);
119  itkSetMacro(Exclude, bool);
120  itkBooleanMacro(Exclude);
122 
124  void
126  {
127  this->ClearAttributeSet();
128  this->AddAttribute(attr);
129  }
131 
132  void
134  {
135  if (!m_AttributeSet.empty())
136  {
137  m_AttributeSet.clear();
138  this->Modified();
139  }
140  }
141 
142  void
144  {
145  const typename AttributeSetType::size_type size = m_AttributeSet.size();
146  m_AttributeSet.insert(attr);
147  if (size != m_AttributeSet.size())
148  {
149  this->Modified();
150  }
151  }
152 
153 protected:
155  ~AttributeSelectionLabelMapFilter() override = default;
156 
157  void
158  GenerateData() override;
159 
160  void
161  PrintSelf(std::ostream & os, Indent indent) const override;
162 
163 private:
165  bool m_Exclude;
166 
167 }; // end of class
168 
169 } // end namespace itk
170 
171 #ifndef ITK_MANUAL_INSTANTIATION
172 # include "itkAttributeSelectionLabelMapFilter.hxx"
173 #endif
174 
175 #endif
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::PixelType
typename ImageType::PixelType PixelType
Definition: itkAttributeSelectionLabelMapFilter.h:69
itk::AttributeSelectionLabelMapFilter
remove the objects according to the value of their attribute
Definition: itkAttributeSelectionLabelMapFilter.h:54
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkAttributeSelectionLabelMapFilter.h:68
itk::AttributeSelectionLabelMapFilter::m_AttributeSet
AttributeSetType m_AttributeSet
Definition: itkAttributeSelectionLabelMapFilter.h:164
itk::InPlaceLabelMapFilter
Base class for filters that takes an image as input and overwrites that image as the output.
Definition: itkInPlaceLabelMapFilter.h:84
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImageType
TImage ImageType
Definition: itkAttributeSelectionLabelMapFilter.h:66
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::AttributeSelectionLabelMapFilter::SetAttribute
void SetAttribute(const AttributeValueType &attr)
Definition: itkAttributeSelectionLabelMapFilter.h:125
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::AttributeValueType
typename AttributeAccessorType::AttributeValueType AttributeValueType
Definition: itkAttributeSelectionLabelMapFilter.h:74
itkAttributeLabelObject.h
itk::AttributeSelectionLabelMapFilter::AddAttribute
void AddAttribute(const AttributeValueType &attr)
Definition: itkAttributeSelectionLabelMapFilter.h:143
itk::AttributeSelectionLabelMapFilter::ClearAttributeSet
void ClearAttributeSet()
Definition: itkAttributeSelectionLabelMapFilter.h:133
itkInPlaceLabelMapFilter.h
itk::AttributeSelectionLabelMapFilter::m_Exclude
bool m_Exclude
Definition: itkAttributeSelectionLabelMapFilter.h:165
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::LabelObjectType
typename ImageType::LabelObjectType LabelObjectType
Definition: itkAttributeSelectionLabelMapFilter.h:71
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::AttributeSetType
typename std::set< AttributeValueType > AttributeSetType
Definition: itkAttributeSelectionLabelMapFilter.h:76
itk::AttributeSelectionLabelMapFilter::GetAttributeSet
const AttributeSetType & GetAttributeSet() const
Definition: itkAttributeSelectionLabelMapFilter.h:102
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::IndexType
typename ImageType::IndexType IndexType
Definition: itkAttributeSelectionLabelMapFilter.h:70
itk::Functor::LabelLabelObjectAccessor
Definition: itkLabelObjectAccessors.h:38
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkAttributeSelectionLabelMapFilter.h:67
itk::AttributeSelectionLabelMapFilter::SetAttributeSet
void SetAttributeSet(const AttributeSetType &set)
Definition: itkAttributeSelectionLabelMapFilter.h:107
itk::Functor::LabelLabelObjectAccessor::AttributeValueType
typename LabelObjectType::LabelType AttributeValueType
Definition: itkLabelObjectAccessors.h:42