00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __SignUKFRegistration_h
00018 #define __SignUKFRegistration_h
00019
00020
00021 #include "vtkPoints.h"
00022 #include "vtkLinearTransform.h"
00023
00024 #include <vtkMatrix4x4.h>
00025 #include <SignFiducialCollection.h>
00026 #include <SignContext.h>
00027 #include <SignUIBase.h>
00028
00029
00030
00031
00032
00033 class SIGN_EXPORT SignUKFRegistration : public vtkLinearTransform
00034
00035 {
00036
00037 public:
00038
00039
00040
00041
00042 vtkTypeRevisionMacro(SignUKFRegistration,vtkLinearTransform);
00043 void PrintSelf(ostream& os, vtkIndent indent);
00044
00045 static SignUKFRegistration *New();
00046
00047 void SetSourcePoints(vtkPoints *sourcepoints);
00048 void SetTargetPoints(vtkPoints *targetpoints);
00049 vtkGetObjectMacro(SourcePoints, vtkPoints);
00050 vtkGetObjectMacro(TargetPoints, vtkPoints);
00051
00052 vtkMatrix4x4 *RegisterWithUKF(SignFiducialCollection *set1, SignFiducialCollection *set2);
00053
00054
00055 void InternalUpdate();
00056 double HomogenousTransform[4][4];
00057
00058
00059 unsigned long GetMTime();
00060
00061 void SetContext(SignContext*);
00062 void SetUIBase(SignUIBase*);
00063
00064 double GetMeanSDError();
00065 double GetMaxSDError();
00066
00067
00068
00069 void Inverse();
00070
00071
00072
00073 vtkAbstractTransform *MakeTransform();
00074
00075
00076
00077 protected:
00078
00079 SignUKFRegistration();
00080 ~SignUKFRegistration();
00081
00082 SignContext* context;
00083 SignUIBase* gui;
00084
00085
00086
00087
00088
00089 void UKF(double state_vector4ukf[6], double state_covariance4ukf[6][6],
00090 double **nearest_neighbours, double Var_State[6][6],
00091 double **SourcePoints4ukf, double **Var_Observ_Diag_3malt,
00092 int t, double alpha, double beta, double kappa,
00093 double state_vector_new[6], double state_covariance_new[6][6]);
00094
00095
00096 void HfunReg(double xSigmaPts4HfunReg[6][13], int t, double **nearest_neighbour_transposed, double **zPredSigmaPts);
00097
00098 void ScaledSymmetricSigmaPts(double xQ[6], double PQ[6][6], double alpha, double beta, double kappa, double xPts[6][13], double wPts[14]);
00099
00100 void CholeskyFactorization(double matrix2factorize[6][6]);
00101
00102 void rotateM(double vector2rot[3], double R[3][3]);
00103
00104 void AllocateMatrix(double**& M, int r, int c);
00105 void DeallocateMatrix(double **M, int r);
00106 void PrintMatrix(double **M, int r, int c, const char* name);
00107
00108 void MultiplyMatrix4UKF(double **A, double **B,
00109 unsigned int rowA, unsigned int colA,
00110 unsigned int rowB, unsigned int colB,
00111 double **C);
00112
00113 vtkPoints *SourcePoints;
00114 vtkPoints *TargetPoints;
00115
00116 private:
00117 SignUKFRegistration(const SignUKFRegistration&);
00118 void operator=(const SignUKFRegistration&);
00119
00120 double mean_squared_dist;
00121 double max_squared_dist;
00122
00123 };
00124 #endif