ITK  5.3.0
Insight Toolkit
itkLabelShapeKeepNObjectsImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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>
51 class ITK_TEMPLATE_EXPORT LabelShapeKeepNObjectsImageFilter : public ImageToImageFilter<TInputImage, TInputImage>
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_MOVE(LabelShapeKeepNObjectsImageFilter);
55 
61 
63  using InputImageType = TInputImage;
64  using OutputImageType = TInputImage;
65  using InputImagePointer = typename InputImageType::Pointer;
66  using InputImageConstPointer = typename InputImageType::ConstPointer;
68  using InputImagePixelType = typename InputImageType::PixelType;
69  using OutputImagePointer = typename OutputImageType::Pointer;
70  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
72  using OutputImagePixelType = typename OutputImageType::PixelType;
73 
75  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
76  static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
77  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
78 
87 
89  itkNewMacro(Self);
90 
93 
94 #ifdef ITK_USE_CONCEPT_CHECKING
95  // Begin concept checking
99  // End concept checking
100 #endif
101 
106  itkSetMacro(BackgroundValue, OutputImagePixelType);
107  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
109 
113  itkGetConstMacro(NumberOfObjects, SizeValueType);
114  itkSetMacro(NumberOfObjects, SizeValueType);
116 
122  itkGetConstMacro(ReverseOrdering, bool);
123  itkSetMacro(ReverseOrdering, bool);
124  itkBooleanMacro(ReverseOrdering);
126 
131  itkGetConstMacro(Attribute, AttributeType);
132  itkSetMacro(Attribute, AttributeType);
133  void
134  SetAttribute(const std::string & s)
135  {
136  this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
137  }
139 
140 protected:
142  ~LabelShapeKeepNObjectsImageFilter() override = default;
143  void
144  PrintSelf(std::ostream & os, Indent indent) const override;
145 
149  void
150  GenerateInputRequestedRegion() override;
151 
153  void
154  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
155 
158  void
159  GenerateData() override;
160 
161 private:
166 }; // end of class
167 } // end namespace itk
168 
169 #ifndef ITK_MANUAL_INSTANTIATION
170 # include "itkLabelShapeKeepNObjectsImageFilter.hxx"
171 #endif
172 
173 #endif
itk::LabelShapeKeepNObjectsImageFilter::SetAttribute
void SetAttribute(const std::string &s)
Definition: itkLabelShapeKeepNObjectsImageFilter.h:134
itkLabelImageToLabelMapFilter.h
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:636
itk::LabelShapeKeepNObjectsImageFilter
keep N objects according to their shape attributes
Definition: itkLabelShapeKeepNObjectsImageFilter.h:51
itk::LabelImageToLabelMapFilter
convert a labeled image to a label collection image
Definition: itkLabelImageToLabelMapFilter.h:49
itk::ShapeKeepNObjectsLabelMapFilter
Keep N objects according to their shape attributes.
Definition: itkShapeKeepNObjectsLabelMapFilter.h:44
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ShapeLabelMapFilter
The valuator class for the ShapeLabelObject.
Definition: itkShapeLabelMapFilter.h:53
itk::LabelShapeKeepNObjectsImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:67
itk::LabelMap
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
itkShapeLabelMapFilter.h
itkShapeLabelObject.h
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::LabelShapeKeepNObjectsImageFilter::m_NumberOfObjects
SizeValueType m_NumberOfObjects
Definition: itkLabelShapeKeepNObjectsImageFilter.h:163
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LabelShapeKeepNObjectsImageFilter::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:71
itk::LabelShapeKeepNObjectsImageFilter::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:69
itk::LabelShapeKeepNObjectsImageFilter::InputImageType
TInputImage InputImageType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:63
itk::LabelShapeKeepNObjectsImageFilter::m_Attribute
AttributeType m_Attribute
Definition: itkLabelShapeKeepNObjectsImageFilter.h:165
itk::LabelShapeKeepNObjectsImageFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:70
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkShapeKeepNObjectsLabelMapFilter.h
itk::LabelShapeKeepNObjectsImageFilter::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:72
itk::LabelShapeKeepNObjectsImageFilter::m_BackgroundValue
OutputImagePixelType m_BackgroundValue
Definition: itkLabelShapeKeepNObjectsImageFilter.h:162
itk::LabelShapeKeepNObjectsImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:66
itk::LabelShapeKeepNObjectsImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:65
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ShapeLabelObject
A Label object to store the common attributes related to the shape of the object.
Definition: itkShapeLabelObject.h:43
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::LabelMapToLabelImageFilter
Converts a LabelMap to a labeled image.
Definition: itkLabelMapToLabelImageFilter.h:46
itk::LabelShapeKeepNObjectsImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:68
itk::LabelShapeKeepNObjectsImageFilter::AttributeType
typename LabelObjectType::AttributeType AttributeType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:84
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::ShapeLabelObject::AttributeType
typename Superclass::AttributeType AttributeType
Definition: itkShapeLabelObject.h:74
itkLabelMapToLabelImageFilter.h
itk::LabelShapeKeepNObjectsImageFilter::OutputImageType
TInputImage OutputImageType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:64
itk::LabelShapeKeepNObjectsImageFilter::m_ReverseOrdering
bool m_ReverseOrdering
Definition: itkLabelShapeKeepNObjectsImageFilter.h:164
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:306
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293