ITK  5.3.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 {
50 template <typename TImage,
51  typename TAttributeAccessor =
52  typename Functor::AttributeLabelObjectAccessor<typename TImage::LabelObjectType>>
53 class ITK_TEMPLATE_EXPORT AttributeSelectionLabelMapFilter : public InPlaceLabelMapFilter<TImage>
54 {
55 public:
56  ITK_DISALLOW_COPY_AND_MOVE(AttributeSelectionLabelMapFilter);
57 
63 
65  using ImageType = TImage;
66  using ImagePointer = typename ImageType::Pointer;
67  using ImageConstPointer = typename ImageType::ConstPointer;
68  using PixelType = typename ImageType::PixelType;
69  using IndexType = typename ImageType::IndexType;
70  using LabelObjectType = typename ImageType::LabelObjectType;
71 
72  using AttributeAccessorType = TAttributeAccessor;
74 
75  using AttributeSetType = typename std::set<AttributeValueType>;
76 
78  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
79 
81  itkNewMacro(Self);
82 
85 
86 #ifdef ITK_USE_CONCEPT_CHECKING
87  // Begin concept checking
88  /* itkConceptMacro(InputEqualityComparableCheck,
89  (Concept::EqualityComparable<InputImagePixelType>));
90  itkConceptMacro(IntConvertibleToInputCheck,
91  (Concept::Convertible<int, InputImagePixelType>));
92  itkConceptMacro(InputOStreamWritableCheck,
93  (Concept::OStreamWritable<InputImagePixelType>));*/
94  // End concept checking
95 #endif
96 
100  const AttributeSetType &
102  {
103  return m_AttributeSet;
104  }
105  void
107  {
108  m_AttributeSet = set;
109  this->Modified();
110  }
112 
117  itkGetConstMacro(Exclude, bool);
118  itkSetMacro(Exclude, bool);
119  itkBooleanMacro(Exclude);
121 
123  void
125  {
126  this->ClearAttributeSet();
127  this->AddAttribute(attr);
128  }
130 
131  void
133  {
134  if (!m_AttributeSet.empty())
135  {
136  m_AttributeSet.clear();
137  this->Modified();
138  }
139  }
140 
141  void
143  {
144  const typename AttributeSetType::size_type size = m_AttributeSet.size();
145  m_AttributeSet.insert(attr);
146  if (size != m_AttributeSet.size())
147  {
148  this->Modified();
149  }
150  }
151 
152 protected:
154  ~AttributeSelectionLabelMapFilter() override = default;
155 
156  void
157  GenerateData() override;
158 
159  void
160  PrintSelf(std::ostream & os, Indent indent) const override;
161 
162 private:
164  bool m_Exclude;
165 
166 }; // end of class
167 
168 } // end namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 # include "itkAttributeSelectionLabelMapFilter.hxx"
172 #endif
173 
174 #endif
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::PixelType
typename ImageType::PixelType PixelType
Definition: itkAttributeSelectionLabelMapFilter.h:68
itk::AttributeSelectionLabelMapFilter
remove the objects according to the value of their attribute
Definition: itkAttributeSelectionLabelMapFilter.h:53
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkAttributeSelectionLabelMapFilter.h:67
itk::AttributeSelectionLabelMapFilter::m_AttributeSet
AttributeSetType m_AttributeSet
Definition: itkAttributeSelectionLabelMapFilter.h:163
itk::InPlaceLabelMapFilter
Base class for filters that takes an image as input and overwrites that image as the output.
Definition: itkInPlaceLabelMapFilter.h:83
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImageType
TImage ImageType
Definition: itkAttributeSelectionLabelMapFilter.h:65
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:124
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:73
itkAttributeLabelObject.h
itk::AttributeSelectionLabelMapFilter::AddAttribute
void AddAttribute(const AttributeValueType &attr)
Definition: itkAttributeSelectionLabelMapFilter.h:142
itk::AttributeSelectionLabelMapFilter::ClearAttributeSet
void ClearAttributeSet()
Definition: itkAttributeSelectionLabelMapFilter.h:132
itkInPlaceLabelMapFilter.h
itk::AttributeSelectionLabelMapFilter::m_Exclude
bool m_Exclude
Definition: itkAttributeSelectionLabelMapFilter.h:164
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::LabelObjectType
typename ImageType::LabelObjectType LabelObjectType
Definition: itkAttributeSelectionLabelMapFilter.h:70
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:75
itk::AttributeSelectionLabelMapFilter::GetAttributeSet
const AttributeSetType & GetAttributeSet() const
Definition: itkAttributeSelectionLabelMapFilter.h:101
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::IndexType
typename ImageType::IndexType IndexType
Definition: itkAttributeSelectionLabelMapFilter.h:69
itk::Functor::LabelLabelObjectAccessor
Definition: itkLabelObjectAccessors.h:37
itk::AttributeSelectionLabelMapFilter< TImage, Functor::LabelLabelObjectAccessor< TImage::LabelObjectType > >::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkAttributeSelectionLabelMapFilter.h:66
itk::AttributeSelectionLabelMapFilter::SetAttributeSet
void SetAttributeSet(const AttributeSetType &set)
Definition: itkAttributeSelectionLabelMapFilter.h:106
itk::Functor::LabelLabelObjectAccessor::AttributeValueType
typename LabelObjectType::LabelType AttributeValueType
Definition: itkLabelObjectAccessors.h:41