NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkFluidDeformableTransform.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkFluidDeformableTransform_h
16 #define itkFluidDeformableTransform_h
17 
18 #include "itkDeformableTransform.h"
19 #include <itkImage.h>
20 #include <itkVector.h>
21 
22 
23 namespace itk
24 {
25 
30 template <
31  class TFixedImage, // Templated over the image type.
32  class TScalarType, // Data type for scalars
33  unsigned int NDimensions, // Number of Dimensions i.e. 2D or 3D
34  class TDeformationScalar> // Data type in the deformation field.
35 class ITK_EXPORT FluidDeformableTransform :
36 public DeformableTransform< TFixedImage, TScalarType, NDimensions, TDeformationScalar >
37 {
38 public:
39 
43  typedef SmartPointer<Self> Pointer;
44  typedef SmartPointer<const Self> ConstPointer;
45 
47  itkNewMacro( Self );
48 
51 
53  itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
54 
56  typedef typename Superclass::ScalarType ScalarType;
57 
59  typedef typename Superclass::ParametersType ParametersType;
60 
63 
67 
69  typedef typename Superclass::DeformationFieldPixelType DeformationFieldPixelType;
70  typedef typename Superclass::DeformationFieldType DeformationFieldType;
71 
73  typedef TFixedImage FixedImageType;
74  typedef typename TFixedImage::ConstPointer FixedImagePointer;
75 
79  typedef typename Superclass::VectorFieldImageType DeformableParameterType;
80  typedef typename DeformableParameterType::Pointer DeformableParameterPointerType;
81 
87  virtual void Initialize(FixedImagePointer fixedImage);
88 
94  virtual void SetIdentity();
95 
100  virtual void SetParameters(const ParametersType & parameters)
101  {
102  niftkitkDebugMacro(<< "FluidDeformableTransform: set parameter does nothing");
103  }
104 
109  virtual void SetDeformableParameters(DeformableParameterPointerType parameters);
110 
114  virtual DeformableParameterPointerType GetDeformableParameters() { return this->m_DeformationField; }
115 
119  virtual void InterpolateNextGrid(FixedImagePointer image);
120 
125  virtual bool IsRegridable() const { return true; }
126 
131  virtual void UpdateRegriddedDeformationParameters(DeformableParameterPointerType regriddedParameters, DeformableParameterPointerType currentPosition, double factor);
132 
136  static DeformableParameterPointerType DuplicateDeformableParameters(const DeformableParameterType* deformableParameters);
137 
141  virtual bool IsIdentity();
142 
146  void InvertUsingGradientDescent(typename Self::Pointer invertedTransform, unsigned int maxIteration, double tol);
147 
151  void ComputeSquareRoot(typename Self::Pointer sqrtTransform, unsigned int maxInverseIteration, unsigned int maxIteration, double tol);
152 
153 protected:
154 
156  virtual ~FluidDeformableTransform();
157 
159  void PrintSelf(std::ostream &os, Indent indent) const;
160 
162  virtual typename Superclass::JacobianDeterminantFilterType::OutputImageRegionType GetValidJacobianRegion() const
163  {
164  typename Superclass::JacobianDeterminantFilterType::OutputImageRegionType region = this->m_JacobianFilter->GetOutput()->GetLargestPossibleRegion();
165 
166  for (unsigned int i = 0; i < NDimensions; i++)
167  {
168  region.SetIndex(i, 2);
169  region.SetSize(i, region.GetSize(i)-4);
170  }
171  return region;
172  }
173 
174 
175 
176 
177 private:
178 
179  FluidDeformableTransform(const Self&); //purposely not implemented
180  void operator=(const Self&); //purposely not implemented
181 
182 };
183 
184 } // namespace itk.
185 
186 #ifndef ITK_MANUAL_INSTANTIATION
187 #include "itkFluidDeformableTransform.txx"
188 #endif
189 
190 
191 #endif /*ITKFLUIDDEFORMABLETRANSFORM_H_*/
SmartPointer< Self > Pointer
Definition: itkFluidDeformableTransform.h:43
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
Base class for deformable transforms.
Definition: itkDeformableTransform.h:69
Definition: niftkITKAffineResampleImage.cxx:74
virtual bool IsRegridable() const
Definition: itkFluidDeformableTransform.h:125
itk::Point< double, 2 > InputPointType
Definition: EulerAffine2DJacobianTest.cxx:34
#define niftkitkDebugMacro(x)
Definition: itkUCLMacro.h:29
Superclass::OutputPointType OutputPointType
Definition: itkFluidDeformableTransform.h:65
virtual Superclass::JacobianDeterminantFilterType::OutputImageRegionType GetValidJacobianRegion() const
Definition: itkFluidDeformableTransform.h:162
Superclass::ScalarType ScalarType
Definition: itkFluidDeformableTransform.h:56
SmartPointer< const Self > ConstPointer
Definition: itkFluidDeformableTransform.h:44
FluidDeformableTransform Self
Definition: itkFluidDeformableTransform.h:41
Superclass::InputPointType InputPointType
Definition: itkFluidDeformableTransform.h:66
virtual DeformableParameterPointerType GetDeformableParameters()
Definition: itkFluidDeformableTransform.h:114
Superclass::DeformationFieldPixelType DeformationFieldPixelType
Definition: itkFluidDeformableTransform.h:69
DeformableTransform< TFixedImage, TScalarType, NDimensions, TDeformationScalar > Superclass
Definition: itkFluidDeformableTransform.h:42
virtual void SetParameters(const ParametersType &parameters)
Definition: itkFluidDeformableTransform.h:100
Superclass::JacobianType JacobianType
Definition: itkFluidDeformableTransform.h:62
Deformable transform using a fluid representation.
Definition: itkFluidDeformableTransform.h:35
Superclass::DeformationFieldType DeformationFieldType
Definition: itkFluidDeformableTransform.h:70
DeformableParameterType::Pointer DeformableParameterPointerType
Definition: itkFluidDeformableTransform.h:80
itk::Point< double, 2 > OutputPointType
Definition: EulerAffine2DJacobianTest.cxx:35
TFixedImage FixedImageType
Definition: itkFluidDeformableTransform.h:73
Superclass::VectorFieldImageType DeformableParameterType
Definition: itkFluidDeformableTransform.h:79
itk::Array2D< double > JacobianType
Definition: EulerAffine2DJacobianTest.cxx:28
TFixedImage::ConstPointer FixedImagePointer
Definition: itkFluidDeformableTransform.h:74
Superclass::ParametersType ParametersType
Definition: itkFluidDeformableTransform.h:59