ITK  5.4.0
Insight Toolkit
itkBinaryStatisticsOpeningImageFilter.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 itkBinaryStatisticsOpeningImageFilter_h
19#define itkBinaryStatisticsOpeningImageFilter_h
20
25
26namespace itk
27{
49template <typename TInputImage, typename TFeatureImage>
50class ITK_TEMPLATE_EXPORT BinaryStatisticsOpeningImageFilter : public ImageToImageFilter<TInputImage, TInputImage>
51{
52public:
53 ITK_DISALLOW_COPY_AND_MOVE(BinaryStatisticsOpeningImageFilter);
54
60
62 using InputImageType = TInputImage;
63 using OutputImageType = TInputImage;
67 using InputImagePixelType = typename InputImageType::PixelType;
71 using OutputImagePixelType = typename OutputImageType::PixelType;
73 using FeatureImageType = TFeatureImage;
76 using FeatureImagePixelType = typename FeatureImageType::PixelType;
77
79 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
80 static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
81 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
92
94 itkNewMacro(Self);
95
97 itkOverrideGetNameOfClassMacro(BinaryStatisticsOpeningImageFilter);
98
105 itkSetMacro(FullyConnected, bool);
106 itkGetConstReferenceMacro(FullyConnected, bool);
107 itkBooleanMacro(FullyConnected);
110#ifdef ITK_USE_CONCEPT_CHECKING
111 // Begin concept checking
115 // End concept checking
116#endif
117
122 itkSetMacro(BackgroundValue, OutputImagePixelType);
123 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
130 itkSetMacro(ForegroundValue, OutputImagePixelType);
131 itkGetConstMacro(ForegroundValue, OutputImagePixelType);
137 itkGetConstMacro(Lambda, double);
138 itkSetMacro(Lambda, double);
147 itkGetConstMacro(ReverseOrdering, bool);
148 itkSetMacro(ReverseOrdering, bool);
149 itkBooleanMacro(ReverseOrdering);
156 itkGetConstMacro(Attribute, AttributeType);
157 itkSetMacro(Attribute, AttributeType);
158 void
159 SetAttribute(const std::string & s)
160 {
161 this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
162 }
166 void
167 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 GetFeatureImage()
176 {
177 return static_cast<const FeatureImageType *>(this->ProcessObject::GetInput(1));
178 }
179
181 void
182 SetInput1(const InputImageType * input)
183 {
184 this->SetInput(input);
185 }
186
188 void
189 SetInput2(const FeatureImageType * input)
190 {
191 this->SetFeatureImage(input);
192 }
193
194protected:
196 ~BinaryStatisticsOpeningImageFilter() override = default;
197 void
198 PrintSelf(std::ostream & os, Indent indent) const override;
199
202 void
203 GenerateInputRequestedRegion() override;
204
206 void
207 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
208
211 void
212 GenerateData() override;
213
214private:
215 bool m_FullyConnected{};
216 OutputImagePixelType m_BackgroundValue{};
217 OutputImagePixelType m_ForegroundValue{};
218 double m_Lambda{};
219 bool m_ReverseOrdering{};
220 AttributeType m_Attribute{};
221}; // end of class
222} // end namespace itk
223
224#ifndef ITK_MANUAL_INSTANTIATION
225# include "itkBinaryStatisticsOpeningImageFilter.hxx"
226#endif
227
228#endif
Label the connected components in a binary image and produce a collection of label objects.
Remove objects based on the value of their Statistics attribute.
typename InputImageType::ConstPointer InputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
typename FeatureImageType::PixelType FeatureImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
typename LabelObjectType::AttributeType AttributeType
Base class for all data objects in ITK.
Base class for filters that take an image as input and produce an image as output.
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
unsigned int AttributeType
Light weight base class for most itk classes.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
The valuator class for the StatisticsLabelObject.
A Label object to store the common attributes related to the statistics of the object.
remove the objects according to the value of their statistics attribute
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:83