ITK  6.0.0
Insight Toolkit
itkLabelImageToStatisticsLabelMapFilter.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 itkLabelImageToStatisticsLabelMapFilter_h
19#define itkLabelImageToStatisticsLabelMapFilter_h
20
24
25namespace itk
26{
40template <typename TInputImage,
41 typename TFeatureImage,
42 typename TOutputImage =
43 LabelMap<StatisticsLabelObject<typename TInputImage::PixelType, TInputImage::ImageDimension>>>
44class ITK_TEMPLATE_EXPORT LabelImageToStatisticsLabelMapFilter : public ImageToImageFilter<TInputImage, TOutputImage>
45{
46public:
47 ITK_DISALLOW_COPY_AND_MOVE(LabelImageToStatisticsLabelMapFilter);
48
54
56 using InputImageType = TInputImage;
60 using InputImagePixelType = typename InputImageType::PixelType;
61
62 using OutputImageType = TOutputImage;
66 using OutputImagePixelType = typename OutputImageType::PixelType;
67 using LabelObjectType = typename OutputImageType::LabelObjectType;
68
69 using FeatureImageType = TFeatureImage;
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
81
83 itkNewMacro(Self);
84
86 itkOverrideGetNameOfClassMacro(LabelImageToStatisticsLabelMapFilter);
87
88#ifdef ITK_USE_CONCEPT_CHECKING
89 // Begin concept checking
93 // End concept checking
94#endif
95
100 itkSetMacro(BackgroundValue, OutputImagePixelType);
101 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
108 itkSetMacro(ComputeFeretDiameter, bool);
109 itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
110 itkBooleanMacro(ComputeFeretDiameter);
117 itkSetMacro(ComputePerimeter, bool);
118 itkGetConstReferenceMacro(ComputePerimeter, bool);
119 itkBooleanMacro(ComputePerimeter);
123 void
124 SetFeatureImage(const TFeatureImage * input)
125 {
126 // Process object is not const-correct so the const casting is required.
127 this->SetNthInput(1, const_cast<TFeatureImage *>(input));
128 }
129
131 const FeatureImageType *
133 {
134 return static_cast<FeatureImageType *>(this->ProcessObject::GetInput(1));
135 }
136
138 void
140 {
141 this->SetInput(input);
142 }
143
145 void
147 {
148 this->SetFeatureImage(input);
149 }
150
157 itkSetMacro(ComputeHistogram, bool);
158 itkGetConstReferenceMacro(ComputeHistogram, bool);
159 itkBooleanMacro(ComputeHistogram);
167 itkSetMacro(NumberOfBins, unsigned int);
168 itkGetConstReferenceMacro(NumberOfBins, unsigned int);
171protected:
174 void
175 PrintSelf(std::ostream & os, Indent indent) const override;
176
180 void
182
184 void
185 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
186
189 void
190 GenerateData() override;
191
192private:
193 OutputImagePixelType m_BackgroundValue{};
194 bool m_ComputeFeretDiameter{};
195 bool m_ComputePerimeter{};
196 unsigned int m_NumberOfBins{};
197 bool m_ComputeHistogram{};
198}; // end of class
199} // end namespace itk
200
201#ifndef ITK_MANUAL_INSTANTIATION
202# include "itkLabelImageToStatisticsLabelMapFilter.hxx"
203#endif
204
205#endif
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 labeled image to a label collection image
a convenient class to convert a label image to a label map and valuate the statistics attributes at o...
void PrintSelf(std::ostream &os, Indent indent) const override
typename FeatureImageType::ConstPointer FeatureImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
~LabelImageToStatisticsLabelMapFilter() override=default
void EnlargeOutputRequestedRegion(DataObject *) override
typename OutputImageType::LabelObjectType LabelObjectType
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....