ITK  5.4.0
Insight Toolkit
itkMergeLabelMapFilter.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 itkMergeLabelMapFilter_h
19#define itkMergeLabelMapFilter_h
20
22#include "ITKLabelMapExport.h"
23
24namespace itk
25{
26// See https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2059?view=vs-2019
27#ifdef STRICT
28# define TEMPINPLACELABELMAPSTRICT STRICT
29# undef STRICT
30#endif
36{
37public:
41 enum class ChoiceMethod : uint8_t
42 {
43 KEEP = 0,
44 AGGREGATE = 1,
45 PACK = 2,
46 STRICT = 3
47 };
48};
49// Define how to print enumeration
50extern ITKLabelMap_EXPORT std::ostream &
51 operator<<(std::ostream & out, const MergeLabelMapFilterEnums::ChoiceMethod value);
52
54#if !defined(ITK_LEGACY_REMOVE)
57// We need to expose the enum values at the class level
58// for backwards compatibility
59static constexpr ChoiceMethodEnum KEEP = ChoiceMethodEnum::KEEP;
60static constexpr ChoiceMethodEnum AGGREGATE = ChoiceMethodEnum::AGGREGATE;
61static constexpr ChoiceMethodEnum PACK = ChoiceMethodEnum::PACK;
62static constexpr ChoiceMethodEnum STRICT = ChoiceMethodEnum::STRICT;
63#endif
64
65#ifdef TEMPINPLACELABELMAPSTRICT
66# define STRICT TEMPINPLACELABELMAPSTRICT
67# undef TEMPINPLACELABELMAPSTRICT
68#endif
100template <typename TImage>
101class ITK_TEMPLATE_EXPORT MergeLabelMapFilter : public InPlaceLabelMapFilter<TImage>
102{
103public:
104 ITK_DISALLOW_COPY_AND_MOVE(MergeLabelMapFilter);
105
111
113 using ImageType = TImage;
116 using PixelType = typename ImageType::PixelType;
118 using LabelObjectType = typename ImageType::LabelObjectType;
120
122 static constexpr unsigned int ImageDimension = TImage::ImageDimension;
123
125 itkNewMacro(Self);
126
128 itkOverrideGetNameOfClassMacro(MergeLabelMapFilter);
129
130#if !defined(ITK_LEGACY_REMOVE)
132 using MethodChoice = ChoiceMethodEnum;
133#endif
134
135#ifdef ITK_USE_CONCEPT_CHECKING
136 // Begin concept checking
137/* itkConceptMacro(InputEqualityComparableCheck,
138 (Concept::EqualityComparable<InputImagePixelType>));
139 itkConceptMacro(IntConvertibleToInputCheck,
140 (Concept::Convertible<int, InputImagePixelType>));
141 itkConceptMacro(InputOStreamWritableCheck,
142 (Concept::OStreamWritable<InputImagePixelType>));*/
143// End concept checking
144#endif
145
146#ifdef STRICT
147# undef STRICT
148#endif
149
151 itkSetMacro(Method, ChoiceMethodEnum);
152 itkGetConstReferenceMacro(Method, ChoiceMethodEnum);
155protected:
157 ~MergeLabelMapFilter() override = default;
158
159 void
160 GenerateData() override;
161
162 void
163 PrintSelf(std::ostream & os, Indent indent) const override;
164
166
167private:
168 void
170
171 void
173
174 void
176
177 void
179}; // end of class
180} // end namespace itk
181
182#ifndef ITK_MANUAL_INSTANTIATION
183# include "itkMergeLabelMapFilter.hxx"
184#endif
185
186#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.
Contains all enum classes used by MergeLabelMapFilter class.
Merges several Label Maps.
typename ImageType::Pointer ImagePointer
typename ImageType::ConstPointer ImageConstPointer
void PrintSelf(std::ostream &os, Indent indent) const override
~MergeLabelMapFilter() override=default
void GenerateData() override
typename ImageType::IndexType IndexType
typename ImageType::PixelType PixelType
typename ImageType::LabelObjectType LabelObjectType
typename LabelObjectType::Pointer LabelObjectPointer
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:216
MergeLabelMapFilterEnums::ChoiceMethod ChoiceMethodEnum