ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkBinaryStatisticsKeepNObjectsImageFilter.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 __itkBinaryStatisticsKeepNObjectsImageFilter_h
19 #define __itkBinaryStatisticsKeepNObjectsImageFilter_h
20 
25 
26 namespace itk
27 {
45 template< class TInputImage, class TFeatureImage >
47  public ImageToImageFilter< TInputImage, TInputImage >
48 {
49 public:
55 
57  typedef TInputImage InputImageType;
58  typedef TInputImage OutputImageType;
59  typedef typename InputImageType::Pointer InputImagePointer;
60  typedef typename InputImageType::ConstPointer InputImageConstPointer;
61  typedef typename InputImageType::RegionType InputImageRegionType;
62  typedef typename InputImageType::PixelType InputImagePixelType;
63  typedef typename OutputImageType::Pointer OutputImagePointer;
64  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
65  typedef typename OutputImageType::RegionType OutputImageRegionType;
66  typedef typename OutputImageType::PixelType OutputImagePixelType;
67 
68  typedef TFeatureImage FeatureImageType;
69  typedef typename FeatureImageType::Pointer FeatureImagePointer;
70  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
71  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
72 
74  itkStaticConstMacro(InputImageDimension, unsigned int,
75  TInputImage::ImageDimension);
76  itkStaticConstMacro(OutputImageDimension, unsigned int,
77  TInputImage::ImageDimension);
78  itkStaticConstMacro(ImageDimension, unsigned int,
79  TInputImage::ImageDimension);
81 
83 
91 
93  itkNewMacro(Self);
94 
98 
105  itkSetMacro(FullyConnected, bool);
106  itkGetConstReferenceMacro(FullyConnected, bool);
107  itkBooleanMacro(FullyConnected);
109 
110 #ifdef ITK_USE_CONCEPT_CHECKING
111 
112  itkConceptMacro( InputEqualityComparableCheck,
114  itkConceptMacro( IntConvertibleToInputCheck,
116  itkConceptMacro( InputOStreamWritableCheck,
118 
120 #endif
121 
126  itkSetMacro(BackgroundValue, OutputImagePixelType);
127  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
129 
134  itkSetMacro(ForegroundValue, OutputImagePixelType);
135  itkGetConstMacro(ForegroundValue, OutputImagePixelType);
137 
141  itkGetConstMacro(NumberOfObjects, SizeValueType);
142  itkSetMacro(NumberOfObjects, SizeValueType);
144 
150  itkGetConstMacro(ReverseOrdering, bool);
151  itkSetMacro(ReverseOrdering, bool);
152  itkBooleanMacro(ReverseOrdering);
154 
159  itkGetConstMacro(Attribute, AttributeType);
160  itkSetMacro(Attribute, AttributeType);
161  void SetAttribute(const std::string & s)
162  {
163  this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
164  }
166 
168  void SetFeatureImage(const TFeatureImage *input)
169  {
170  // Process object is not const-correct so the const casting is required.
171  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
172  }
173 
175  const FeatureImageType * GetFeatureImage()
176  {
177  return static_cast< const FeatureImageType * >( this->ProcessObject::GetInput(1) );
178  }
179 
181  void SetInput1(const InputImageType *input)
182  {
183  this->SetInput(input);
184  }
185 
187  void SetInput2(const FeatureImageType *input)
188  {
189  this->SetFeatureImage(input);
190  }
191 
192 protected:
195  void PrintSelf(std::ostream & os, Indent indent) const;
196 
200  void GenerateInputRequestedRegion();
201 
203  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
204 
207  void GenerateData();
208 
209 private:
210  BinaryStatisticsKeepNObjectsImageFilter(const Self &); //purposely not
211  // implemented
212  void operator=(const Self &); //purposely not
213  // implemented
214 
221 }; // end of class
222 } // end namespace itk
223 
224 #ifndef ITK_MANUAL_INSTANTIATION
225 #include "itkBinaryStatisticsKeepNObjectsImageFilter.hxx"
226 #endif
227 
228 #endif
229