ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkBinaryStatisticsKeepNObjectsImageFilter.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 * https://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
26namespace itk
27{
45template <typename TInputImage, typename TFeatureImage>
46class ITK_TEMPLATE_EXPORT BinaryStatisticsKeepNObjectsImageFilter : public ImageToImageFilter<TInputImage, TInputImage>
47{
48public:
49 ITK_DISALLOW_COPY_AND_MOVE(BinaryStatisticsKeepNObjectsImageFilter);
50
56
58 using InputImageType = TInputImage;
59 using OutputImageType = TInputImage;
60 using InputImagePointer = typename InputImageType::Pointer;
61 using InputImageConstPointer = typename InputImageType::ConstPointer;
62 using InputImageRegionType = typename InputImageType::RegionType;
63 using InputImagePixelType = typename InputImageType::PixelType;
64 using OutputImagePointer = typename OutputImageType::Pointer;
65 using OutputImageConstPointer = typename OutputImageType::ConstPointer;
66 using OutputImageRegionType = typename OutputImageType::RegionType;
67 using OutputImagePixelType = typename OutputImageType::PixelType;
68
69 using FeatureImageType = TFeatureImage;
70 using FeatureImagePointer = typename FeatureImageType::Pointer;
71 using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
72 using FeatureImagePixelType = typename FeatureImageType::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
80
88
90 itkNewMacro(Self);
91
93 itkOverrideGetNameOfClassMacro(BinaryStatisticsKeepNObjectsImageFilter);
94
101 itkSetMacro(FullyConnected, bool);
102 itkGetConstReferenceMacro(FullyConnected, bool);
103 itkBooleanMacro(FullyConnected);
105
109
114 itkSetMacro(BackgroundValue, OutputImagePixelType);
115 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
117
122 itkSetMacro(ForegroundValue, OutputImagePixelType);
123 itkGetConstMacro(ForegroundValue, OutputImagePixelType);
125
129 itkGetConstMacro(NumberOfObjects, SizeValueType);
130 itkSetMacro(NumberOfObjects, SizeValueType);
132
138 itkGetConstMacro(ReverseOrdering, bool);
139 itkSetMacro(ReverseOrdering, bool);
140 itkBooleanMacro(ReverseOrdering);
142
147 itkGetConstMacro(Attribute, AttributeType);
148 itkSetMacro(Attribute, AttributeType);
149 void
150 SetAttribute(const std::string & s)
151 {
153 }
154
155
157 void
158 SetFeatureImage(const TFeatureImage * input)
159 {
160 // Process object is not const-correct so the const casting is required.
161 this->SetNthInput(1, const_cast<TFeatureImage *>(input));
162 }
163
165 const FeatureImageType *
167 {
168 return static_cast<const FeatureImageType *>(this->ProcessObject::GetInput(1));
169 }
170
172 void
174 {
175 this->SetInput(input);
176 }
177
179 void
181 {
182 this->SetFeatureImage(input);
183 }
184
185protected:
188 void
189 PrintSelf(std::ostream & os, Indent indent) const override;
190
194 void
196
198 void
199 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
200
203 void
204 GenerateData() override;
205
206private:
207 bool m_FullyConnected{ false };
211 bool m_ReverseOrdering{ false };
213}; // end of class
214} // end namespace itk
215
216#ifndef ITK_MANUAL_INSTANTIATION
217# include "itkBinaryStatisticsKeepNObjectsImageFilter.hxx"
218#endif
219
220#endif
Label the connected components in a binary image and produce a collection of label objects.
void EnlargeOutputRequestedRegion(DataObject *output) override
LabelMapToBinaryImageFilter< LabelMapType, OutputImageType > BinarizerType
void PrintSelf(std::ostream &os, Indent indent) const override
StatisticsLabelObject< LabelType, Self::ImageDimension > LabelObjectType
StatisticsKeepNObjectsLabelMapFilter< LabelMapType > KeepNObjectsType
~BinaryStatisticsKeepNObjectsImageFilter() override=default
BinaryImageToLabelMapFilter< InputImageType, LabelMapType > LabelizerType
StatisticsLabelMapFilter< LabelMapType, TFeatureImage > LabelObjectValuatorType
virtual void SetAttribute(AttributeType _arg)
Base class for all data objects in ITK.
virtual void SetInput(const InputImageType *input)
Control indentation during Print() invocation.
Definition itkIndent.h:50
Convert a LabelMap to a binary image.
Templated n-dimensional image to store labeled objects.
Definition itkLabelMap.h:71
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Implements transparent reference counting.
keep N objects according to their statistics attributes
The valuator class for the StatisticsLabelObject.
A Label object to store the common attributes related to the statistics of the object.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86