ITK  6.0.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 * 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 itkAttributeSelectionLabelMapFilter_h
19#define itkAttributeSelectionLabelMapFilter_h
20
23#include <set>
24
25
26namespace itk
27{
50template <typename TImage,
51 typename TAttributeAccessor =
52 typename Functor::AttributeLabelObjectAccessor<typename TImage::LabelObjectType>>
53class ITK_TEMPLATE_EXPORT AttributeSelectionLabelMapFilter : public InPlaceLabelMapFilter<TImage>
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(AttributeSelectionLabelMapFilter);
57
63
65 using ImageType = TImage;
68 using PixelType = typename ImageType::PixelType;
70 using LabelObjectType = typename ImageType::LabelObjectType;
71
72 using AttributeAccessorType = TAttributeAccessor;
73 using AttributeValueType = typename AttributeAccessorType::AttributeValueType;
74
75 using AttributeSetType = typename std::set<AttributeValueType>;
76
78 static constexpr unsigned int ImageDimension = TImage::ImageDimension;
79
81 itkNewMacro(Self);
82
84 itkOverrideGetNameOfClassMacro(AttributeSelectionLabelMapFilter);
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 }
117 itkGetConstMacro(Exclude, bool);
118 itkSetMacro(Exclude, bool);
119 itkBooleanMacro(Exclude);
123 void
125 {
126 this->ClearAttributeSet();
127 this->AddAttribute(attr);
128 }
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
152protected:
155
156 void
157 GenerateData() override;
158
159 void
160 PrintSelf(std::ostream & os, Indent indent) const override;
161
162private:
163 AttributeSetType m_AttributeSet{};
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
Remove the objects according to the value of their attribute.
void PrintSelf(std::ostream &os, Indent indent) const override
typename std::set< AttributeValueType > AttributeSetType
typename ImageType::LabelObjectType LabelObjectType
typename AttributeAccessorType::AttributeValueType AttributeValueType
~AttributeSelectionLabelMapFilter() override=default
Base class for filters that takes an image as input and overwrites that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....