ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkBinaryShapeKeepNObjectsImageFilter.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 __itkBinaryShapeKeepNObjectsImageFilter_h
19 #define __itkBinaryShapeKeepNObjectsImageFilter_h
20 
21 #include "itkShapeLabelObject.h"
23 #include "itkShapeLabelMapFilter.h"
26 
27 namespace itk
28 {
46 template< class TInputImage >
48  public ImageToImageFilter< TInputImage, TInputImage >
49 {
50 public:
56 
58  typedef TInputImage InputImageType;
59  typedef TInputImage OutputImageType;
60  typedef typename InputImageType::Pointer InputImagePointer;
61  typedef typename InputImageType::ConstPointer InputImageConstPointer;
62  typedef typename InputImageType::RegionType InputImageRegionType;
63  typedef typename InputImageType::PixelType InputImagePixelType;
64  typedef typename OutputImageType::Pointer OutputImagePointer;
65  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
66  typedef typename OutputImageType::RegionType OutputImageRegionType;
67  typedef typename OutputImageType::PixelType OutputImagePixelType;
68 
70  itkStaticConstMacro(InputImageDimension, unsigned int,
71  TInputImage::ImageDimension);
72  itkStaticConstMacro(OutputImageDimension, unsigned int,
73  TInputImage::ImageDimension);
74  itkStaticConstMacro(ImageDimension, unsigned int,
75  TInputImage::ImageDimension);
77 
79 
89 
91  itkNewMacro(Self);
92 
96 
103  itkSetMacro(FullyConnected, bool);
104  itkGetConstReferenceMacro(FullyConnected, bool);
105  itkBooleanMacro(FullyConnected);
107 
108 #ifdef ITK_USE_CONCEPT_CHECKING
109 
110  itkConceptMacro( InputEqualityComparableCheck,
112  itkConceptMacro( IntConvertibleToInputCheck,
114  itkConceptMacro( InputOStreamWritableCheck,
116 
118 #endif
119 
124  itkSetMacro(BackgroundValue, OutputImagePixelType);
125  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
127 
132  itkSetMacro(ForegroundValue, OutputImagePixelType);
133  itkGetConstMacro(ForegroundValue, OutputImagePixelType);
135 
139  itkGetConstMacro(NumberOfObjects, SizeValueType);
140  itkSetMacro(NumberOfObjects, SizeValueType);
142 
148  itkGetConstMacro(ReverseOrdering, bool);
149  itkSetMacro(ReverseOrdering, bool);
150  itkBooleanMacro(ReverseOrdering);
152 
157  itkGetConstMacro(Attribute, AttributeType);
158  itkSetMacro(Attribute, AttributeType);
159  void SetAttribute(const std::string & s)
160  {
161  this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
162  }
164 
165 protected:
168  void PrintSelf(std::ostream & os, Indent indent) const;
169 
173  void GenerateInputRequestedRegion();
174 
176  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
177 
180  void GenerateData();
181 
182 private:
183  BinaryShapeKeepNObjectsImageFilter(const Self &); //purposely not implemented
184  void operator=(const Self &); //purposely not implemented
185 
192 }; // end of class
193 } // end namespace itk
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 #include "itkBinaryShapeKeepNObjectsImageFilter.hxx"
197 #endif
198 
199 #endif
200