21 #ifndef MIRTK_HomogeneousTransformation_H 22 #define MIRTK_HomogeneousTransformation_H 24 #include "mirtk/Transformation.h" 26 #include "mirtk/Matrix.h" 34 class MultiThreadedImageHomogeneousTransformation;
36 enum HomogeneousTransformationParameterIndex
38 TX, TY, TZ, RX, RY, RZ, SX, SY, SZ, SXY, SYZ, SXZ, SYX, SZY, SZX,
63 enum AttributeSelector { MATRIX, DOFS, DOFS_MATRIX };
81 void Update(AttributeSelector);
118 int = 1,
double = .0);
124 virtual double Approximate(
const double *,
const double *,
const double *,
125 double *,
double *,
double *,
int,
126 int = 1,
double = .0);
132 virtual double Approximate(
const double *,
const double *,
const double *,
const double *,
133 double *,
double *,
double *,
int,
134 int = 1,
double = .0);
145 virtual void ApproximateDOFs(
const double *,
const double *,
const double *,
const double *,
146 const double *,
const double *,
const double *,
int);
190 virtual void Reset();
203 virtual void GlobalTransform(
double &,
double &,
double &,
double = 0,
double = -1)
const;
206 virtual void LocalTransform(
double &,
double &,
double &,
double = 0,
double = -1)
const;
209 virtual void Transform(
double &,
double &,
double &,
double = 0,
double = -1)
const;
212 virtual void GlobalInverse(
double &,
double &,
double &,
double = 0,
double = -1)
const;
215 virtual bool LocalInverse(
double &,
double &,
double &,
double = 0,
double = -1)
const;
218 virtual bool Inverse(
double &,
double &,
double &,
double = 0,
double = -1)
const;
227 virtual void LocalJacobian(
Matrix &,
double,
double,
double,
double = 0,
double = -1)
const;
230 virtual void Jacobian(
Matrix &,
double,
double,
double,
double = 0,
double = -1)
const;
264 friend class MultiThreadedImageHomogeneousTransformation;
314 double delta, max_delta = .0;
318 delta = abs(dx[idx]);
319 if (delta > max_delta) max_delta = delta;
321 if (max_delta > .0) this->
Update(MATRIX);
327 double delta, max_delta = .0;
331 delta = abs(dx[idx]);
332 if (delta > max_delta) max_delta = delta;
335 if (max_delta > .0) this->
Update(MATRIX);
342 if (matrix.
Rows() == 3 && matrix.
Cols() == 3) {
343 for (
int c = 0; c < 3; ++c)
344 for (
int r = 0; r < 3; ++r) {
347 for (
int r = 0; r < 3; ++r) {
350 }
else if (matrix.
Rows() == 4 && matrix.
Cols() == 4) {
353 Throw(ERR_InvalidArgument, __FUNCTION__,
"Transformation matrix must be 3x3 or 4x4");
356 this->
Update(DOFS_MATRIX);
429 for (
int i = 0; i < 3; i++) {
430 for (
int j = 0; j < 3; j++) {
454 #endif // MIRTK_HomogeneousTransformation_H
void Broadcast(Event, const void *=NULL)
Broadcast event to observers.
int Cols() const
Get number of columns.
void Initialize(int, int=-1, double *=NULL)
Initialize matrix with number of rows and columns.
Observable has modified state/parameters.
void Throw(ErrorType err, const char *func, Args... args) const
int Rows() const
Get number of rows.