ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkBSplineDeformableTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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,
113  unsigned int NDimensions = 3,
114  unsigned int VSplineOrder = 3>
115 class ITK_TEMPLATE_EXPORT BSplineDeformableTransform :
116  public BSplineBaseTransform<TParametersValueType,NDimensions,VSplineOrder>
117 {
118 public:
119  ITK_DISALLOW_COPY_AND_ASSIGN(BSplineDeformableTransform);
120 
126 
128  // Explicit New() method, used here because we need to split the itkNewMacro()
129  // in order to overload the CreateAnother() method so that we can copy the m_BulkTransform
130  // explicitly.
131  // TODO: shouldn't it be done with the Clone() method?
132  itkSimpleNewMacro(Self);
134  {
136  Pointer copyPtr = Self::New().GetPointer();
137  //THE FOLLOWING LINE IS DIFFERENT FROM THE DEFAULT MACRO!
138  copyPtr->m_BulkTransform = this->GetBulkTransform();
139  smartPtr = static_cast<Pointer>( copyPtr );
140  return smartPtr;
141  }
143 
145  itkCloneMacro(Self);
146 
149 
151  static constexpr unsigned int SpaceDimension = NDimensions;
152 
154  static constexpr unsigned int SplineOrder = VSplineOrder;
155 
157  using ScalarType = TParametersValueType;
158 
160  using ParametersType = typename Superclass::ParametersType;
161  using ParametersValueType = typename Superclass::ParametersValueType;
162  using FixedParametersType = typename Superclass::FixedParametersType;
163  using FixedParametersValueType = typename Superclass::FixedParametersValueType;
164 
166  using JacobianType = typename Superclass::JacobianType;
167  using JacobianPositionType = typename Superclass::JacobianPositionType;
168  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
169 
171  using NumberOfParametersType = typename Superclass::NumberOfParametersType;
172 
174  using InputVectorType = typename Superclass::InputVectorType;
175  using OutputVectorType = typename Superclass::OutputVectorType;
176 
178  using InputCovariantVectorType = typename Superclass::InputCovariantVectorType;
179  using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType;
180 
182  using InputVnlVectorType = typename Superclass::InputVnlVectorType;
183  using OutputVnlVectorType = typename Superclass::OutputVnlVectorType;
184 
188 
189 
206  void SetFixedParameters( const FixedParametersType & parameters ) override;
208 
210  using ImageType = typename Superclass::ImageType;
211  using ImagePointer = typename Superclass::ImagePointer;
212  using CoefficientImageArray = typename Superclass::CoefficientImageArray;
213 
225  void SetCoefficientImages( const CoefficientImageArray & images ) override;
226 
229 
231  using SizeType = typename Superclass::SizeType;
232  using SpacingType = typename Superclass::SpacingType;
234  using OriginType = typename Superclass::OriginType;
235 
237  using WeightsFunctionType = typename Superclass::WeightsFunctionType;
238 
239  using WeightsType = typename Superclass::WeightsType;
240  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
241 
243  using ParameterIndexArrayType = typename Superclass::ParameterIndexArrayType;
244 
253  using Superclass::TransformPoint;
254  void TransformPoint( const InputPointType & inputPoint, OutputPointType & outputPoint,
255  WeightsType & weights, ParameterIndexArrayType & indices, bool & inside ) const override;
257 
258  void ComputeJacobianWithRespectToParameters( const InputPointType &, JacobianType & ) const override;
259 
261  NumberOfParametersType GetNumberOfParameters() const override;
262 
264  NumberOfParametersType GetNumberOfParametersPerDimension() const override;
265 
266  using PhysicalDimensionsType = typename Superclass::SpacingType;
267  using PixelType = typename Superclass::PixelType;
268 
269  using MeshSizeType = typename Superclass::MeshSizeType;
270 
272  virtual void SetGridOrigin( const OriginType & );
273 
275  itkGetConstMacro( GridOrigin, OriginType );
276 
278  virtual void SetGridSpacing( const SpacingType & );
279 
281  itkGetConstMacro( GridSpacing, SpacingType );
282 
284  virtual void SetGridDirection( const DirectionType & );
285 
287  itkGetConstMacro( GridDirection, DirectionType );
288 
290  virtual void SetGridRegion( const RegionType & );
291 
293  itkGetConstMacro( GridRegion, RegionType );
294 
295  using BulkTransformType = Transform<TParametersValueType,
296  Self::SpaceDimension,
297  Self::SpaceDimension>;
302  itkSetConstObjectMacro(BulkTransform, BulkTransformType);
303  itkGetConstObjectMacro(BulkTransform, BulkTransformType);
305 
307  itkGetConstReferenceMacro(ValidRegion, RegionType);
308 
309 protected:
311  void PrintSelf( std::ostream & os, Indent indent ) const override;
312 
314  ~BSplineDeformableTransform() override = default;
315 
316 private:
317 
319  void SetFixedParametersGridSizeFromTransformDomainInformation() const override;
320 
322  void SetFixedParametersGridOriginFromTransformDomainInformation() const override;
323 
325  void SetFixedParametersGridSpacingFromTransformDomainInformation() const override;
326 
328  void SetFixedParametersGridDirectionFromTransformDomainInformation() const override;
329 
331  void SetCoefficientImageInformationFromFixedParameters() override;
332 
334  bool InsideValidRegion( ContinuousIndexType & ) const override;
335 
348 
351 
353 
355  unsigned long m_Offset;
359 
360  void UpdateValidGridRegion();
361 
362 }; // class BSplineDeformableTransform
363 } // namespace itk
364 
365 #ifndef ITK_MANUAL_INSTANTIATION
366 #include "itkBSplineDeformableTransform.hxx"
367 #endif
368 
369 #endif /* itkBSplineDeformableTransform_h */
Array class with size defined at construction time.
Definition: itkArray.h:46
vnl_vector_fixed< TParametersValueType, SpaceDimension > OutputVnlVectorType
Light weight base class for most itk classes.
typename ImageType::PixelType PixelType
::itk::LightObject::Pointer CreateAnother() const override
typename ParametersType::ValueType ParametersValueType
typename Superclass::FixedParametersValueType FixedParametersValueType
typename Superclass::RegionType RegionType
ObjectType * GetPointer() const noexcept
typename Superclass::NumberOfParametersType NumberOfParametersType
typename Superclass::ParametersType ParametersType
typename Superclass::FixedParametersType FixedParametersType
typename ImageType::SpacingType PhysicalDimensionsType
typename BulkTransformType::ConstPointer BulkTransformPointer
typename WeightsFunctionType::ContinuousIndexType ContinuousIndexType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
typename Superclass::JacobianPositionType JacobianPositionType
typename Superclass::OriginType OriginType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
typename RegionType::IndexType IndexType
A base class with common elements of BSplineTransform and BSplineDeformableTransform.
typename WeightsFunctionType::WeightsType WeightsType
typename Superclass::SpacingType SpacingType
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
typename RegionType::SizeType SizeType
typename Superclass::JacobianType JacobianType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::DirectionType DirectionType
Deformable transform using a BSpline representation.
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
typename Superclass::ScalarType ScalarType
Returns the weights over the support region used for B-spline interpolation/reconstruction.
A templated class holding a n-Dimensional covariant vector.
vnl_vector_fixed< TParametersValueType, SpaceDimension > InputVnlVectorType
Templated n-dimensional image class.
Definition: itkImage.h:75
typename ImageType::Pointer ImagePointer