ITK  4.8.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< typename TInputImage, typename 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  // Begin concept checking
112  itkConceptMacro( InputEqualityComparableCheck,
114  itkConceptMacro( IntConvertibleToInputCheck,
116  itkConceptMacro( InputOStreamWritableCheck,
118  // End concept checking
119 #endif
120 
125  itkSetMacro(BackgroundValue, OutputImagePixelType);
126  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
128 
133  itkSetMacro(ForegroundValue, OutputImagePixelType);
134  itkGetConstMacro(ForegroundValue, OutputImagePixelType);
136 
140  itkGetConstMacro(NumberOfObjects, SizeValueType);
141  itkSetMacro(NumberOfObjects, SizeValueType);
143 
149  itkGetConstMacro(ReverseOrdering, bool);
150  itkSetMacro(ReverseOrdering, bool);
151  itkBooleanMacro(ReverseOrdering);
153 
158  itkGetConstMacro(Attribute, AttributeType);
159  itkSetMacro(Attribute, AttributeType);
160  void SetAttribute(const std::string & s)
161  {
163  }
165 
167  void SetFeatureImage(const TFeatureImage *input)
168  {
169  // Process object is not const-correct so the const casting is required.
170  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
171  }
172 
175  {
176  return static_cast< const FeatureImageType * >( this->ProcessObject::GetInput(1) );
177  }
178 
180  void SetInput1(const InputImageType *input)
181  {
182  this->SetInput(input);
183  }
184 
186  void SetInput2(const FeatureImageType *input)
187  {
188  this->SetFeatureImage(input);
189  }
190 
191 protected:
194  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
195 
199  void GenerateInputRequestedRegion() ITK_OVERRIDE;
200 
202  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
203 
206  void GenerateData() ITK_OVERRIDE;
207 
208 private:
209  BinaryStatisticsKeepNObjectsImageFilter(const Self &); //purposely not
210  // implemented
211  void operator=(const Self &); //purposely not
212  // implemented
213 
220 }; // end of class
221 } // end namespace itk
222 
223 #ifndef ITK_MANUAL_INSTANTIATION
224 #include "itkBinaryStatisticsKeepNObjectsImageFilter.hxx"
225 #endif
226 
227 #endif
StatisticsLabelMapFilter< LabelMapType, TFeatureImage > LabelObjectValuatorType
virtual void SetAttribute(AttributeType _arg)
Light weight base class for most itk classes.
void PrintSelf(std::ostream &os, Indent indent) const override
Superclass::AttributeType AttributeType
StatisticsKeepNObjectsLabelMapFilter< LabelMapType > KeepNObjectsType
StatisticsLabelObject< LabelType, itkGetStaticConstMacro(ImageDimension) > LabelObjectType
BinaryImageToLabelMapFilter< InputImageType, LabelMapType > LabelizerType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
ImageToImageFilter< TInputImage, TInputImage > Superclass
static AttributeType GetAttributeFromName(const std::string &s)
A Label object to store the common attributes related to the statistics of the object.
virtual void SetInput(const InputImageType *image)
void EnlargeOutputRequestedRegion(DataObject *) override
keep N objects according to their statistics attributes
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
keep N objects according to their statistics attributes
Label the connected components in a binary image and produce a collection of label objects...
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
LabelMapToBinaryImageFilter< LabelMapType, OutputImageType > BinarizerType
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
The valuator class for the ShapeLabelObject.
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
Convert a LabelMap to a binary image.