ITK  6.0.0
Insight Toolkit
itkWarpVectorImageFilter.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 itkWarpVectorImageFilter_h
19 #define itkWarpVectorImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 #include "itkPoint.h"
24 #include "itkFixedArray.h"
25 
26 namespace itk
27 {
88 template <typename TInputImage, typename TOutputImage, typename TDisplacementField>
89 class ITK_TEMPLATE_EXPORT WarpVectorImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
90 {
91 public:
92  ITK_DISALLOW_COPY_AND_MOVE(WarpVectorImageFilter);
93 
99 
101  itkNewMacro(Self);
102 
104  itkOverrideGetNameOfClassMacro(WarpVectorImageFilter);
105 
108 
110  using typename Superclass::InputImageType;
111  using typename Superclass::InputImagePointer;
112  using typename Superclass::OutputImageType;
113  using typename Superclass::OutputImagePointer;
114  using typename Superclass::InputImageConstPointer;
115 
118  using PixelType = typename OutputImageType::PixelType;
119  using SpacingType = typename OutputImageType::SpacingType;
120  using ValueType = typename OutputImageType::PixelType::ValueType;
121 
123  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
124 
126  static constexpr unsigned int PixelDimension = PixelType::Dimension;
127 
129  using DisplacementFieldType = TDisplacementField;
131  using DisplacementType = typename DisplacementFieldType::PixelType;
132 
134  using CoordinateType = double;
135 #ifndef ITK_FUTURE_LEGACY_REMOVE
136  using CoordRepType ITK_FUTURE_DEPRECATED(
137  "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
138 #endif
142 
145 
148 
150  void
151  SetDisplacementField(const DisplacementFieldType * field);
152 
154  void
155  SetDisplacementField(DisplacementFieldType * field);
156 
159  GetDisplacementField();
160 
162  itkSetObjectMacro(Interpolator, InterpolatorType);
163  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
167  itkSetMacro(OutputSpacing, SpacingType);
168  virtual void
169  SetOutputSpacing(const double * spacing);
173  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
174 
176  itkSetMacro(OutputOrigin, PointType);
177  virtual void
178  SetOutputOrigin(const double * origin);
182  itkGetConstReferenceMacro(OutputOrigin, PointType);
183 
185  itkSetMacro(OutputDirection, DirectionType);
186  itkGetConstReferenceMacro(OutputDirection, DirectionType);
190  itkSetMacro(EdgePaddingValue, PixelType);
191 
193  itkGetConstMacro(EdgePaddingValue, PixelType);
194 
200  void
201  GenerateOutputInformation() override;
202 
209  void
210  GenerateInputRequestedRegion() override;
211 
214  void
215  BeforeThreadedGenerateData() override;
216 
217 #ifdef ITK_USE_CONCEPT_CHECKING
218  // Begin concept checking
220  itkConceptMacro(OutputHasNumericTraitsCheck, (Concept::HasNumericTraits<ValueType>));
221  itkConceptMacro(DisplacementFieldHasNumericTraitsCheck,
223  // End concept checking
224 #endif
225 
226 protected:
228  ~WarpVectorImageFilter() override = default;
229  void
230  PrintSelf(std::ostream & os, Indent indent) const override;
231 
235  void
236  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
237 
238 
239 private:
240  PixelType m_EdgePaddingValue{};
241  SpacingType m_OutputSpacing{};
242  PointType m_OutputOrigin{};
243  DirectionType m_OutputDirection{};
244 
245  InterpolatorPointer m_Interpolator{};
246 };
247 } // end namespace itk
248 
249 #ifndef ITK_MANUAL_INSTANTIATION
250 # include "itkWarpVectorImageFilter.hxx"
251 #endif
252 
253 #endif
itk::WarpVectorImageFilter::DisplacementType
typename DisplacementFieldType::PixelType DisplacementType
Definition: itkWarpVectorImageFilter.h:131
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:717
itkPoint.h
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkVectorLinearInterpolateImageFunction.h
itk::VectorInterpolateImageFunction
Base class for all vector image interpolators.
Definition: itkVectorInterpolateImageFunction.h:47
itk::WarpVectorImageFilter::DirectionType
typename TOutputImage::DirectionType DirectionType
Definition: itkWarpVectorImageFilter.h:147
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::WarpVectorImageFilter::DisplacementFieldType
TDisplacementField DisplacementFieldType
Definition: itkWarpVectorImageFilter.h:129
itk::WarpVectorImageFilter::ValueType
typename OutputImageType::PixelType::ValueType ValueType
Definition: itkWarpVectorImageFilter.h:120
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkFixedArray.h
itkImageToImageFilter.h
itk::WarpVectorImageFilter::IndexType
typename OutputImageType::IndexType IndexType
Definition: itkWarpVectorImageFilter.h:116
itk::WarpVectorImageFilter::PixelType
typename OutputImageType::PixelType PixelType
Definition: itkWarpVectorImageFilter.h:118
itk::WarpVectorImageFilter
Warps an image using an input displacement field.
Definition: itkWarpVectorImageFilter.h:89
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::WarpVectorImageFilter::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkWarpVectorImageFilter.h:140
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::WarpVectorImageFilter::CoordinateType
double CoordinateType
Definition: itkWarpVectorImageFilter.h:134
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::WarpVectorImageFilter::SizeType
typename OutputImageType::SizeType SizeType
Definition: itkWarpVectorImageFilter.h:117
itk::Point< CoordinateType, Self::ImageDimension >
itk::WarpVectorImageFilter::SpacingType
typename OutputImageType::SpacingType SpacingType
Definition: itkWarpVectorImageFilter.h:119
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::VectorLinearInterpolateImageFunction
Linearly interpolate a vector image at specified positions.
Definition: itkVectorLinearInterpolateImageFunction.h:43
itk::WarpVectorImageFilter::DisplacementFieldPointer
typename DisplacementFieldType::Pointer DisplacementFieldPointer
Definition: itkWarpVectorImageFilter.h:130