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
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
54
public
:
55
57
typedef
T
ValueType
;
58
59
typedef
SymmetricSecondRankTensor< T, D >
Self
;
60
62
typedef
SymmetricSecondRankTensor< ElementAbsType, D >
AbsType
;
63
65
typedef
SymmetricSecondRankTensor< ElementAccumulateType, D >
AccumulateType
;
66
69
typedef
SymmetricSecondRankTensor< ElementFloatType, D >
FloatType
;
70
72
typedef
SymmetricSecondRankTensor< ElementPrintType, D >
PrintType
;
73
75
typedef
SymmetricSecondRankTensor< ElementRealType, D >
RealType
;
76
78
typedef
ElementRealType
ScalarRealType
;
79
81
typedef
Self
MeasurementVectorType
;
82
88
static
const
Self
max
(
const
Self
&)
89
{
90
return
Self
(
NumericTraits< T >::max
() );
91
}
92
93
static
const
Self
min
(
const
Self
&)
94
{
95
return
Self
(
NumericTraits< T >::min
() );
96
}
97
98
static
const
Self
max
()
99
{
100
return
Self
(
NumericTraits< T >::max
() );
101
}
102
103
static
const
Self
min
()
104
{
105
return
Self
(
NumericTraits< T >::min
() );
106
}
107
108
static
const
Self
NonpositiveMin
()
109
{
110
return
Self
(
NumericTraits< T >::NonpositiveMin
() );
111
}
112
113
static
const
Self
ZeroValue
()
114
{
115
return
Self
(
NumericTraits< T >::ZeroValue
() );
116
}
117
118
static
const
Self
OneValue
()
119
{
120
return
Self
(
NumericTraits< T >::OneValue
() );
121
}
122
123
static
const
Self
NonpositiveMin
(
const
Self
&)
124
{
125
return
NonpositiveMin
();
126
}
127
128
static
const
Self
ZeroValue
(
const
Self
&)
129
{
130
return
ZeroValue
();
131
}
132
133
static
const
Self
OneValue
(
const
Self
&)
134
{
135
return
OneValue
();
136
}
137
142
static
void
SetLength
(
SymmetricSecondRankTensor< T, D >
& m,
const
unsigned
int
s)
143
{
144
if
( s != D *( D + 1 ) / 2 )
145
{
146
itkGenericExceptionMacro(<<
"Cannot set the size of a SymmetricSecondRankTensor "
147
"of dimension "
<< D <<
" ( = size of "
148
<< D *( D + 1 ) / 2 <<
") to "
<< s);
149
}
150
m.
Fill
(
NumericTraits< T >::Zero
);
151
}
153
155
static
unsigned
int
GetLength
(
const
SymmetricSecondRankTensor< T, D >
&)
156
{
157
return
GetLength
();
158
}
159
161
static
unsigned
int
GetLength
()
162
{
163
return
D *( D + 1 ) / 2;
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<
GetLength
(); 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:06 for ITK by
1.8.3.1