ITK  5.1.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 {
51 template <typename TInputImage>
52 class ITK_TEMPLATE_EXPORT LabelShapeKeepNObjectsImageFilter : public ImageToImageFilter<TInputImage, TInputImage>
53 {
54 public:
55  ITK_DISALLOW_COPY_AND_ASSIGN(LabelShapeKeepNObjectsImageFilter);
56 
62 
64  using InputImageType = TInputImage;
65  using OutputImageType = TInputImage;
66  using InputImagePointer = typename InputImageType::Pointer;
67  using InputImageConstPointer = typename InputImageType::ConstPointer;
69  using InputImagePixelType = typename InputImageType::PixelType;
70  using OutputImagePointer = typename OutputImageType::Pointer;
71  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
73  using OutputImagePixelType = typename OutputImageType::PixelType;
74 
76  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
77  static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
78  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
79 
88 
90  itkNewMacro(Self);
91 
94 
95 #ifdef ITK_USE_CONCEPT_CHECKING
96  // Begin concept checking
100  // End concept checking
101 #endif
102 
107  itkSetMacro(BackgroundValue, OutputImagePixelType);
108  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
110 
114  itkGetConstMacro(NumberOfObjects, SizeValueType);
115  itkSetMacro(NumberOfObjects, SizeValueType);
117 
123  itkGetConstMacro(ReverseOrdering, bool);
124  itkSetMacro(ReverseOrdering, bool);
125  itkBooleanMacro(ReverseOrdering);
127 
132  itkGetConstMacro(Attribute, AttributeType);
133  itkSetMacro(Attribute, AttributeType);
134  void
135  SetAttribute(const std::string & s)
136  {
137  this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
138  }
140 
141 protected:
143  ~LabelShapeKeepNObjectsImageFilter() override = default;
144  void
145  PrintSelf(std::ostream & os, Indent indent) const override;
146 
150  void
151  GenerateInputRequestedRegion() override;
152 
154  void
155  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
156 
159  void
160  GenerateData() override;
161 
162 private:
167 }; // end of class
168 } // end namespace itk
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 # include "itkLabelShapeKeepNObjectsImageFilter.hxx"
172 #endif
173 
174 #endif
itk::LabelShapeKeepNObjectsImageFilter::SetAttribute
void SetAttribute(const std::string &s)
Definition: itkLabelShapeKeepNObjectsImageFilter.h:135
itkLabelImageToLabelMapFilter.h
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:634
itk::LabelShapeKeepNObjectsImageFilter
keep N objects according to their shape attributes
Definition: itkLabelShapeKeepNObjectsImageFilter.h:52
itk::LabelImageToLabelMapFilter
convert a labeled image to a label collection image
Definition: itkLabelImageToLabelMapFilter.h:50
itk::ShapeKeepNObjectsLabelMapFilter
Keep N objects according to their shape attributes.
Definition: itkShapeKeepNObjectsLabelMapFilter.h:45
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:54
itk::LabelShapeKeepNObjectsImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:68
itk::LabelMap
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:71
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:164
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LabelShapeKeepNObjectsImageFilter::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:72
itk::LabelShapeKeepNObjectsImageFilter::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:70
itk::LabelShapeKeepNObjectsImageFilter::InputImageType
TInputImage InputImageType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:64
itk::LabelShapeKeepNObjectsImageFilter::m_Attribute
AttributeType m_Attribute
Definition: itkLabelShapeKeepNObjectsImageFilter.h:166
itk::LabelShapeKeepNObjectsImageFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:71
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkShapeKeepNObjectsLabelMapFilter.h
itk::LabelShapeKeepNObjectsImageFilter::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:73
itk::LabelShapeKeepNObjectsImageFilter::m_BackgroundValue
OutputImagePixelType m_BackgroundValue
Definition: itkLabelShapeKeepNObjectsImageFilter.h:163
itk::LabelShapeKeepNObjectsImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:67
itk::LabelShapeKeepNObjectsImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkLabelShapeKeepNObjectsImageFilter.h:66
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:64
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::ShapeLabelObject
A Label object to store the common attributes related to the shape of the object.
Definition: itkShapeLabelObject.h:44
itk::Concept::Convertible
Definition: itkConceptChecking.h:214
itk::LabelMapToLabelImageFilter
Converts a LabelMap to a labeled image.
Definition: itkLabelMapToLabelImageFilter.h:47
itk::LabelShapeKeepNObjectsImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:69
itk::LabelShapeKeepNObjectsImageFilter::AttributeType
typename LabelObjectType::AttributeType AttributeType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:85
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::ShapeLabelObject::AttributeType
typename Superclass::AttributeType AttributeType
Definition: itkShapeLabelObject.h:75
itkLabelMapToLabelImageFilter.h
itk::LabelShapeKeepNObjectsImageFilter::OutputImageType
TInputImage OutputImageType
Definition: itkLabelShapeKeepNObjectsImageFilter.h:65
itk::LabelShapeKeepNObjectsImageFilter::m_ReverseOrdering
bool m_ReverseOrdering
Definition: itkLabelShapeKeepNObjectsImageFilter.h:165
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:304
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293