ITK  5.4.0
Insight Toolkit
itkBinaryImageToStatisticsLabelMapFilter.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 itkBinaryImageToStatisticsLabelMapFilter_h
19#define itkBinaryImageToStatisticsLabelMapFilter_h
20
24
25namespace itk
26{
40template <typename TInputImage,
41 typename TFeatureImage,
42 typename TOutputImage = LabelMap<StatisticsLabelObject<SizeValueType, TInputImage::ImageDimension>>>
43class ITK_TEMPLATE_EXPORT BinaryImageToStatisticsLabelMapFilter : public ImageToImageFilter<TInputImage, TOutputImage>
44{
45public:
46 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToStatisticsLabelMapFilter);
47
53
55 using InputImageType = TInputImage;
59 using InputImagePixelType = typename InputImageType::PixelType;
60
61 using OutputImageType = TOutputImage;
65 using OutputImagePixelType = typename OutputImageType::PixelType;
66 using LabelObjectType = typename OutputImageType::LabelObjectType;
67
68 using FeatureImageType = TFeatureImage;
71 using FeatureImagePixelType = typename FeatureImageType::PixelType;
72
74 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
75 static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
76 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
77
80
82 itkNewMacro(Self);
83
85 itkOverrideGetNameOfClassMacro(BinaryImageToStatisticsLabelMapFilter);
86
93 itkSetMacro(FullyConnected, bool);
94 itkGetConstReferenceMacro(FullyConnected, bool);
95 itkBooleanMacro(FullyConnected);
98#ifdef ITK_USE_CONCEPT_CHECKING
99 // Begin concept checking
103 // End concept checking
104#endif
105
110 itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
111 itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
118 itkSetMacro(InputForegroundValue, InputImagePixelType);
119 itkGetConstMacro(InputForegroundValue, InputImagePixelType);
126 itkSetMacro(ComputeFeretDiameter, bool);
127 itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
128 itkBooleanMacro(ComputeFeretDiameter);
135 itkSetMacro(ComputePerimeter, bool);
136 itkGetConstReferenceMacro(ComputePerimeter, bool);
137 itkBooleanMacro(ComputePerimeter);
141 void
142 SetFeatureImage(const TFeatureImage * input)
143 {
144 // Process object is not const-correct so the const casting is required.
145 this->SetNthInput(1, const_cast<TFeatureImage *>(input));
146 }
147
149 const FeatureImageType *
151 {
152 return static_cast<const FeatureImageType *>(this->ProcessObject::GetInput(1));
153 }
154
156 void
158 {
159 this->SetInput(input);
160 }
161
163 void
165 {
166 this->SetFeatureImage(input);
167 }
168
175 itkSetMacro(ComputeHistogram, bool);
176 itkGetConstReferenceMacro(ComputeHistogram, bool);
177 itkBooleanMacro(ComputeHistogram);
185 itkSetMacro(NumberOfBins, unsigned int);
186 itkGetConstReferenceMacro(NumberOfBins, unsigned int);
189protected:
192 void
193 PrintSelf(std::ostream & os, Indent indent) const override;
194
198 void
200
202 void
203 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
204
207 void
208 GenerateData() override;
209
210private:
211 bool m_FullyConnected{};
212 OutputImagePixelType m_OutputBackgroundValue{};
213 InputImagePixelType m_InputForegroundValue{};
214 bool m_ComputeFeretDiameter{};
215 bool m_ComputePerimeter{};
216 unsigned int m_NumberOfBins{};
217 bool m_ComputeHistogram{};
218}; // end of class
219} // end namespace itk
220
221#ifndef ITK_MANUAL_INSTANTIATION
222# include "itkBinaryImageToStatisticsLabelMapFilter.hxx"
223#endif
224
225#endif
Label the connected components in a binary image and produce a collection of label objects.
a convenient class to convert a binary image to a label map and valuate the statistics attributes at ...
~BinaryImageToStatisticsLabelMapFilter() override=default
void EnlargeOutputRequestedRegion(DataObject *) override
void PrintSelf(std::ostream &os, Indent indent) const override
typename FeatureImageType::ConstPointer FeatureImageConstPointer
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
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
The valuator class for the StatisticsLabelObject.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....