ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkLabelShapeKeepNObjectsImageFilter.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 itkLabelShapeKeepNObjectsImageFilter_h
19 #define itkLabelShapeKeepNObjectsImageFilter_h
20 
21 #include "itkShapeLabelObject.h"
23 #include "itkShapeLabelMapFilter.h"
26 
27 namespace itk
28 {
50 template< typename TInputImage >
52  public ImageToImageFilter< TInputImage, TInputImage >
53 {
54 public:
60 
62  typedef TInputImage InputImageType;
63  typedef TInputImage OutputImageType;
64  typedef typename InputImageType::Pointer InputImagePointer;
65  typedef typename InputImageType::ConstPointer InputImageConstPointer;
66  typedef typename InputImageType::RegionType InputImageRegionType;
67  typedef typename InputImageType::PixelType InputImagePixelType;
68  typedef typename OutputImageType::Pointer OutputImagePointer;
69  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
70  typedef typename OutputImageType::RegionType OutputImageRegionType;
71  typedef typename OutputImageType::PixelType OutputImagePixelType;
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 
85  typedef Image< typename OutputImageType::PixelType,
86  itkGetStaticConstMacro(OutputImageDimension) > ShapeLabelFilterOutput;
92 
94  itkNewMacro(Self);
95 
99 
100 #ifdef ITK_USE_CONCEPT_CHECKING
101  // Begin concept checking
102  itkConceptMacro( InputEqualityComparableCheck,
104  itkConceptMacro( IntConvertibleToInputCheck,
106  itkConceptMacro( InputOStreamWritableCheck,
108  // End concept checking
109 #endif
110 
115  itkSetMacro(BackgroundValue, OutputImagePixelType);
116  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
118 
122  itkGetConstMacro(NumberOfObjects, SizeValueType);
123  itkSetMacro(NumberOfObjects, SizeValueType);
125 
131  itkGetConstMacro(ReverseOrdering, bool);
132  itkSetMacro(ReverseOrdering, bool);
133  itkBooleanMacro(ReverseOrdering);
135 
140  itkGetConstMacro(Attribute, AttributeType);
141  itkSetMacro(Attribute, AttributeType);
142  void SetAttribute(const std::string & s)
143  {
145  }
147 
148 protected:
151  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
152 
156  void GenerateInputRequestedRegion() ITK_OVERRIDE;
157 
159  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
160 
163  void GenerateData() ITK_OVERRIDE;
164 
165 private:
166  LabelShapeKeepNObjectsImageFilter(const Self &) ITK_DELETE_FUNCTION;
167  void operator=(const Self &) ITK_DELETE_FUNCTION;
168 
173 }; // end of class
174 } // end namespace itk
175 
176 #ifndef ITK_MANUAL_INSTANTIATION
177 #include "itkLabelShapeKeepNObjectsImageFilter.hxx"
178 #endif
179 
180 #endif
LabelImageToLabelMapFilter< InputImageType, LabelMapType > LabelizerType
convert a labeled image to a label collection image
Light weight base class for most itk classes.
ShapeLabelObject< InputImagePixelType, itkGetStaticConstMacro(ImageDimension) > LabelObjectType
virtual void SetAttribute(AttributeType _arg)
unsigned long SizeValueType
Definition: itkIntTypes.h:143
void EnlargeOutputRequestedRegion(DataObject *) override
ImageToImageFilter< TInputImage, TInputImage > Superclass
ShapeKeepNObjectsLabelMapFilter< LabelMapType > KeepNObjectsType
Superclass::AttributeType AttributeType
void PrintSelf(std::ostream &os, Indent indent) const override
static AttributeType GetAttributeFromName(const std::string &s)
A Label object to store the common attributes related to the shape of the object. ...
Keep N objects according to their shape attributes.
keep N objects according to their shape attributes
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
#define itkConceptMacro(name, concept)
The valuator class for the ShapeLabelObject.
LabelMapToLabelImageFilter< LabelMapType, OutputImageType > BinarizerType
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
ShapeLabelMapFilter< LabelMapType, ShapeLabelFilterOutput > LabelObjectValuatorType
Converts a LabelMap to a labeled image.
Image< typename OutputImageType::PixelType, itkGetStaticConstMacro(OutputImageDimension) > ShapeLabelFilterOutput