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
Transform
include
itkMatrixOffsetTransformBase.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 __itkMatrixOffsetTransformBase_h
19
#define __itkMatrixOffsetTransformBase_h
20
21
#include <iostream>
22
23
#include "
itkMatrix.h
"
24
#include "
itkTransform.h
"
25
#include "
itkMacro.h
"
26
27
namespace
itk
28
{
70
template
<
71
class
TScalarType = double,
// Data type for scalars
72
unsigned
int
NInputDimensions = 3,
// Number of dimensions in the input space
73
unsigned
int
NOutputDimensions = 3>
74
// Number of dimensions in the output space
75
class
MatrixOffsetTransformBase
:
76
public
Transform
<TScalarType, NInputDimensions, NOutputDimensions>
77
{
78
public
:
80
typedef
MatrixOffsetTransformBase
Self
;
81
typedef
Transform
<TScalarType,
82
NInputDimensions,
83
NOutputDimensions>
Superclass
;
84
85
typedef
SmartPointer<Self>
Pointer
;
86
typedef
SmartPointer<const Self>
ConstPointer
;
87
89
itkTypeMacro(
MatrixOffsetTransformBase
,
Transform
);
90
92
itkNewMacro(
Self
);
93
95
itkStaticConstMacro(
InputSpaceDimension
,
unsigned
int
, NInputDimensions);
96
itkStaticConstMacro(
OutputSpaceDimension
,
unsigned
int
, NOutputDimensions);
97
itkStaticConstMacro(
ParametersDimension
,
unsigned
int
,
98
NOutputDimensions * ( NInputDimensions + 1 ) );
100
102
typedef
typename
Superclass::ParametersType
ParametersType
;
103
typedef
typename
Superclass::ParametersValueType
ParametersValueType
;
104
106
typedef
typename
Superclass::JacobianType
JacobianType
;
107
109
typedef
typename
Superclass::TransformCategoryType
TransformCategoryType
;
110
112
typedef
typename
Superclass::ScalarType
ScalarType
;
113
115
typedef
Vector
<TScalarType,
116
itkGetStaticConstMacro(
InputSpaceDimension
)>
InputVectorType
;
117
typedef
Vector
<TScalarType,
118
itkGetStaticConstMacro(
OutputSpaceDimension
)>
OutputVectorType
;
119
typedef
typename
OutputVectorType::ValueType
OutputVectorValueType
;
121
123
typedef
CovariantVector
<TScalarType,
124
itkGetStaticConstMacro(
InputSpaceDimension
)>
125
InputCovariantVectorType
;
126
typedef
CovariantVector
<TScalarType,
127
itkGetStaticConstMacro(
OutputSpaceDimension
)>
128
OutputCovariantVectorType
;
130
131
typedef
typename
Superclass::InputVectorPixelType
InputVectorPixelType
;
132
typedef
typename
Superclass::OutputVectorPixelType
OutputVectorPixelType
;
133
135
typedef
typename
Superclass::InputDiffusionTensor3DType
136
InputDiffusionTensor3DType
;
137
typedef
typename
Superclass::OutputDiffusionTensor3DType
138
OutputDiffusionTensor3DType
;
139
141
typedef
typename
Superclass::InputSymmetricSecondRankTensorType
142
InputSymmetricSecondRankTensorType
;
143
typedef
typename
Superclass::OutputSymmetricSecondRankTensorType
144
OutputSymmetricSecondRankTensorType
;
145
146
typedef
CovariantVector<TScalarType, InputDiffusionTensor3DType::Dimension>
147
InputTensorEigenVectorType
;
148
150
typedef
vnl_vector_fixed<TScalarType,
151
itkGetStaticConstMacro(
InputSpaceDimension
)>
152
InputVnlVectorType
;
153
typedef
vnl_vector_fixed<TScalarType,
154
itkGetStaticConstMacro(
OutputSpaceDimension
)>
155
OutputVnlVectorType
;
157
159
typedef
Point
<TScalarType,
160
itkGetStaticConstMacro(
InputSpaceDimension
)>
161
InputPointType
;
162
typedef
typename
InputPointType::ValueType
InputPointValueType
;
163
typedef
Point
<TScalarType,
164
itkGetStaticConstMacro(
OutputSpaceDimension
)>
165
OutputPointType
;
166
typedef
typename
OutputPointType::ValueType
OutputPointValueType
;
168
170
typedef
Matrix
<TScalarType, itkGetStaticConstMacro(
OutputSpaceDimension
),
171
itkGetStaticConstMacro(
InputSpaceDimension
)>
172
MatrixType
;
173
typedef
typename
MatrixType::ValueType
MatrixValueType
;
175
177
typedef
Matrix
<TScalarType, itkGetStaticConstMacro(
InputSpaceDimension
),
178
itkGetStaticConstMacro(
OutputSpaceDimension
)>
179
InverseMatrixType
;
180
181
typedef
InputPointType
CenterType
;
182
183
typedef
OutputVectorType
OffsetType
;
184
typedef
typename
OffsetType::ValueType
OffsetValueType
;
185
186
typedef
OutputVectorType
TranslationType
;
187
188
typedef
typename
TranslationType::ValueType
TranslationValueType
;
189
192
typedef
typename
Superclass::InverseTransformBaseType
InverseTransformBaseType
;
193
typedef
typename
InverseTransformBaseType::Pointer
InverseTransformBasePointer
;
194
198
virtual
void
SetIdentity
(
void
);
199
203
virtual
TransformCategoryType
GetTransformCategory
()
const
204
{
205
return
Self::Linear
;
206
}
207
219
virtual
void
SetMatrix
(
const
MatrixType
& matrix)
220
{
221
m_Matrix
= matrix; this->
ComputeOffset
();
222
this->
ComputeMatrixParameters
();
223
m_MatrixMTime
.
Modified
(); this->
Modified
();
return
;
224
}
226
234
virtual
const
MatrixType
&
GetMatrix
()
const
235
{
236
return
m_Matrix
;
237
}
238
247
void
SetOffset
(
const
OutputVectorType
& offset)
248
{
249
m_Offset
= offset; this->
ComputeTranslation
();
250
this->
Modified
();
return
;
251
}
253
259
const
OutputVectorType
&
GetOffset
(
void
)
const
260
{
261
return
m_Offset
;
262
}
263
286
void
SetCenter
(
const
InputPointType
& center)
287
{
288
m_Center
= center; this->
ComputeOffset
();
289
this->
Modified
();
return
;
290
}
292
299
const
InputPointType
&
GetCenter
()
const
300
{
301
return
m_Center
;
302
}
303
310
void
SetTranslation
(
const
OutputVectorType
& translation)
311
{
312
m_Translation
= translation; this->
ComputeOffset
();
313
this->
Modified
();
return
;
314
}
316
323
const
OutputVectorType
&
GetTranslation
(
void
)
const
324
{
325
return
m_Translation
;
326
}
327
332
void
SetParameters
(
const
ParametersType
& parameters);
333
335
const
ParametersType
&
GetParameters
(
void
)
const
;
336
338
virtual
void
SetFixedParameters
(
const
ParametersType
&);
339
341
virtual
const
ParametersType
&
GetFixedParameters
(
void
)
const
;
342
354
void
Compose
(
const
Self
*other,
bool
pre = 0);
355
364
OutputPointType
TransformPoint
(
const
InputPointType
& point)
const
;
365
366
using
Superclass::TransformVector
;
367
368
OutputVectorType
TransformVector
(
const
InputVectorType
& vector)
const
;
369
370
OutputVnlVectorType
TransformVector
(
const
InputVnlVectorType
& vector)
const
;
371
372
OutputVectorPixelType
TransformVector
(
const
InputVectorPixelType
& vector)
const
;
373
374
using
Superclass::TransformCovariantVector
;
375
376
OutputCovariantVectorType
TransformCovariantVector
(
const
InputCovariantVectorType
& vector)
const
;
377
378
OutputVectorPixelType
TransformCovariantVector
(
const
InputVectorPixelType
& vector)
const
;
379
380
using
Superclass::TransformDiffusionTensor3D
;
381
382
OutputDiffusionTensor3DType
TransformDiffusionTensor3D
(
const
InputDiffusionTensor3DType
& tensor)
const
;
383
384
OutputVectorPixelType
TransformDiffusionTensor3D
(
const
InputVectorPixelType
& tensor )
const
;
385
386
using
Superclass::TransformSymmetricSecondRankTensor
;
387
OutputSymmetricSecondRankTensorType
TransformSymmetricSecondRankTensor
(
const
InputSymmetricSecondRankTensorType
& tensor )
const
;
388
389
OutputVectorPixelType
TransformSymmetricSecondRankTensor
(
const
InputVectorPixelType
& tensor )
const
;
390
400
virtual
void
ComputeJacobianWithRespectToParameters
(
const
InputPointType
& x,
JacobianType
& j)
const
;
401
405
virtual
void
ComputeJacobianWithRespectToPosition
(
const
InputPointType
& x,
JacobianType
& jac)
const
;
406
410
virtual
void
ComputeInverseJacobianWithRespectToPosition
(
const
InputPointType
& x,
JacobianType
& jac)
const
;
411
430
bool
GetInverse
(
Self
*inverse)
const
;
432
434
virtual
InverseTransformBasePointer
GetInverseTransform
()
const
;
435
441
virtual
bool
IsLinear
()
const
442
{
443
return
true
;
444
}
445
446
#if !defined(ITK_LEGACY_REMOVE)
447
448
public
:
449
#else
450
451
protected
:
452
#endif
453
455
const
InverseMatrixType
&
GetInverseMatrix
(
void
)
const
;
456
457
protected
:
465
MatrixOffsetTransformBase
(
const
MatrixType
& matrix,
const
OutputVectorType
& offset);
466
MatrixOffsetTransformBase
(
unsigned
int
paramDims);
467
MatrixOffsetTransformBase
();
469
471
virtual
~MatrixOffsetTransformBase
();
472
474
void
PrintSelf
(std::ostream & s,
Indent
indent)
const
;
475
476
const
InverseMatrixType
&
GetVarInverseMatrix
(
void
)
const
477
{
478
return
m_InverseMatrix
;
479
}
480
void
SetVarInverseMatrix
(
const
InverseMatrixType
& matrix)
const
481
{
482
m_InverseMatrix
= matrix;
m_InverseMatrixMTime
.
Modified
();
483
}
484
bool
InverseMatrixIsOld
(
void
)
const
485
{
486
if
(
m_MatrixMTime
!=
m_InverseMatrixMTime
)
487
{
488
return
true
;
489
}
490
else
491
{
492
return
false
;
493
}
494
}
495
496
virtual
void
ComputeMatrixParameters
(
void
);
497
498
virtual
void
ComputeMatrix
(
void
);
499
500
void
SetVarMatrix
(
const
MatrixType
& matrix)
501
{
502
m_Matrix
= matrix;
m_MatrixMTime
.
Modified
();
503
}
504
505
virtual
void
ComputeTranslation
(
void
);
506
507
void
SetVarTranslation
(
const
OutputVectorType
& translation)
508
{
509
m_Translation
= translation;
510
}
511
512
virtual
void
ComputeOffset
(
void
);
513
514
void
SetVarOffset
(
const
OutputVectorType
& offset)
515
{
516
m_Offset
= offset;
517
}
518
519
void
SetVarCenter
(
const
InputPointType
& center)
520
{
521
m_Center
= center;
522
}
523
524
private
:
525
526
MatrixOffsetTransformBase
(
const
Self
& other);
527
const
Self
&
operator=
(
const
Self
&);
528
529
MatrixType
m_Matrix
;
// Matrix of the transformation
530
OutputVectorType
m_Offset
;
// Offset of the transformation
531
mutable
InverseMatrixType
m_InverseMatrix
;
// Inverse of the matrix
532
mutable
bool
m_Singular
;
// Is m_Inverse singular?
533
534
InputPointType
m_Center
;
535
OutputVectorType
m_Translation
;
536
538
TimeStamp
m_MatrixMTime
;
539
mutable
TimeStamp
m_InverseMatrixMTime
;
540
};
// class MatrixOffsetTransformBase
541
}
// namespace itk
542
543
#ifndef ITK_MANUAL_INSTANTIATION
544
#include "itkMatrixOffsetTransformBase.hxx"
545
#endif
546
547
#endif
/* __itkMatrixOffsetTransformBase_h */
548
Generated on Mon May 13 2013 01:00:35 for ITK by
1.8.3.1