ITK
4.3.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ITK
Modules
Core
Common
include
itkSymmetricEigenAnalysis.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 __itkSymmetricEigenAnalysis_h
19
#define __itkSymmetricEigenAnalysis_h
20
21
#include "
itkMacro.h
"
22
23
namespace
itk
24
{
60
template
<
typename
TMatrix,
typename
TVector,
typename
TEigenMatrix = TMatrix >
61
class
SymmetricEigenAnalysis
62
{
63
public
:
64
typedef
enum
65
{
66
OrderByValue
= 1,
67
OrderByMagnitude
,
68
DoNotOrder
69
}
70
EigenValueOrderType
;
71
72
SymmetricEigenAnalysis
():
73
m_Dimension
(0),
74
m_Order
(0),
75
m_OrderEigenValues
(
OrderByValue
) {}
76
77
SymmetricEigenAnalysis
(
const
unsigned
int
dimension):
78
m_Dimension
(dimension),
79
m_Order
(dimension),
80
m_OrderEigenValues
(
OrderByValue
) {}
81
82
~SymmetricEigenAnalysis
() {}
83
84
typedef
TMatrix
MatrixType
;
85
typedef
TEigenMatrix
EigenMatrixType
;
86
typedef
TVector
VectorType
;
87
101
unsigned
int
ComputeEigenValues
(
102
const
TMatrix & A,
103
TVector & EigenValues)
const
;
104
125
unsigned
int
ComputeEigenValuesAndVectors
(
126
const
TMatrix & A,
127
TVector & EigenValues,
128
TEigenMatrix & EigenVectors)
const
;
129
131
void
SetOrder
(
const
unsigned
int
n)
132
{
133
m_Order
= n;
134
}
135
139
unsigned
int
GetOrder
()
const
{
return
m_Order
; }
140
144
void
SetOrderEigenValues
(
const
bool
b)
145
{
146
if
( b ) {
m_OrderEigenValues
=
OrderByValue
; }
147
else
{
m_OrderEigenValues
=
DoNotOrder
; }
148
}
150
151
bool
GetOrderEigenValues
()
const
{
return
(
m_OrderEigenValues
==
OrderByValue
); }
152
156
void
SetOrderEigenMagnitudes
(
const
bool
b)
157
{
158
if
( b ) {
m_OrderEigenValues
=
OrderByMagnitude
; }
159
else
{
m_OrderEigenValues
=
DoNotOrder
; }
160
}
162
163
bool
GetOrderEigenMagnitudes
()
const
{
return
(
m_OrderEigenValues
==
OrderByMagnitude
); }
164
167
void
SetDimension
(
const
unsigned
int
n)
168
{
169
m_Dimension
= n;
170
if
(
m_Order
== 0 )
171
{
172
m_Order
=
m_Dimension
;
173
}
174
}
176
179
unsigned
int
GetDimension
()
const
{
return
m_Dimension
; }
180
181
private
:
182
unsigned
int
m_Dimension
;
183
unsigned
int
m_Order
;
184
EigenValueOrderType
m_OrderEigenValues
;
185
205
void
ReduceToTridiagonalMatrix
(
double
*inputMatrix,
VectorType
& d,
206
double
*
e
,
double
*e2)
const
;
207
229
void
ReduceToTridiagonalMatrixAndGetTransformation
(
230
double
*inputMatrix,
VectorType
& diagonalElements,
231
double
*subDiagonalElements,
double
*transformMatrix)
const
;
232
262
unsigned
int
ComputeEigenValuesUsingQL
(
263
VectorType
& d,
double
*
e
)
const
;
264
302
unsigned
int
ComputeEigenValuesAndVectorsUsingQL
(
303
VectorType
& d,
double
*
e
,
double
*z)
const
;
304
};
305
306
template
<
typename
TMatrix,
typename
TVector,
typename
TEigenMatrix >
307
std::ostream &
operator<<
(std::ostream & os,
308
const
SymmetricEigenAnalysis< TMatrix, TVector, TEigenMatrix >
& s)
309
{
310
os <<
"[ClassType: SymmetricEigenAnalysis]"
<< std::endl;
311
os <<
" Dimension : "
<< s.
GetDimension
() << std::endl;
312
os <<
" Order : "
<< s.
GetOrder
() << std::endl;
313
os <<
" OrderEigenValues: "
<< s.
GetOrderEigenValues
() << std::endl;
314
os <<
" OrderEigenMagnitudes: "
<< s.
GetOrderEigenMagnitudes
() << std::endl;
315
return
os;
316
}
317
}
// end namespace itk
318
319
#ifndef ITK_MANUAL_INSTANTIATION
320
#include "itkSymmetricEigenAnalysis.hxx"
321
#endif
322
323
#endif
324
Generated on Sun Dec 9 2012 01:28:15 for ITK by
1.8.2