ITK  5.4.0
Insight Toolkit
itkStatisticsRelabelImageFilter.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 itkStatisticsRelabelImageFilter_h
19#define itkStatisticsRelabelImageFilter_h
20
25
26namespace itk
27{
44template <typename TInputImage, typename TFeatureImage>
45class ITK_TEMPLATE_EXPORT StatisticsRelabelImageFilter : public ImageToImageFilter<TInputImage, TInputImage>
46{
47public:
48 ITK_DISALLOW_COPY_AND_MOVE(StatisticsRelabelImageFilter);
49
55
57 using InputImageType = TInputImage;
58 using OutputImageType = TInputImage;
62 using InputImagePixelType = typename InputImageType::PixelType;
66 using OutputImagePixelType = typename OutputImageType::PixelType;
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
85
87 itkNewMacro(Self);
88
90 itkOverrideGetNameOfClassMacro(StatisticsRelabelImageFilter);
91
92#ifdef ITK_USE_CONCEPT_CHECKING
93 // Begin concept checking
97 // End concept checking
98#endif
99
104 itkSetMacro(BackgroundValue, OutputImagePixelType);
105 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
113 itkGetConstMacro(ReverseOrdering, bool);
114 itkSetMacro(ReverseOrdering, bool);
115 itkBooleanMacro(ReverseOrdering);
121 itkGetConstMacro(Attribute, AttributeType);
122 itkSetMacro(Attribute, AttributeType);
123 void
124 SetAttribute(const std::string & s)
125 {
126 this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
127 }
131 void
132 SetFeatureImage(TFeatureImage * input)
133 {
134 // Process object is not const-correct so the const casting is required.
135 this->SetNthInput(1, const_cast<TFeatureImage *>(input));
136 }
137
139 FeatureImageType *
141 {
142 return static_cast<FeatureImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
143 }
144
146 void
148 {
149 this->SetInput(input);
150 }
151
153 void
155 {
156 this->SetFeatureImage(input);
157 }
158
159protected:
161 ~StatisticsRelabelImageFilter() override = default;
162 void
163 PrintSelf(std::ostream & os, Indent indent) const override;
164
168 void
170
172 void
173 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
174
177 void
178 GenerateData() override;
179
180private:
181 OutputImagePixelType m_BackgroundValue{};
182 bool m_ReverseOrdering{};
183 AttributeType m_Attribute{};
184}; // end of class
185} // end namespace itk
186
187#ifndef ITK_MANUAL_INSTANTIATION
188# include "itkStatisticsRelabelImageFilter.hxx"
189#endif
190
191#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
Converts a LabelMap to a labeled 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.
relabel objects according to their shape attributes
typename InputImageType::RegionType InputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
void PrintSelf(std::ostream &os, Indent indent) const override
typename OutputImageType::Pointer OutputImagePointer
typename InputImageType::ConstPointer InputImageConstPointer
typename FeatureImageType::PixelType FeatureImagePixelType
typename FeatureImageType::Pointer FeatureImagePointer
typename LabelObjectType::AttributeType AttributeType
void EnlargeOutputRequestedRegion(DataObject *) override
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::Pointer InputImagePointer
void GenerateInputRequestedRegion() override
typename InputImageType::PixelType InputImagePixelType
typename FeatureImageType::ConstPointer FeatureImageConstPointer
~StatisticsRelabelImageFilter() override=default
typename OutputImageType::ConstPointer OutputImageConstPointer
relabel objects according to their shape attributes
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....