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 {
83 template <typename TInputImage>
84 class ITK_TEMPLATE_EXPORT InPlaceLabelMapFilter : public LabelMapFilter<TInputImage, TInputImage>
85 {
86 public:
87  ITK_DISALLOW_COPY_AND_ASSIGN(InPlaceLabelMapFilter);
88 
94 
97 
99  itkNewMacro(Self);
100 
102  using OutputImageType = typename Superclass::OutputImageType;
103  using OutputImagePointer = typename Superclass::OutputImagePointer;
104  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
105  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
106 
108  using InputImageType = TInputImage;
109  using InputImagePointer = typename InputImageType::Pointer;
110  using InputImageConstPointer = typename InputImageType::ConstPointer;
112  using InputImagePixelType = typename InputImageType::PixelType;
113  using LabelObjectType = typename InputImageType::LabelObjectType;
114 
115  using PixelType = typename InputImageType::PixelType;
118 
119  using TOutputImage = TInputImage;
120 
122  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
123  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
124 
127  itkSetMacro(InPlace, bool);
128  itkGetMacro(InPlace, bool);
129  itkBooleanMacro(InPlace);
131 
138  bool
140  {
141  return true; // used to test if TInputImage == TOutputImage. But
142  // if you look above, the superclass declaration
143  // specifies
144  // LabelMapFilter<TInputImage,TOutputImage> so there's
145  // no way this couldn't be true.
146  }
147 
148 protected:
149  InPlaceLabelMapFilter() = default;
150  ~InPlaceLabelMapFilter() override = default;
151 
152  void
153  PrintSelf(std::ostream & os, Indent indent) const override;
154 
167  void
168  AllocateOutputs() override;
169 
174  InputImageType *
175  GetLabelMap() override
176  {
177  return this->GetOutput();
178  }
179 
180 private:
181  bool m_InPlace{ true };
182 };
183 } // end namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 # include "itkInPlaceLabelMapFilter.hxx"
187 #endif
188 
189 #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:84
itk::InPlaceLabelMapFilter< TImage >::LabelObjectType
typename InputImageType::LabelObjectType LabelObjectType
Definition: itkInPlaceLabelMapFilter.h:113
itk::InPlaceLabelMapFilter< TImage >::TOutputImage
TImage TOutputImage
Definition: itkInPlaceLabelMapFilter.h:119
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::InPlaceLabelMapFilter::CanRunInPlace
bool CanRunInPlace() const
Definition: itkInPlaceLabelMapFilter.h:139
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:58
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::InPlaceLabelMapFilter::GetLabelMap
InputImageType * GetLabelMap() override
Definition: itkInPlaceLabelMapFilter.h:175
itk::ImageToImageFilter< TImage, TImage >::InputImageType
TImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::InPlaceLabelMapFilter< TImage >::RegionType
typename InputImageType::RegionType RegionType
Definition: itkInPlaceLabelMapFilter.h:117
itk::ImageSource< TImage >::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::InPlaceLabelMapFilter< TImage >::PixelType
typename InputImageType::PixelType PixelType
Definition: itkInPlaceLabelMapFilter.h:115
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:116
itk::ImageToImageFilter< TImage, TImage >::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource< TImage >::OutputImageType
TImage OutputImageType
Definition: itkImageSource.h:90