ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkChangeLabelLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 
24 namespace itk
25 {
48 template< typename TImage >
49 class ITK_TEMPLATE_EXPORT ChangeLabelLabelMapFilter:
50  public InPlaceLabelMapFilter< TImage >
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_ASSIGN(ChangeLabelLabelMapFilter);
54 
60 
62  using ImageType = TImage;
63  using ImagePointer = typename ImageType::Pointer;
64  using ImageConstPointer = typename ImageType::ConstPointer;
65  using PixelType = typename ImageType::PixelType;
66  using IndexType = typename ImageType::IndexType;
67  using LabelObjectType = typename ImageType::LabelObjectType;
68 
70  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
71 
73  itkNewMacro(Self);
74 
77 
78  using ChangeMapType = typename std::map< PixelType, PixelType >;
79  using ChangeMapIterator = typename ChangeMapType::const_iterator;
80 
81 #ifdef ITK_USE_CONCEPT_CHECKING
82  // Begin concept checking
83 /* itkConceptMacro(InputEqualityComparableCheck,
84  (Concept::EqualityComparable<InputImagePixelType>));
85  itkConceptMacro(IntConvertibleToInputCheck,
86  (Concept::Convertible<int, InputImagePixelType>));
87  itkConceptMacro(InputOStreamWritableCheck,
88  (Concept::OStreamWritable<InputImagePixelType>));*/
89 // End concept checking
90 #endif
91 
94  void SetChangeMap(const ChangeMapType & changeMap);
95 
96  const ChangeMapType & GetChangeMap() const;
97 
98  void SetChange(const PixelType & oldLabel, const PixelType & newLabel);
99 
100  void ClearChangeMap();
101 
102 protected:
103  ChangeLabelLabelMapFilter() = default;
104  ~ChangeLabelLabelMapFilter() override = default;
105 
106  void GenerateData() override;
107 
108  void PrintSelf(std::ostream & os, Indent indent) const override;
109 
111 }; // end of class
112 } // end namespace itk
113 
114 #ifndef ITK_MANUAL_INSTANTIATION
115 #include "itkChangeLabelLabelMapFilter.hxx"
116 #endif
117 
118 #endif
typename ImageType::Pointer ImagePointer
Light weight base class for most itk classes.
typename ChangeMapType::const_iterator ChangeMapIterator
typename std::map< PixelType, PixelType > ChangeMapType
Base class for filters that takes an image as input and overwrites that image as the output...
typename ImageType::IndexType IndexType
Replace the label Ids of selected LabelObjects with new label Ids.
typename ImageType::ConstPointer ImageConstPointer
typename ImageType::LabelObjectType LabelObjectType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename ImageType::PixelType PixelType