ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkInPlaceImageFilter.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 itkInPlaceImageFilter_h
29#define itkInPlaceImageFilter_h
30
32#include <type_traits>
33
34namespace itk
35{
76template <typename TInputImage, typename TOutputImage = TInputImage>
77class ITK_TEMPLATE_EXPORT InPlaceImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
78{
79public:
80 ITK_DISALLOW_COPY_AND_MOVE(InPlaceImageFilter);
81
87
89 itkOverrideGetNameOfClassMacro(InPlaceImageFilter);
90
92 using typename Superclass::OutputImageType;
93 using typename Superclass::OutputImagePointer;
98 using InputImageType = TInputImage;
99 using InputImagePointer = typename InputImageType::Pointer;
100 using InputImageConstPointer = typename InputImageType::ConstPointer;
101 using InputImageRegionType = typename InputImageType::RegionType;
102 using InputImagePixelType = typename InputImageType::PixelType;
103
105 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
106 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
107
113 itkSetMacro(InPlace, bool);
114 itkGetConstMacro(InPlace, bool);
115 itkBooleanMacro(InPlace);
117
126 virtual bool
128
129protected:
131 ~InPlaceImageFilter() override = default;
132
133 void
134 PrintSelf(std::ostream & os, Indent indent) const override;
135
148 void
150 {
151 if (std::is_same_v<TInputImage, TOutputImage>)
152 {
154 }
155 else // the type are different we can't run in place
156 {
157 this->m_RunningInPlace = false;
159 }
160 }
161
162
172 void
173 ReleaseInputs() override;
174
179 itkGetConstMacro(RunningInPlace, bool);
180
181private:
182 void
184
185 bool m_InPlace{ true }; // enable the possibility of in-place
186 bool m_RunningInPlace{ false };
187};
188} // end namespace itk
189
190#ifndef ITK_MANUAL_INSTANTIATION
191# include "itkInPlaceImageFilter.hxx"
192#endif
193
194#endif
virtual void AllocateOutputs()
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
~InPlaceImageFilter() override=default
virtual bool CanRunInPlace() const
void PrintSelf(std::ostream &os, Indent indent) const override
typename InputImageType::ConstPointer InputImageConstPointer
void ReleaseInputs() override
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....