ITK  5.2.0
Insight Toolkit
itkBSplineDeformableTransform.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 itkBSplineDeformableTransform_h
19 #define itkBSplineDeformableTransform_h
20 
22 
23 namespace itk
24 {
112 template <typename TParametersValueType = double, unsigned int NDimensions = 3, unsigned int VSplineOrder = 3>
113 class ITK_TEMPLATE_EXPORT BSplineDeformableTransform
114  : public BSplineBaseTransform<TParametersValueType, NDimensions, VSplineOrder>
115 {
116 public:
117  ITK_DISALLOW_COPY_AND_MOVE(BSplineDeformableTransform);
118 
124 
126  // Explicit New() method, used here because we need to split the itkNewMacro()
127  // in order to overload the CreateAnother() method so that we can copy the m_BulkTransform
128  // explicitly.
129  // TODO: shouldn't it be done with the Clone() method?
130  itkSimpleNewMacro(Self);
132  CreateAnother() const override
133  {
135  Pointer copyPtr = Self::New().GetPointer();
136  // THE FOLLOWING LINE IS DIFFERENT FROM THE DEFAULT MACRO!
137  copyPtr->m_BulkTransform = this->GetBulkTransform();
138  smartPtr = static_cast<Pointer>(copyPtr);
139  return smartPtr;
140  }
142 
144  itkCloneMacro(Self);
145 
148 
150  static constexpr unsigned int SpaceDimension = NDimensions;
151 
153  static constexpr unsigned int SplineOrder = VSplineOrder;
154 
156  using ScalarType = TParametersValueType;
157 
159  using ParametersType = typename Superclass::ParametersType;
160  using ParametersValueType = typename Superclass::ParametersValueType;
161  using FixedParametersType = typename Superclass::FixedParametersType;
162  using FixedParametersValueType = typename Superclass::FixedParametersValueType;
163 
165  using JacobianType = typename Superclass::JacobianType;
166  using JacobianPositionType = typename Superclass::JacobianPositionType;
167  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
168 
170  using NumberOfParametersType = typename Superclass::NumberOfParametersType;
171 
173  using InputVectorType = typename Superclass::InputVectorType;
174  using OutputVectorType = typename Superclass::OutputVectorType;
175 
177  using InputCovariantVectorType = typename Superclass::InputCovariantVectorType;
178  using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType;
179 
181  using InputVnlVectorType = typename Superclass::InputVnlVectorType;
182  using OutputVnlVectorType = typename Superclass::OutputVnlVectorType;
183 
187 
188 
205  void
206  SetFixedParameters(const FixedParametersType & passedParameters) override;
208 
210  using ImageType = typename Superclass::ImageType;
211  using ImagePointer = typename Superclass::ImagePointer;
212  using CoefficientImageArray = typename Superclass::CoefficientImageArray;
213 
225  void
226  SetCoefficientImages(const CoefficientImageArray & images) override;
227 
230 
232  using SizeType = typename Superclass::SizeType;
233  using SpacingType = typename Superclass::SpacingType;
235  using OriginType = typename Superclass::OriginType;
236 
238  using WeightsFunctionType = typename Superclass::WeightsFunctionType;
239 
240  using WeightsType = typename Superclass::WeightsType;
241  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
242 
244  using ParameterIndexArrayType = typename Superclass::ParameterIndexArrayType;
245 
254  using Superclass::TransformPoint;
255  void
256  TransformPoint(const InputPointType & inputPoint,
257  OutputPointType & outputPoint,
258  WeightsType & weights,
259  ParameterIndexArrayType & indices,
260  bool & inside) const override;
262 
263  void
264  ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const override;
265 
268  GetNumberOfParameters() const override;
269 
272  GetNumberOfParametersPerDimension() const override;
273 
274  using PhysicalDimensionsType = typename Superclass::SpacingType;
275  using PixelType = typename Superclass::PixelType;
276 
277  using MeshSizeType = typename Superclass::MeshSizeType;
278 
280  virtual void
281  SetGridOrigin(const OriginType &);
282 
284  itkGetConstMacro(GridOrigin, OriginType);
285 
287  virtual void
288  SetGridSpacing(const SpacingType &);
289 
291  itkGetConstMacro(GridSpacing, SpacingType);
292 
294  virtual void
295  SetGridDirection(const DirectionType &);
296 
298  itkGetConstMacro(GridDirection, DirectionType);
299 
301  virtual void
302  SetGridRegion(const RegionType &);
303 
305  itkGetConstMacro(GridRegion, RegionType);
306 
312  itkSetConstObjectMacro(BulkTransform, BulkTransformType);
313  itkGetConstObjectMacro(BulkTransform, BulkTransformType);
315 
317  itkGetConstReferenceMacro(ValidRegion, RegionType);
318 
319 protected:
321  void
322  PrintSelf(std::ostream & os, Indent indent) const override;
323 
325  ~BSplineDeformableTransform() override = default;
326 
327 private:
329  void
330  SetFixedParametersGridSizeFromTransformDomainInformation() const override;
331 
333  void
334  SetFixedParametersGridOriginFromTransformDomainInformation() const override;
335 
337  void
338  SetFixedParametersGridSpacingFromTransformDomainInformation() const override;
339 
341  void
342  SetFixedParametersGridDirectionFromTransformDomainInformation() const override;
343 
345  void
346  SetCoefficientImageInformationFromFixedParameters() override;
347 
349  bool
350  InsideValidRegion(ContinuousIndexType &) const override;
351 
364 
367 
369 
371  unsigned long m_Offset;
375 
376  void
377  UpdateValidGridRegion();
378 
379 }; // class BSplineDeformableTransform
380 } // namespace itk
381 
382 #ifndef ITK_MANUAL_INSTANTIATION
383 # include "itkBSplineDeformableTransform.hxx"
384 #endif
385 
386 #endif /* itkBSplineDeformableTransform_h */
itk::BSplineInterpolationWeightFunction
Returns the weights over the support region used for B-spline interpolation/reconstruction.
Definition: itkBSplineInterpolationWeightFunction.h:47
itk::BSplineDeformableTransform::RegionType
typename Superclass::RegionType RegionType
Definition: itkBSplineDeformableTransform.h:229
itk::BSplineBaseTransform::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkBSplineBaseTransform.h:180
itk::BSplineDeformableTransform::m_GridDirection
const DirectionType & m_GridDirection
Definition: itkBSplineDeformableTransform.h:363
itk::BSplineDeformableTransform::CreateAnother
::itk::LightObject::Pointer CreateAnother() const override
Definition: itkBSplineDeformableTransform.h:132
itk::BSplineDeformableTransform
Deformable transform using a BSpline representation.
Definition: itkBSplineDeformableTransform.h:113
itk::BSplineBaseTransform::OutputVnlVectorType
vnl_vector_fixed< TParametersValueType, SpaceDimension > OutputVnlVectorType
Definition: itkBSplineBaseTransform.h:85
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itk::BSplineBaseTransform::NumberOfParametersType
typename Superclass::NumberOfParametersType NumberOfParametersType
Definition: itkBSplineBaseTransform.h:73
itk::BSplineBaseTransform::InverseJacobianPositionType
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
Definition: itkBSplineBaseTransform.h:67
itk::BSplineDeformableTransform::m_ValidRegionFirst
IndexType m_ValidRegionFirst
Definition: itkBSplineDeformableTransform.h:374
itk::BSplineBaseTransform::IndexType
typename RegionType::IndexType IndexType
Definition: itkBSplineBaseTransform.h:222
itk::BSplineBaseTransform::FixedParametersType
typename Superclass::FixedParametersType FixedParametersType
Definition: itkBSplineBaseTransform.h:61
itk::BSplineBaseTransform::WeightsType
typename WeightsFunctionType::WeightsType WeightsType
Definition: itkBSplineBaseTransform.h:235
itk::BSplineBaseTransform::JacobianPositionType
typename Superclass::JacobianPositionType JacobianPositionType
Definition: itkBSplineBaseTransform.h:66
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::BSplineDeformableTransform::m_BulkTransform
BulkTransformPointer m_BulkTransform
Definition: itkBSplineDeformableTransform.h:366
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::BSplineDeformableTransform::m_GridSpacing
const SpacingType & m_GridSpacing
Definition: itkBSplineDeformableTransform.h:362
itk::BSplineDeformableTransform::m_GridRegion
const RegionType & m_GridRegion
Definition: itkBSplineDeformableTransform.h:360
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::BSplineDeformableTransform::OriginType
typename Superclass::OriginType OriginType
Definition: itkBSplineDeformableTransform.h:235
itk::BSplineBaseTransform::InputVnlVectorType
vnl_vector_fixed< TParametersValueType, SpaceDimension > InputVnlVectorType
Definition: itkBSplineBaseTransform.h:84
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::BSplineBaseTransform::PixelType
typename ImageType::PixelType PixelType
Definition: itkBSplineBaseTransform.h:327
itk::BSplineBaseTransform::ScalarType
typename Superclass::ScalarType ScalarType
Definition: itkBSplineBaseTransform.h:58
itk::BSplineBaseTransform::MeshSizeType
SizeType MeshSizeType
Definition: itkBSplineBaseTransform.h:329
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::BSplineDeformableTransform::BulkTransformPointer
typename BulkTransformType::ConstPointer BulkTransformPointer
Definition: itkBSplineDeformableTransform.h:308
itk::BSplineBaseTransform::SizeType
typename RegionType::SizeType SizeType
Definition: itkBSplineBaseTransform.h:223
itk::SmartPointer::GetPointer
ObjectType * GetPointer() const noexcept
Definition: itkSmartPointer.h:132
itk::BSplineDeformableTransform::SpacingType
typename Superclass::SpacingType SpacingType
Definition: itkBSplineDeformableTransform.h:233
itk::BSplineBaseTransform::ContinuousIndexType
typename WeightsFunctionType::ContinuousIndexType ContinuousIndexType
Definition: itkBSplineBaseTransform.h:236
itk::BSplineDeformableTransform::m_SplineOrderOdd
bool m_SplineOrderOdd
Definition: itkBSplineDeformableTransform.h:372
itk::FixedArray< ImagePointer, NDimensions >
itk::BSplineBaseTransform::ParametersValueType
typename ParametersType::ValueType ParametersValueType
Definition: itkBSplineBaseTransform.h:178
itk::BSplineDeformableTransform::m_GridOrigin
const OriginType & m_GridOrigin
Definition: itkBSplineDeformableTransform.h:361
itk::BSplineDeformableTransform::DirectionType
typename Superclass::DirectionType DirectionType
Definition: itkBSplineDeformableTransform.h:234
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::BSplineDeformableTransform::m_Offset
unsigned long m_Offset
Definition: itkBSplineDeformableTransform.h:371
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkBSplineBaseTransform.h
itk::BSplineBaseTransform
A base class with common elements of BSplineTransform and BSplineDeformableTransform.
Definition: itkBSplineBaseTransform.h:34
itk::Array
Array class with size defined at construction time.
Definition: itkArray.h:47
itk::BSplineBaseTransform::ParametersType
typename Superclass::ParametersType ParametersType
Definition: itkBSplineBaseTransform.h:62
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::BSplineBaseTransform::PhysicalDimensionsType
typename ImageType::SpacingType PhysicalDimensionsType
Definition: itkBSplineBaseTransform.h:326
itk::BSplineDeformableTransform::m_ValidRegion
RegionType m_ValidRegion
Definition: itkBSplineDeformableTransform.h:368
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
itk::BSplineDeformableTransform::FixedParametersValueType
typename Superclass::FixedParametersValueType FixedParametersValueType
Definition: itkBSplineDeformableTransform.h:162
itk::BSplineBaseTransform::JacobianType
typename Superclass::JacobianType JacobianType
Definition: itkBSplineBaseTransform.h:65
itk::BSplineDeformableTransform::m_ValidRegionLast
IndexType m_ValidRegionLast
Definition: itkBSplineDeformableTransform.h:373