ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkInPlaceLabelMapFilter.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 /*=========================================================================
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_ASSIGN(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 CanRunInPlace() const
138  {
139  return true; // used to test if TInputImage == TOutputImage. But
140  // if you look above, the superclass declaration
141  // specifies
142  // LabelMapFilter<TInputImage,TOutputImage> so there's
143  // no way this couldn't be true.
144  }
145 
146 protected:
147  InPlaceLabelMapFilter() = default;
148  ~InPlaceLabelMapFilter() override = default;
149 
150  void PrintSelf(std::ostream & os, Indent indent) const override;
151 
164  void AllocateOutputs() override;
165 
171  {
172  return this->GetOutput();
173  }
174 
175 private:
176  bool m_InPlace{true};
177 };
178 } // end namespace itk
179 
180 #ifndef ITK_MANUAL_INSTANTIATION
181 #include "itkInPlaceLabelMapFilter.hxx"
182 #endif
183 
184 #endif
typename OutputImageType::Pointer OutputImagePointer
Light weight base class for most itk classes.
typename InputImageType::IndexType IndexType
InputImageType * GetLabelMap() override
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
Base class for filters that takes an image as input and overwrites that image as the output...
typename InputImageType::PixelType PixelType
Base class for filters that take an image as input and overwrite that image as the output...
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename InputImageType::LabelObjectType LabelObjectType
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::RegionType RegionType