ITK  6.0.0
Insight Toolkit
itkInPlaceLabelMapFilter.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/*=========================================================================
19 *
20 * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21 *
22 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23 *
24 * For complete copyright, license and disclaimer of warranty information
25 * please refer to the NOTICE file at the top of the ITK source tree.
26 *
27 *=========================================================================*/
28#ifndef itkInPlaceLabelMapFilter_h
29#define itkInPlaceLabelMapFilter_h
30
31#include "itkLabelMapFilter.h"
32
33namespace itk
34{
82template <typename TInputImage>
83class ITK_TEMPLATE_EXPORT InPlaceLabelMapFilter : public LabelMapFilter<TInputImage, TInputImage>
84{
85public:
86 ITK_DISALLOW_COPY_AND_MOVE(InPlaceLabelMapFilter);
87
93
95 itkOverrideGetNameOfClassMacro(InPlaceLabelMapFilter);
96
98 itkNewMacro(Self);
99
101 using typename Superclass::OutputImageType;
102 using typename Superclass::OutputImagePointer;
103 using typename Superclass::OutputImageRegionType;
104 using typename Superclass::OutputImagePixelType;
105
107 using InputImageType = TInputImage;
111 using InputImagePixelType = typename InputImageType::PixelType;
112 using LabelObjectType = typename InputImageType::LabelObjectType;
113
114 using PixelType = typename InputImageType::PixelType;
117
118 using TOutputImage = TInputImage;
119
121 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
122 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
123
126 itkSetMacro(InPlace, bool);
127 itkGetMacro(InPlace, bool);
128 itkBooleanMacro(InPlace);
137 bool
139 {
140 return true; // used to test if TInputImage == TOutputImage. But
141 // if you look above, the superclass declaration
142 // specifies
143 // LabelMapFilter<TInputImage,TOutputImage> so there's
144 // no way this couldn't be true.
145 }
146
147protected:
149 ~InPlaceLabelMapFilter() override = default;
150
151 void
152 PrintSelf(std::ostream & os, Indent indent) const override;
153
166 void
167 AllocateOutputs() override;
168
174 GetLabelMap() override
175 {
176 return this->GetOutput();
177 }
178
179private:
180 bool m_InPlace{ true };
181};
182} // end namespace itk
183
184#ifndef ITK_MANUAL_INSTANTIATION
185# include "itkInPlaceLabelMapFilter.hxx"
186#endif
187
188#endif
Base class for filters that takes an image as input and overwrites that image as the output.
typename InputImageType::RegionType InputImageRegionType
typename InputImageType::Pointer InputImagePointer
typename InputImageType::LabelObjectType LabelObjectType
typename InputImageType::IndexType IndexType
typename InputImageType::PixelType PixelType
void PrintSelf(std::ostream &os, Indent indent) const override
void AllocateOutputs() override
typename InputImageType::RegionType RegionType
InputImageType * GetLabelMap() override
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::PixelType InputImagePixelType
~InPlaceLabelMapFilter() override=default
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for filters that take an image as input and overwrite that image as the output.
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....