ITK  6.0.0
Insight Toolkit
itkChangeLabelLabelMapFilter.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 itkChangeLabelLabelMapFilter_h
19#define itkChangeLabelLabelMapFilter_h
20
22#include <map>
23
24namespace itk
25{
48template <typename TImage>
49class ITK_TEMPLATE_EXPORT ChangeLabelLabelMapFilter : public InPlaceLabelMapFilter<TImage>
50{
51public:
52 ITK_DISALLOW_COPY_AND_MOVE(ChangeLabelLabelMapFilter);
53
59
61 using ImageType = TImage;
64 using PixelType = typename ImageType::PixelType;
66 using LabelObjectType = typename ImageType::LabelObjectType;
67
69 static constexpr unsigned int ImageDimension = TImage::ImageDimension;
70
72 itkNewMacro(Self);
73
75 itkOverrideGetNameOfClassMacro(ChangeLabelLabelMapFilter);
76
77 using ChangeMapType = typename std::map<PixelType, PixelType>;
78 using ChangeMapIterator = typename ChangeMapType::const_iterator;
79
80#ifdef ITK_USE_CONCEPT_CHECKING
81 // Begin concept checking
82/* itkConceptMacro(InputEqualityComparableCheck,
83 (Concept::EqualityComparable<InputImagePixelType>));
84 itkConceptMacro(IntConvertibleToInputCheck,
85 (Concept::Convertible<int, InputImagePixelType>));
86 itkConceptMacro(InputOStreamWritableCheck,
87 (Concept::OStreamWritable<InputImagePixelType>));*/
88// End concept checking
89#endif
90
93 void
94 SetChangeMap(const ChangeMapType & changeMap);
95
96 const ChangeMapType &
97 GetChangeMap() const;
98
99 void
100 SetChange(const PixelType & oldLabel, const PixelType & newLabel);
101
102 void
104
105protected:
107 ~ChangeLabelLabelMapFilter() override = default;
108
109 void
110 GenerateData() override;
111
112 void
113 PrintSelf(std::ostream & os, Indent indent) const override;
114
115 ChangeMapType m_MapOfLabelToBeReplaced{};
116}; // end of class
117} // end namespace itk
118
119#ifndef ITK_MANUAL_INSTANTIATION
120# include "itkChangeLabelLabelMapFilter.hxx"
121#endif
122
123#endif
Replace the label Ids of selected LabelObjects with new label Ids.
typename ChangeMapType::const_iterator ChangeMapIterator
typename ImageType::Pointer ImagePointer
void SetChange(const PixelType &oldLabel, const PixelType &newLabel)
void SetChangeMap(const ChangeMapType &changeMap)
~ChangeLabelLabelMapFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
const ChangeMapType & GetChangeMap() const
typename ImageType::PixelType PixelType
typename ImageType::ConstPointer ImageConstPointer
typename ImageType::LabelObjectType LabelObjectType
typename std::map< PixelType, PixelType > ChangeMapType
typename ImageType::IndexType IndexType
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.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....