ITK
4.2.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ITK
Modules
Core
Common
include
itkNumericTraitsTensorPixel.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 __itkNumericTraitsTensorPixel_h
19
#define __itkNumericTraitsTensorPixel_h
20
21
#include "
itkNumericTraits.h
"
22
#include "
itkSymmetricSecondRankTensor.h
"
23
24
namespace
itk
25
{
43
template
<
typename
T,
unsigned
int
D >
44
class
NumericTraits
<
SymmetricSecondRankTensor
< T, D > >
45
{
46
private
:
47
48
typedef
typename
NumericTraits< T >::AbsType
ElementAbsType
;
49
typedef
typename
NumericTraits< T >::AccumulateType
ElementAccumulateType
;
50
typedef
typename
NumericTraits< T >::FloatType
ElementFloatType
;
51
typedef
typename
NumericTraits< T >::PrintType
ElementPrintType
;
52
typedef
typename
NumericTraits< T >::RealType
ElementRealType
;
53
public
:
54
56
typedef
T
ValueType
;
57
58
typedef
SymmetricSecondRankTensor< T, D >
Self
;
59
61
typedef
SymmetricSecondRankTensor< ElementAbsType, D >
AbsType
;
62
64
typedef
SymmetricSecondRankTensor< ElementAccumulateType, D >
AccumulateType
;
65
68
typedef
SymmetricSecondRankTensor< ElementFloatType, D >
FloatType
;
69
71
typedef
SymmetricSecondRankTensor< ElementPrintType, D >
PrintType
;
72
74
typedef
SymmetricSecondRankTensor< ElementRealType, D >
RealType
;
75
77
typedef
ElementRealType
ScalarRealType
;
78
80
typedef
Self
MeasurementVectorType
;
81
87
static
const
Self
max
(
const
Self
&)
88
{
89
return
Self
(
NumericTraits< T >::max
() );
90
}
91
92
static
const
Self
min
(
const
Self
&)
93
{
94
return
Self
(
NumericTraits< T >::min
() );
95
}
96
97
static
const
Self
max
()
98
{
99
return
Self
(
NumericTraits< T >::max
() );
100
}
101
102
static
const
Self
min
()
103
{
104
return
Self
(
NumericTraits< T >::min
() );
105
}
106
107
static
const
Self
NonpositiveMin
()
108
{
109
return
Self
(
NumericTraits< T >::NonpositiveMin
() );
110
}
111
112
static
const
Self
ZeroValue
()
113
{
114
return
Self
(
NumericTraits< T >::ZeroValue
() );
115
}
116
117
static
const
Self
OneValue
()
118
{
119
return
Self
(
NumericTraits< T >::OneValue
() );
120
}
121
122
static
const
Self
NonpositiveMin
(
const
Self
&)
123
{
124
return
NonpositiveMin
();
125
}
126
127
static
const
Self
ZeroValue
(
const
Self
&)
128
{
129
return
ZeroValue
();
130
}
131
132
static
const
Self
OneValue
(
const
Self
&)
133
{
134
return
OneValue
();
135
}
136
141
static
void
SetLength
(
SymmetricSecondRankTensor< T, D >
& m,
const
unsigned
int
s)
142
{
143
if
( s != D *( D + 1 ) / 2 )
144
{
145
itkGenericExceptionMacro(<<
"Cannot set the size of a SymmetricSecondRankTensor "
146
"of dimension "
<< D <<
" ( = size of "
147
<< D *( D + 1 ) / 2 <<
") to "
<< s);
148
}
149
m.
Fill
(
NumericTraits< T >::Zero
);
150
}
152
154
static
unsigned
int
GetLength
(
const
SymmetricSecondRankTensor< T, D >
&)
155
{
156
return
GetLength
();
157
}
158
160
static
unsigned
int
GetLength
()
161
{
162
return
D *( D + 1 ) / 2;
163
}
164
165
static
void
AssignToArray
(
const
Self
& v,
MeasurementVectorType
& mv )
166
{
167
mv = v;
168
}
169
170
template
<
class
TArray>
171
static
void
AssignToArray
(
const
Self
& v, TArray & mv )
172
{
173
for
(
unsigned
int
i=0; i<
GetLength
(); i++ )
174
{
175
mv[i] = v[i];
176
}
177
}
178
182
static
const
Self
ITKCommon_EXPORT
Zero
;
183
static
const
Self
ITKCommon_EXPORT
One
;
184
};
185
}
// end namespace itk
186
187
#endif // __itkNumericTraitsTensorPixel_h
188
Generated on Tue Jul 10 2012 23:38:42 for ITK by
1.8.1