File: itkDiffusionTensor3D.h

package info (click to toggle)
insighttoolkit5 5.4.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 704,384 kB
  • sloc: cpp: 783,592; ansic: 628,724; xml: 44,704; fortran: 34,250; python: 22,874; sh: 4,078; pascal: 2,636; lisp: 2,158; makefile: 464; yacc: 328; asm: 205; perl: 203; lex: 146; tcl: 132; javascript: 98; csh: 81
file content (179 lines) | stat: -rw-r--r-- 5,696 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
/*=========================================================================
 *
 *  Copyright NumFOCUS
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         https://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
#ifndef itkDiffusionTensor3D_h
#define itkDiffusionTensor3D_h

// Undefine an eventual DiffusionTensor3D macro
#ifdef DiffusionTensor3D
#  undef DiffusionTensor3D
#endif

#include "itkSymmetricSecondRankTensor.h"

namespace itk
{
/** \class DiffusionTensor3D
 * \brief Represent a diffusion tensor as used in DTI images.
 *
 * This class implements a 3D symmetric tensor as it is used for representing
 * diffusion of water molecules in Diffusion Tensor Images.
 *
 * This class derives from the SymmetricSecondRankTensor, inheriting
 * most of the Tensor-related behavior. At this level we add the methods that
 * are specific to 3D and that are closely related to the concept of diffusion.
 *
 *
 * \author Jeffrey Duda from School of Engineering at University of Pennsylvania
 * \author Torsten Rohlfing from SRI International Neuroscience Program.
 *
 * This class was mostly based on files that Jeffrey Duda, Torsten Rohlfing and
 * Martin Styner contributed to the ITK users list during a discussion on
 * support for DiffusionTensorImages. A discussion on the design of this class
 * can be found in the WIKI pages of NAMIC:
 *
 * https://www.na-mic.org/Wiki/index.php/NAMIC_Wiki:DTI:ITK-DiffusionTensorPixelType
 *
 * \note This work is part of the National Alliance for Medical Image
 * Computing (NAMIC), funded by the National Institutes of Health
 * through the NIH Roadmap for Medical Research, Grant U54 EB005149.
 * Information on the National Centers for Biomedical Computing
 * can be obtained from http://commonfund.nih.gov/bioinformatics.
 *
 *
 * \note Contributions by Torsten Rohlfing were funded by the following NIH grants
 *
 * Alcohol, HIV and the Brain,
 * NIAAA AA12999, PI: A. Pfefferbaum
 *
 * Normal Aging of Brain Structure and Function
 * NIA AG 17919, PI: E.V. Sullivan.
 *
 *
 * \par References
 * E. R. Melhem, S. Mori, G. Mukundan, M. A. Kraut, M. G. Pomper, and
 * P. C. M. van Zijl, "Diffusion tensor MR imaging of the brain and white
 * matter tractography," Am. J. Roentgenol., vol. 178, pp. 3-16, 2002.
 *
 * \sa SymmetricSecondRankTensor
 *
 * \ingroup ImageObjects   TensorObjects    Geometry
 * \ingroup ITKCommon
 */

template <typename TComponent>
class ITK_TEMPLATE_EXPORT DiffusionTensor3D : public SymmetricSecondRankTensor<TComponent, 3>
{
public:
  /** Standard class type aliases. */
  using Self = DiffusionTensor3D;
  using Superclass = SymmetricSecondRankTensor<TComponent, 3>;

  /** Propagating some type alias from the superclass */
  using typename Superclass::ValueType;
  using typename Superclass::ComponentType;
  using typename Superclass::ComponentArrayType;

  using typename Superclass::AccumulateValueType;
  using typename Superclass::RealValueType;

  using typename Superclass::EigenValuesArrayType;
  using typename Superclass::EigenVectorsMatrixType;

  /** Default Constructor. */
  DiffusionTensor3D() = default;

  /** Constructor with initialization. */
  DiffusionTensor3D(const Superclass & r);
  DiffusionTensor3D(const ComponentType & r);
  DiffusionTensor3D(const ComponentArrayType r);

  /** Constructor to enable casting...  */
  template <typename TCoordRepB>
  DiffusionTensor3D(const DiffusionTensor3D<TCoordRepB> & pa)
    : SymmetricSecondRankTensor<TComponent, 3>(pa)
  {}

  /** Pass-through assignment operator for the Array base class. */
  Self &
  operator=(const Superclass & r);

  Self &
  operator=(const ComponentType & r);

  Self &
  operator=(const ComponentArrayType r);

  /** Templated Pass-through assignment for the Array base class. */
  template <typename TCoordRepB>
  Self &
  operator=(const DiffusionTensor3D<TCoordRepB> & pa)
  {
    // NOTE (this != &pa ) because they are different pointer types
    // if this templated function is called
    // ComponentType 'itk::DiffusionTensor3D<double> *'
    // TCoordRepB   'const DiffusionTensor3D<float> *')
    SymmetricSecondRankTensor<TComponent, 3>::operator=(pa);
    return *this;
  }

  /** Get the trace value.
   *
   * Note that the indices are related to the fact
   * that we store only the upper-right triangle of
   * the matrix. Like
   *
   *       | 0  1  2  |
   *       | X  3  4  |
   *       | X  X  5  |
   *
   * The trace is therefore the sum of the components
   * M[0], M[3] and M[5].
   *
   */
  AccumulateValueType
  GetTrace() const;

  /** Get the value of Fractional Anisotropy from the Tensor. */
  RealValueType
  GetFractionalAnisotropy() const;

  /** Get the value of Relative Anisotropy from the Tensor. */
  RealValueType
  GetRelativeAnisotropy() const;

  /** Get the inner scalar product from the Tensor. */
  RealValueType
  GetInnerScalarProduct() const;
};


template <typename T>
inline void
swap(DiffusionTensor3D<T> & a, DiffusionTensor3D<T> & b)
{
  a.swap(b);
}

} // end namespace itk
#include "itkNumericTraitsDiffusionTensor3DPixel.h"

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

#endif