File: itkVectorFieldGradientImageFunction.h

package info (click to toggle)
ants 2.1.0-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,656 kB
  • sloc: cpp: 84,137; sh: 11,419; perl: 694; xml: 115; makefile: 74; python: 48
file content (273 lines) | stat: -rw-r--r-- 9,130 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*=========================================================================

  Program:   Advanced Normalization Tools
  Module:    $RCSfile: itkVectorFieldGradientImageFunction.h,v $
  Language:  C++
  Date:      $Date: 2008/11/15 23:46:06 $
  Version:   $Revision: 1.16 $

  Copyright (c) ConsortiumOfANTS. All rights reserved.
  See accompanying COPYING.txt or
 http://sourceforge.net/projects/advants/files/ANTS/ANTSCopyright.txt for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef __itkVectorFieldGradientImageFunction_h
#define __itkVectorFieldGradientImageFunction_h

#include "itkImageFunction.h"
#include "itkVariableSizeMatrix.h"

namespace itk
{
/** \class VectorFieldGradientImageFunction
 *
 */
template <typename TInputImage,
          typename TRealType = float,
          typename TOutput =
            itk::VariableSizeMatrix<TRealType>
          >
class VectorFieldGradientImageFunction :
  public         ImageFunction<TInputImage, TOutput>
{
public:
  /** Standard class typedefs. */
  typedef VectorFieldGradientImageFunction    Self;
  typedef ImageFunction<TInputImage, TOutput> Superclass;
  typedef SmartPointer<Self>                  Pointer;
  typedef SmartPointer<const Self>            ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro( Self );

  /** Run-time type information (and related methods) */
  itkTypeMacro( VectorFieldGradientImageFunction, ImageFunction );

  /** Extract some information from the image types.  Dimensionality
   * of the two images is assumed to be the same. */
  typedef TInputImage                        InputImageType;
  typedef typename InputImageType::PixelType VectorType;
  typedef TOutput                            MatrixType;

  /** Declare typedefs of superclass */
  typedef typename Superclass::PointType           PointType;
  typedef typename Superclass::IndexType           IndexType;
  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;

  /** The dimensionality of the input and output images. */
  itkStaticConstMacro( ImageDimension, unsigned int,
                       TInputImage::ImageDimension );

  /** Length of the vector pixel type of the input image. */
  itkStaticConstMacro( VectorDimension, unsigned int,
                       VectorType::Dimension );

  /** Define the data type and the vector of data type used in calculations. */
  typedef TRealType RealType;

  /**
   * Evaluate deformation gradient tensor
   */
  MatrixType EvaluateDeformationGradientTensor( const PointType & ) const;

  MatrixType EvaluateDeformationGradientTensorAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateDeformationGradientTensorAtContinuousIndex
    ( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateDeformationGradientTensor( point );
  }

  /**
   * Evaluate Jacobian
   */
  virtual MatrixType Evaluate( const PointType & point ) const ITK_OVERRIDE
  {
    return this->EvaluateJacobian( point );
  }

  virtual MatrixType EvaluateAtIndex( const IndexType & idx ) const ITK_OVERRIDE
  {
    return this->EvaluateJacobianAtIndex( idx );
  }

  virtual MatrixType EvaluateAtContinuousIndex( const ContinuousIndexType & idx ) const ITK_OVERRIDE
  {
    return this->EvaluateJacobianAtContinuousIndex( idx );
  }

  MatrixType EvaluateJacobian( const PointType & ) const;

  MatrixType EvaluateJacobianAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateJacobianAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateJacobian( point );
  }

  /**
   * Evaluate Jacobian determinant
   */
  RealType EvaluateJacobianDeterminant( const PointType & ) const;

  RealType EvaluateJacobianDeterminantAtIndex( const IndexType & idx ) const;

  RealType EvaluateJacobianDeterminantAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateJacobianDeterminant( point );
  }

  /**
   * Evaluate Lagrangian strain tensor
   */
  MatrixType EvaluateLagrangianStrainTensor( const PointType & ) const;

  MatrixType EvaluateLagrangianStrainTensorAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateLagrangianStrainTensorAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateLagrangianStrainTensor( point );
  }

  /**
   * Evaluate Lagrangian directional strain
   */
  RealType EvaluateLagrangianDirectionalStrain( const PointType &, const VectorType & ) const;

  RealType EvaluateLagrangianDirectionalStrainAtIndex( const IndexType & idx, const VectorType & V ) const;

  RealType EvaluateLagrangianDirectionalStrainAtContinuousIndex( const ContinuousIndexType & idx,
                                                                 const VectorType & V ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateLagrangianDirectionalStrain( point, V );
  }

  /**
   * Evaluate Eulerian strain tensor
   */
  MatrixType EvaluateEulerianStrainTensor( const PointType & ) const;

  MatrixType EvaluateEulerianStrainTensorAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateEulerianStrainTensorAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateEulerianStrainTensor( point );
  }

  /**
   * Evaluate Eulerian directional strain
   */
  RealType EvaluateEulerianDirectionalStrain( const PointType &, const VectorType & ) const;

  RealType EvaluateEulerianDirectionalStrainAtIndex( const IndexType & idx, const VectorType & V ) const;

  RealType EvaluateEulerianDirectionalStrainAtContinuousIndex( const ContinuousIndexType & idx,
                                                               const VectorType & V ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateEulerianDirectionalStrain( point, V );
  }

  /**
   * Evaluate Right Cauchy-Green strain tensor
   */
  MatrixType EvaluateRightCauchyGreenDeformationTensor( const PointType & ) const;

  MatrixType EvaluateRightCauchyGreenDeformationTensorAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateRightCauchyGreenDeformationTensorAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateRightCauchyGreenDeformationTensor( point );
  }

  /**
   * Evaluate Left Cauchy-Green strain tensor
   */
  MatrixType EvaluateLeftCauchyGreenDeformationTensor( const PointType & ) const;

  MatrixType EvaluateLeftCauchyGreenDeformationTensorAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateLeftCauchyGreenDeformationTensorAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateLeftCauchyGreenDeformationTensor( point );
  }

  /**
   * Evaluate left stretch tensor
   */
  MatrixType EvaluateLeftStretchTensor( const PointType & ) const;

  MatrixType EvaluateLeftStretchTensorAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateLeftStretchTensorAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateLeftStretchTensor( point );
  }

  /**
   * Evaluate right stretch tensor
   */
  MatrixType EvaluateRightStretchTensor( const PointType & ) const;

  MatrixType EvaluateRightStretchTensorAtIndex( const IndexType & idx ) const;

  MatrixType EvaluateRightStretchTensorAtContinuousIndex( const ContinuousIndexType & idx ) const
  {
    PointType point;

    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( idx, point );
    return this->EvaluateRightStretchTensor( point );
  }

protected:
  VectorFieldGradientImageFunction();
  virtual ~VectorFieldGradientImageFunction()
  {
  }

  void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;

private:
  VectorFieldGradientImageFunction(const Self &); // purposely not implemented
  MatrixType operator=(const Self &);             // purposely not implemented
};
} // end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#include "itkVectorFieldGradientImageFunction.hxx"
#endif

#endif