ITK  5.4.0
Insight Toolkit
itkWarpImageFilter.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#ifndef itkWarpImageFilter_h
19#define itkWarpImageFilter_h
20#include "itkImageBase.h"
23
24namespace itk
25{
84template <typename TInputImage, typename TOutputImage, typename TDisplacementField>
85class ITK_TEMPLATE_EXPORT WarpImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
86{
87public:
88 ITK_DISALLOW_COPY_AND_MOVE(WarpImageFilter);
96
98 itkNewMacro(Self);
99
101 itkOverrideGetNameOfClassMacro(WarpImageFilter);
102
105
107 using typename Superclass::InputImageType;
108 using typename Superclass::InputImagePointer;
109 using typename Superclass::OutputImageType;
110 using typename Superclass::OutputImagePointer;
111 using typename Superclass::InputImageConstPointer;
115 using PixelType = typename OutputImageType::PixelType;
116 using PixelComponentType = typename OutputImageType::InternalPixelType;
117 using SpacingType = typename OutputImageType::SpacingType;
118
120 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
121 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
122 static constexpr unsigned int DisplacementFieldDimension = TDisplacementField::ImageDimension;
123
126
128 using DisplacementFieldType = TDisplacementField;
130 using DisplacementType = typename DisplacementFieldType::PixelType;
131
133 using CoordRepType = double;
137
140
143
144
147
150
152 itkSetObjectMacro(Interpolator, InterpolatorType);
153 itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
157 itkSetMacro(OutputSpacing, SpacingType);
158 virtual void
159 SetOutputSpacing(const double * spacing);
163 itkGetConstReferenceMacro(OutputSpacing, SpacingType);
164
166 itkSetMacro(OutputOrigin, PointType);
167 virtual void
168 SetOutputOrigin(const double * origin);
172 itkGetConstReferenceMacro(OutputOrigin, PointType);
173
175 itkSetMacro(OutputDirection, DirectionType);
176 itkGetConstReferenceMacro(OutputDirection, DirectionType);
180 void
182
185 itkSetMacro(OutputStartIndex, IndexType);
186
188 itkGetConstReferenceMacro(OutputStartIndex, IndexType);
189
191 itkSetMacro(OutputSize, SizeType);
192
194 itkGetConstReferenceMacro(OutputSize, SizeType);
195
197 itkSetMacro(EdgePaddingValue, PixelType);
198
200 itkGetConstMacro(EdgePaddingValue, PixelType);
201
207 void
209
216 void
218
221 void
223
226 void
228
229#ifdef ITK_USE_CONCEPT_CHECKING
230 // Begin concept checking
234 itkConceptMacro(DisplacementFieldHasNumericTraitsCheck,
236 // End concept checking
237#endif
238
239protected:
241 // ~WarpImageFilter() {} default implementation is ok
242
243 void
244 PrintSelf(std::ostream & os, Indent indent) const override;
245
249 void
250 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
251
252
259 void
260 VerifyInputInformation() ITKv5_CONST override;
261
270 void
271 EvaluateDisplacementAtPhysicalPoint(const PointType & point, DisplacementType & output);
272
276 void
277 EvaluateDisplacementAtPhysicalPoint(const PointType & point,
278 const DisplacementFieldType * fieldPtr,
279 DisplacementType & output);
280
281 bool m_DefFieldSameInformation{};
282 // variables for deffield interpolator
283 IndexType m_StartIndex, m_EndIndex{};
284
285private:
286 PixelType m_EdgePaddingValue{};
287 SpacingType m_OutputSpacing{};
288 PointType m_OutputOrigin{};
289 DirectionType m_OutputDirection{};
290
291 InterpolatorPointer m_Interpolator{};
292 SizeType m_OutputSize{}; // Size of the output image
293 IndexType m_OutputStartIndex{}; // output image start index
294};
295} // end namespace itk
296
297#ifndef ITK_MANUAL_INSTANTIATION
298# include "itkWarpImageFilter.hxx"
299#endif
300
301#endif
Base class for templated image classes.
Definition: itkImageBase.h:115
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for all image interpolators.
Linearly interpolate an image at specified positions.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Warps an image using an input displacement field.
void GenerateInputRequestedRegion() override
typename OutputImageType::SizeType SizeType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void GenerateOutputInformation() override
void BeforeThreadedGenerateData() override
TDisplacementField DisplacementFieldType
typename InterpolatorType::Pointer InterpolatorPointer
itkGetInputMacro(DisplacementField, DisplacementFieldType)
typename OutputImageType::SpacingType SpacingType
void VerifyInputInformation() ITKv5_CONST override
typename OutputImageType::IndexType IndexType
virtual void SetOutputSpacing(const double *spacing)
typename TOutputImage::DirectionType DirectionType
typename DisplacementFieldType::PixelType DisplacementType
virtual void SetOutputOrigin(const double *origin)
itkSetInputMacro(DisplacementField, DisplacementFieldType)
typename OutputImageType::InternalPixelType PixelComponentType
typename OutputImageType::IndexValueType IndexValueType
typename OutputImageType::PixelType PixelType
void SetOutputParametersFromImage(const ImageBaseType *image)
void PrintSelf(std::ostream &os, Indent indent) const override
typename DisplacementFieldType::Pointer DisplacementFieldPointer
void AfterThreadedGenerateData() override
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
long IndexValueType
Definition: itkIntTypes.h:90