ITK  5.2.0
Insight Toolkit
itkTransformToDisplacementFieldFilter.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 #ifndef itkTransformToDisplacementFieldFilter_h
19 #define itkTransformToDisplacementFieldFilter_h
20 
21 #include "itkDataObjectDecorator.h"
22 #include "itkTransform.h"
23 #include "itkImageSource.h"
24 
25 namespace itk
26 {
54 template <typename TOutputImage, typename TParametersValueType = double>
55 class ITK_TEMPLATE_EXPORT TransformToDisplacementFieldFilter : public ImageSource<TOutputImage>
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_MOVE(TransformToDisplacementFieldFilter);
59 
65 
66  using OutputImageType = TOutputImage;
68 
70  itkNewMacro(Self);
71 
74 
76  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
77 
81 
83  using PixelType = typename OutputImageType::PixelType;
84  using PixelValueType = typename PixelType::ValueType;
86  using SizeType = typename RegionType::SizeType;
89  using SpacingType = typename OutputImageType::SpacingType;
92 
95 
100  using Superclass::SetInput;
101  virtual void
102  SetInput(const TransformInputType * input);
103  const TransformInputType *
104  GetInput() const;
105  itkSetGetDecoratedObjectInputMacro(Transform, TransformType);
107 
110  itkSetMacro(OutputStartIndex, IndexType);
111  itkGetConstReferenceMacro(OutputStartIndex, IndexType);
113 
115  itkSetMacro(Size, SizeType);
116  itkGetConstReferenceMacro(Size, SizeType);
118 
120  itkSetMacro(OutputSpacing, SpacingType);
121  virtual void
122  SetOutputSpacing(const SpacePrecisionType * spacing);
124 
126  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
127 
129  itkSetMacro(OutputOrigin, OriginType);
130  virtual void
131  SetOutputOrigin(const SpacePrecisionType * origin);
133 
135  itkGetConstReferenceMacro(OutputOrigin, OriginType);
136 
138  itkSetMacro(OutputDirection, DirectionType);
139  itkGetConstReferenceMacro(OutputDirection, DirectionType);
141 
148  itkSetInputMacro(ReferenceImage, ReferenceImageBaseType);
149 
151  itkGetInputMacro(ReferenceImage, ReferenceImageBaseType);
152 
155  itkSetMacro(UseReferenceImage, bool);
156  itkBooleanMacro(UseReferenceImage);
157  itkGetConstMacro(UseReferenceImage, bool);
159 
160 #ifdef ITK_USE_CONCEPT_CHECKING
161  // Begin concept checking
162  static constexpr unsigned int PixelDimension = PixelType::Dimension;
164  // End concept checking
165 #endif
166 
167 protected:
169  ~TransformToDisplacementFieldFilter() override = default;
170 
172  void
173  GenerateOutputInformation() override;
174 
176  void
177  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
178 
179 
183  void
184  NonlinearThreadedGenerateData(const OutputImageRegionType & outputRegionForThread);
185 
189  void
190  LinearThreadedGenerateData(const OutputImageRegionType & outputRegionForThread);
191 
192  void
193  PrintSelf(std::ostream & os, Indent indent) const override;
194 
195 private:
197  SizeType m_Size; // size of the output region
198  IndexType m_OutputStartIndex; // start index of the output region
199  SpacingType m_OutputSpacing; // output image spacing
200  OriginType m_OutputOrigin; // output image origin
201  DirectionType m_OutputDirection; // output image direction cosines
202  bool m_UseReferenceImage{ false };
203 };
204 } // end namespace itk
205 
206 #ifndef ITK_MANUAL_INSTANTIATION
207 # include "itkTransformToDisplacementFieldFilter.hxx"
208 #endif
209 
210 #endif
itk::TransformToDisplacementFieldFilter::PixelType
typename OutputImageType::PixelType PixelType
Definition: itkTransformToDisplacementFieldFilter.h:83
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itk::TransformToDisplacementFieldFilter::RegionType
typename OutputImageType::RegionType RegionType
Definition: itkTransformToDisplacementFieldFilter.h:85
itkImageSource.h
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
itk::TransformToDisplacementFieldFilter::m_OutputDirection
DirectionType m_OutputDirection
Definition: itkTransformToDisplacementFieldFilter.h:201
itk::ImageBase
Base class for templated image classes.
Definition: itkImageBase.h:105
itk::TransformToDisplacementFieldFilter::PointType
typename OutputImageType::PointType PointType
Definition: itkTransformToDisplacementFieldFilter.h:88
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
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
itk::TransformToDisplacementFieldFilter
Generate a displacement field from a coordinate transform.
Definition: itkTransformToDisplacementFieldFilter.h:55
itk::DataObjectDecorator
Decorates any subclass of itkObject with a DataObject API.
Definition: itkDataObjectDecorator.h:66
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::TransformToDisplacementFieldFilter::PixelValueType
typename PixelType::ValueType PixelValueType
Definition: itkTransformToDisplacementFieldFilter.h:84
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::TransformToDisplacementFieldFilter::DirectionType
typename OutputImageType::DirectionType DirectionType
Definition: itkTransformToDisplacementFieldFilter.h:91
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::TransformToDisplacementFieldFilter::m_OutputSpacing
SpacingType m_OutputSpacing
Definition: itkTransformToDisplacementFieldFilter.h:199
itk::TransformToDisplacementFieldFilter::m_Size
SizeType m_Size
Definition: itkTransformToDisplacementFieldFilter.h:197
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkDataObjectDecorator.h
itk::SpacePrecisionType
double SpacePrecisionType
Definition: itkFloatTypes.h:30
itk::TransformToDisplacementFieldFilter::m_OutputOrigin
OriginType m_OutputOrigin
Definition: itkTransformToDisplacementFieldFilter.h:200
itk::TransformToDisplacementFieldFilter::SpacingType
typename OutputImageType::SpacingType SpacingType
Definition: itkTransformToDisplacementFieldFilter.h:89
itk::TransformToDisplacementFieldFilter::IndexType
typename OutputImageType::IndexType IndexType
Definition: itkTransformToDisplacementFieldFilter.h:87
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::TransformToDisplacementFieldFilter::OriginType
typename OutputImageType::PointType OriginType
Definition: itkTransformToDisplacementFieldFilter.h:90
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::TransformToDisplacementFieldFilter::m_OutputStartIndex
IndexType m_OutputStartIndex
Definition: itkTransformToDisplacementFieldFilter.h:198
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
itkTransform.h
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::TransformToDisplacementFieldFilter::SizeType
typename RegionType::SizeType SizeType
Definition: itkTransformToDisplacementFieldFilter.h:86
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90