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
itkNumericTraitsPointPixel.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 __itkNumericTraitsPointPixel_h
19
#define __itkNumericTraitsPointPixel_h
20
21
#include "
itkNumericTraits.h
"
22
#include "
itkPoint.h
"
23
24
namespace
itk
25
{
31
template
<
typename
T,
unsigned
int
D >
32
class
NumericTraits
<
Point
< T , D > >
33
{
34
private
:
35
36
typedef
typename
NumericTraits< T >::AbsType
ElementAbsType
;
37
typedef
typename
NumericTraits< T >::AccumulateType
ElementAccumulateType
;
38
typedef
typename
NumericTraits< T >::FloatType
ElementFloatType
;
39
typedef
typename
NumericTraits< T >::PrintType
ElementPrintType
;
40
typedef
typename
NumericTraits< T >::RealType
ElementRealType
;
41
42
public
:
43
45
typedef
T
ValueType
;
46
typedef
Point< T, D >
Self
;
47
49
typedef
Point< ElementAbsType, D >
AbsType
;
50
52
typedef
Point< ElementAccumulateType, D >
AccumulateType
;
53
56
typedef
Point< ElementFloatType, D >
FloatType
;
57
59
typedef
Point< ElementPrintType, D >
PrintType
;
60
62
typedef
Point< ElementRealType, D >
RealType
;
63
65
typedef
ElementRealType
ScalarRealType
;
66
68
typedef
Self
MeasurementVectorType
;
69
75
static
const
Self
max
(
const
Self
&)
76
{
77
return
Self
(
NumericTraits< T >::max
() );
78
}
79
80
static
const
Self
min
(
const
Self
&)
81
{
82
return
Self
(
NumericTraits< T >::min
() );
83
}
84
85
static
const
Self
max
()
86
{
87
return
Self
(
NumericTraits< T >::max
() );
88
}
89
90
static
const
Self
min
()
91
{
92
return
Self
(
NumericTraits< T >::min
() );
93
}
94
95
static
const
Self
NonpositiveMin
()
96
{
97
return
Self
(
NumericTraits< T >::NonpositiveMin
() );
98
}
99
100
static
const
Self
ZeroValue
()
101
{
102
return
Self
(
NumericTraits< T >::ZeroValue
() );
103
}
104
105
static
const
Self
OneValue
()
106
{
107
return
Self
(
NumericTraits< T >::OneValue
() );
108
}
109
110
static
const
Self
NonpositiveMin
(
const
Self
&)
111
{
112
return
NonpositiveMin
();
113
}
114
115
static
const
Self
ZeroValue
(
const
Self
&)
116
{
117
return
ZeroValue
();
118
}
119
120
static
const
Self
OneValue
(
const
Self
&)
121
{
122
return
OneValue
();
123
}
124
128
static
void
SetLength
(
Point< T, D >
& m,
const
unsigned
int
s)
129
{
130
if
( s != D )
131
{
132
itkGenericExceptionMacro(<<
"Cannot set the size of a Point of length "
133
<< D <<
" to "
<< s);
134
}
135
m.
Fill
(
NumericTraits< T >::Zero
);
136
}
138
140
static
unsigned
int
GetLength
(
const
Point< T, D >
&)
141
{
142
return
D;
143
}
144
146
static
unsigned
int
GetLength
()
147
{
148
return
D;
149
}
150
151
static
void
AssignToArray
(
const
Self
& v,
MeasurementVectorType
& mv )
152
{
153
mv = v;
154
}
155
156
template
<
class
TArray>
157
static
void
AssignToArray
(
const
Self
& v, TArray & mv )
158
{
159
for
(
unsigned
int
i=0; i<D; i++ )
160
{
161
mv[i] = v[i];
162
}
163
}
164
168
static
const
Self
ITKCommon_EXPORT
Zero
;
169
static
const
Self
ITKCommon_EXPORT
One
;
170
};
171
}
// end namespace itk
172
173
#endif // __itkNumericTraitsPointPixel_h
174
Generated on Mon May 13 2013 01:03:06 for ITK by
1.8.3.1