ITK  6.0.0
Insight Toolkit
itkShapeLabelMapFilter.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 itkShapeLabelMapFilter_h
19#define itkShapeLabelMapFilter_h
20
23
24namespace itk
25{
52template <typename TImage, typename TLabelImage = Image<typename TImage::PixelType, TImage::ImageDimension>>
53class ITK_TEMPLATE_EXPORT ShapeLabelMapFilter : public InPlaceLabelMapFilter<TImage>
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(ShapeLabelMapFilter);
57
63
65 using ImageType = TImage;
68 using PixelType = typename ImageType::PixelType;
70 using SizeType = typename ImageType::SizeType;
72 using OffsetType = typename ImageType::OffsetType;
73 using LabelObjectType = typename ImageType::LabelObjectType;
74 using MatrixType = typename LabelObjectType::MatrixType;
76
77 using LabelImageType = TLabelImage;
80 using LabelPixelType = typename LabelImageType::PixelType;
81
83 static constexpr unsigned int ImageDimension = TImage::ImageDimension;
84
86 itkNewMacro(Self);
87
89 itkOverrideGetNameOfClassMacro(ShapeLabelMapFilter);
90
91#ifdef ITK_USE_CONCEPT_CHECKING
92 // Begin concept checking
93/* itkConceptMacro(InputEqualityComparableCheck,
94 (Concept::EqualityComparable<InputImagePixelType>));
95 itkConceptMacro(IntConvertibleToInputCheck,
96 (Concept::Convertible<int, InputImagePixelType>));
97 itkConceptMacro(InputOStreamWritableCheck,
98 (Concept::OStreamWritable<InputImagePixelType>));*/
99// End concept checking
100#endif
101
106 itkSetMacro(ComputeFeretDiameter, bool);
107 itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
108 itkBooleanMacro(ComputeFeretDiameter);
115 itkSetMacro(ComputePerimeter, bool);
116 itkGetConstReferenceMacro(ComputePerimeter, bool);
117 itkBooleanMacro(ComputePerimeter);
125 itkSetMacro(ComputeOrientedBoundingBox, bool);
126 itkGetConstReferenceMacro(ComputeOrientedBoundingBox, bool);
127 itkBooleanMacro(ComputeOrientedBoundingBox);
131 void
132 SetLabelImage(const TLabelImage * input)
133 {
134 m_LabelImage = input;
135 }
136
137protected:
139 ~ShapeLabelMapFilter() override = default;
140
141 void
143
144 void
146
147 void
149
150 void
151 PrintSelf(std::ostream & os, Indent indent) const override;
152
153private:
154 bool m_ComputeFeretDiameter{};
155 bool m_ComputePerimeter{};
156 bool m_ComputeOrientedBoundingBox{};
158
159 void
161 void
163 void
165
170 using MapIntercept2Type = std::map<Offset2Type, SizeValueType, Functor::LexicographicCompare>;
171 using MapIntercept3Type = std::map<Offset3Type, SizeValueType, Functor::LexicographicCompare>;
172
173 // it seems impossible to specialize a method without specializing the whole class, but we
174 // can use simple overloading
175 template <typename TMapIntercept, typename TSpacing>
176 double
177 PerimeterFromInterceptCount(TMapIntercept & intercepts, const TSpacing & spacing);
178#if !defined(ITK_DO_NOT_USE_PERIMETER_SPECIALIZATION)
179 double
181 double
183#endif
184};
185
186
187} // end namespace itk
188
189#ifndef ITK_MANUAL_INSTANTIATION
190# include "itkShapeLabelMapFilter.hxx"
191#endif
192
193#endif
Base class for filters that takes an image as input and overwrites that image as the output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
The valuator class for the ShapeLabelObject.
void SetLabelImage(const TLabelImage *input)
typename ImageType::RegionType RegionType
void ComputePerimeter(LabelObjectType *labelObject)
typename ImageType::Pointer ImagePointer
typename ImageType::ConstPointer ImageConstPointer
void ComputeOrientedBoundingBox(LabelObjectType *labelObject)
typename ImageType::IndexType IndexType
typename LabelImageType::ConstPointer LabelImageConstPointer
void ComputeFeretDiameter(LabelObjectType *labelObject)
double PerimeterFromInterceptCount(MapIntercept2Type &intercepts, const Spacing2Type spacing)
double PerimeterFromInterceptCount(MapIntercept3Type &intercepts, const Spacing3Type spacing)
typename LabelImageType::Pointer LabelImagePointer
void BeforeThreadedGenerateData() override
typename LabelImageType::PixelType LabelPixelType
typename ImageType::LabelObjectType LabelObjectType
typename ImageType::SizeType SizeType
typename LabelObjectType::VectorType VectorType
typename ImageType::OffsetType OffsetType
void ThreadedProcessLabelObject(LabelObjectType *labelObject) override
std::map< Offset3Type, SizeValueType, Functor::LexicographicCompare > MapIntercept3Type
std::map< Offset2Type, SizeValueType, Functor::LexicographicCompare > MapIntercept2Type
double PerimeterFromInterceptCount(TMapIntercept &intercepts, const TSpacing &spacing)
void PrintSelf(std::ostream &os, Indent indent) const override
typename LabelObjectType::MatrixType MatrixType
typename ImageType::PixelType PixelType
void AfterThreadedGenerateData() override
~ShapeLabelMapFilter() override=default
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
Definition: itkOffset.h:67