ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkAttributeSelectionLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
47 template<typename TImage, typename TAttributeAccessor=
48  typename Functor::AttributeLabelObjectAccessor< typename TImage::LabelObjectType > >
50  public InPlaceLabelMapFilter<TImage>
51 {
52 public:
58 
60  typedef TImage ImageType;
61  typedef typename ImageType::Pointer ImagePointer;
62  typedef typename ImageType::ConstPointer ImageConstPointer;
63  typedef typename ImageType::PixelType PixelType;
64  typedef typename ImageType::IndexType IndexType;
65  typedef typename ImageType::LabelObjectType LabelObjectType;
66 
67  typedef TAttributeAccessor AttributeAccessorType;
69 
70  typedef typename std::set<AttributeValueType> AttributeSetType;
71 
73  itkStaticConstMacro(ImageDimension, unsigned int,
74  TImage::ImageDimension);
75 
77  itkNewMacro(Self);
78 
82 
83 #ifdef ITK_USE_CONCEPT_CHECKING
84  // Begin concept checking
85 /* itkConceptMacro(InputEqualityComparableCheck,
86  (Concept::EqualityComparable<InputImagePixelType>));
87  itkConceptMacro(IntConvertibleToInputCheck,
88  (Concept::Convertible<int, InputImagePixelType>));
89  itkConceptMacro(InputOStreamWritableCheck,
90  (Concept::OStreamWritable<InputImagePixelType>));*/
91  // End concept checking
92 #endif
93 
98  {
99  return m_AttributeSet;
100  }
101  void SetAttributeSet( const AttributeSetType & set )
102  {
103  m_AttributeSet = set;
104  this->Modified();
105  }
107 
112  itkGetConstMacro( Exclude, bool );
113  itkSetMacro( Exclude, bool );
114  itkBooleanMacro( Exclude );
116 
118  void SetAttribute( const AttributeValueType & attr )
119  {
120  this->ClearAttributeSet();
121  this->AddAttribute( attr );
122  }
124 
126  {
127  if( ! m_AttributeSet.empty() )
128  {
129  m_AttributeSet.clear();
130  this->Modified();
131  }
132  }
133 
134  void AddAttribute( const AttributeValueType & attr )
135  {
136  const typename AttributeSetType::size_type size = m_AttributeSet.size();
137  m_AttributeSet.insert( attr );
138  if( size != m_AttributeSet.size() )
139  {
140  this->Modified();
141  }
142  }
143 
144 protected:
147 
148  void GenerateData() ITK_OVERRIDE;
149 
150  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
151 
152 private:
153  AttributeSelectionLabelMapFilter(const Self&); //purposely not implemented
154  void operator=(const Self&); //purposely not implemented
155 
157  bool m_Exclude;
158 
159 }; // end of class
160 
161 } // end namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include "itkAttributeSelectionLabelMapFilter.hxx"
165 #endif
166 
167 #endif
Light weight base class for most itk classes.
void PrintSelf(std::ostream &os, Indent indent) const override
Base class for filters that takes an image as input and overwrites that image as the output...
virtual void Modified() const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
AttributeAccessorType::AttributeValueType AttributeValueType
remove the objects according to the value of their attribute