ITK  4.2.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<class TImage, class 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 
85 /* itkConceptMacro(InputEqualityComparableCheck,
86  (Concept::EqualityComparable<InputImagePixelType>));
87  itkConceptMacro(IntConvertibleToInputCheck,
88  (Concept::Convertible<int, InputImagePixelType>));
89  itkConceptMacro(InputOStreamWritableCheck,
90  (Concept::OStreamWritable<InputImagePixelType>));*/
91 
93 #endif
94 
98  const AttributeSetType & GetAttributeSet() const
99  {
100  return m_AttributeSet;
101  }
102  void SetAttributeSet( const AttributeSetType & set )
103  {
104  m_AttributeSet = set;
105  this->Modified();
106  }
108 
113  itkGetConstMacro( Exclude, bool );
114  itkSetMacro( Exclude, bool );
115  itkBooleanMacro( Exclude );
117 
119  void SetAttribute( const AttributeValueType & attr )
120  {
121  this->ClearAttributeSet();
122  this->AddAttribute( attr );
123  }
125 
126  void ClearAttributeSet()
127  {
128  if( ! m_AttributeSet.empty() )
129  {
130  m_AttributeSet.clear();
131  this->Modified();
132  }
133  }
134 
135  void AddAttribute( const AttributeValueType & attr )
136  {
137  const typename AttributeSetType::size_type size = m_AttributeSet.size();
138  m_AttributeSet.insert( attr );
139  if( size != m_AttributeSet.size() )
140  {
141  this->Modified();
142  }
143  }
144 
145 protected:
148 
149  void GenerateData();
150 
151  void PrintSelf(std::ostream& os, Indent indent) const;
152 
153 private:
154  AttributeSelectionLabelMapFilter(const Self&); //purposely not implemented
155  void operator=(const Self&); //purposely not implemented
156 
158  bool m_Exclude;
159 
160 }; // end of class
161 
162 } // end namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 #include "itkAttributeSelectionLabelMapFilter.hxx"
166 #endif
167 
168 #endif
169