ITK  5.2.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  * 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 /*=========================================================================
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 
33 namespace itk
34 {
82 template <typename TInputImage>
83 class ITK_TEMPLATE_EXPORT InPlaceLabelMapFilter : public LabelMapFilter<TInputImage, TInputImage>
84 {
85 public:
86  ITK_DISALLOW_COPY_AND_MOVE(InPlaceLabelMapFilter);
87 
93 
96 
98  itkNewMacro(Self);
99 
101  using OutputImageType = typename Superclass::OutputImageType;
102  using OutputImagePointer = typename Superclass::OutputImagePointer;
103  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
104  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
105 
107  using InputImageType = TInputImage;
108  using InputImagePointer = typename InputImageType::Pointer;
109  using InputImageConstPointer = typename InputImageType::ConstPointer;
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);
130 
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 
147 protected:
148  InPlaceLabelMapFilter() = default;
149  ~InPlaceLabelMapFilter() override = default;
150 
151  void
152  PrintSelf(std::ostream & os, Indent indent) const override;
153 
166  void
167  AllocateOutputs() override;
168 
173  InputImageType *
174  GetLabelMap() override
175  {
176  return this->GetOutput();
177  }
178 
179 private:
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
itk::ImageSource< TImage >::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::InPlaceLabelMapFilter
Base class for filters that takes an image as input and overwrites that image as the output.
Definition: itkInPlaceLabelMapFilter.h:83
itk::InPlaceLabelMapFilter< TImage >::LabelObjectType
typename InputImageType::LabelObjectType LabelObjectType
Definition: itkInPlaceLabelMapFilter.h:112
itk::InPlaceLabelMapFilter< TImage >::TOutputImage
TImage TOutputImage
Definition: itkInPlaceLabelMapFilter.h:118
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::InPlaceLabelMapFilter::CanRunInPlace
bool CanRunInPlace() const
Definition: itkInPlaceLabelMapFilter.h:138
itkLabelMapFilter.h
itk::ImageToImageFilter< TImage, TImage >::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ImageToImageFilter< TImage, TImage >::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::LabelMapFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkLabelMapFilter.h:57
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::InPlaceLabelMapFilter::GetLabelMap
InputImageType * GetLabelMap() override
Definition: itkInPlaceLabelMapFilter.h:174
itk::ImageToImageFilter< TImage, TImage >::InputImageType
TImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::InPlaceLabelMapFilter< TImage >::RegionType
typename InputImageType::RegionType RegionType
Definition: itkInPlaceLabelMapFilter.h:116
itk::ImageSource< TImage >::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::InPlaceLabelMapFilter< TImage >::PixelType
typename InputImageType::PixelType PixelType
Definition: itkInPlaceLabelMapFilter.h:114
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageSource< TImage >::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::ImageToImageFilter< TImage, TImage >::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::InPlaceLabelMapFilter< TImage >::IndexType
typename InputImageType::IndexType IndexType
Definition: itkInPlaceLabelMapFilter.h:115
itk::ImageToImageFilter< TImage, TImage >::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource< TImage >::OutputImageType
TImage OutputImageType
Definition: itkImageSource.h:90