ITK
4.4.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ITK
Modules
Core
Common
include
itkNumericTraitsDiffusionTensor3DPixel.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 __itkNumericTraitsDiffusionTensor3DPixel_h
19
#define __itkNumericTraitsDiffusionTensor3DPixel_h
20
21
#include "
itkNumericTraits.h
"
22
#include "
itkDiffusionTensor3D.h
"
23
24
// This file is meant to define numeric traits for tensor pixels types in itk
25
26
namespace
itk
27
{
44
template
<
typename
T >
45
class
NumericTraits
<
DiffusionTensor3D
< T > >
46
{
47
private
:
48
49
typedef
typename
NumericTraits< T >::AbsType
ElementAbsType
;
50
typedef
typename
NumericTraits< T >::AccumulateType
ElementAccumulateType
;
51
typedef
typename
NumericTraits< T >::FloatType
ElementFloatType
;
52
typedef
typename
NumericTraits< T >::PrintType
ElementPrintType
;
53
typedef
typename
NumericTraits< T >::RealType
ElementRealType
;
54
55
public
:
56
58
typedef
T
ValueType
;
59
60
typedef
DiffusionTensor3D< T >
Self
;
61
63
typedef
DiffusionTensor3D< ElementAbsType >
AbsType
;
64
66
typedef
DiffusionTensor3D< ElementAccumulateType >
AccumulateType
;
67
70
typedef
DiffusionTensor3D< ElementFloatType >
FloatType
;
71
73
typedef
DiffusionTensor3D< ElementPrintType >
PrintType
;
74
76
typedef
DiffusionTensor3D< ElementRealType >
RealType
;
77
79
typedef
ElementRealType
ScalarRealType
;
80
82
typedef
Self
MeasurementVectorType
;
83
89
static
const
Self
max
(
const
Self
&)
90
{
91
return
Self
(
NumericTraits< T >::max
() );
92
}
93
94
static
const
Self
min
(
const
Self
&)
95
{
96
return
Self
(
NumericTraits< T >::min
() );
97
}
98
99
static
const
Self
NonpositiveMin
(
const
Self
&)
100
{
101
return
Self
(
NumericTraits< T >::NonpositiveMin
() );
102
}
103
104
static
const
Self
ZeroValue
(
const
Self
&)
105
{
106
return
Self
(
NumericTraits< T >::ZeroValue
() );
107
}
108
109
static
const
Self
OneValue
(
const
Self
&)
110
{
111
return
Self
(
NumericTraits< T >::OneValue
() );
112
}
113
114
static
const
Self
max
()
115
{
116
return
Self
(
NumericTraits< T >::max
() );
117
}
118
119
static
const
Self
min
()
120
{
121
return
Self
(
NumericTraits< T >::min
() );
122
}
123
124
static
const
Self
NonpositiveMin
()
125
{
126
return
Self
(
NumericTraits< T >::NonpositiveMin
() );
127
}
128
129
static
const
Self
ZeroValue
()
130
{
131
return
Self
(
NumericTraits< T >::ZeroValue
() );
132
}
133
134
static
const
Self
OneValue
()
135
{
136
return
Self
(
NumericTraits< T >::OneValue
() );
137
}
138
143
static
void
SetLength
(
DiffusionTensor3D< T >
& m,
const
unsigned
int
s)
144
{
145
if
( s != 6 )
146
{
147
itkGenericExceptionMacro(<<
"Cannot set the size of a DiffusionTensor3D "
148
"to anything other than 6."
);
149
}
150
m.
Fill
(
NumericTraits< T >::Zero
);
151
}
153
155
static
unsigned
int
GetLength
(
const
DiffusionTensor3D< T >
&)
156
{
157
return
6;
158
}
159
161
static
unsigned
int
GetLength
()
162
{
163
return
6;
164
}
165
166
static
void
AssignToArray
(
const
Self
& v,
MeasurementVectorType
& mv )
167
{
168
mv = v;
169
}
170
171
template
<
class
TArray>
172
static
void
AssignToArray
(
const
Self
& v, TArray & mv )
173
{
174
for
(
unsigned
int
i=0; i<6; i++ )
175
{
176
mv[i] = v[i];
177
}
178
}
179
183
static
const
Self
ITKCommon_EXPORT
Zero
;
184
static
const
Self
ITKCommon_EXPORT
One
;
185
};
186
}
// end namespace itk
187
188
#endif // __itkNumericTraitsTensorPixel_h
189
Generated on Mon May 13 2013 01:03:05 for ITK by
1.8.3.1