00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __igstkPivotCalibrationAlgorithm_h
00019 #define __igstkPivotCalibrationAlgorithm_h
00020
00021 #include <vector>
00022 #include "igstkStateMachine.h"
00023 #include "igstkMacros.h"
00024 #include "igstkObject.h"
00025 #include "igstkTransform.h"
00026
00027 namespace igstk
00028 {
00029
00069 class PivotCalibrationAlgorithm : public Object
00070 {
00071
00072 public:
00073
00076 igstkStandardClassTraitsMacro( PivotCalibrationAlgorithm, Object )
00077
00078 typedef itk::Point< double, 3 > PointType;
00079 typedef igstk::Transform TransformType;
00080 typedef std::vector<TransformType> TransformContainerType;
00081
00087 void RequestAddTransform( const TransformType & t );
00088
00094 void RequestAddTransforms( std::vector< TransformType > & t );
00095
00098 void RequestResetCalibration();
00099
00107 void RequestComputeCalibration();
00108
00114 void RequestCalibrationTransform();
00115
00120 void RequestPivotPoint();
00121
00128 void RequestCalibrationRMSE();
00129
00137 void RequestSetSingularValueThreshold( double threshold );
00138
00140 igstkEventMacro( CalibrationFailureEvent, IGSTKEvent );
00141
00143 igstkEventMacro( CalibrationSuccessEvent, IGSTKEvent );
00144
00147 static const double DEFAULT_SINGULAR_VALUE_THRESHOLD;
00148
00149 protected:
00150
00151 PivotCalibrationAlgorithm ( void );
00152 virtual ~PivotCalibrationAlgorithm ( void );
00153
00155 void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00156
00157 private:
00158
00161 bool CheckCalibrationDataValidity();
00162
00164 igstkDeclareStateMacro( Idle );
00165 igstkDeclareStateMacro( AttemptingToComputeCalibration );
00166 igstkDeclareStateMacro( CalibrationComputed );
00167
00169 igstkDeclareInputMacro( AddTransform );
00170 igstkDeclareInputMacro( SetSingularValueThreshold );
00171 igstkDeclareInputMacro( ComputeCalibration );
00172 igstkDeclareInputMacro( GetTransform );
00173 igstkDeclareInputMacro( GetPivotPoint );
00174 igstkDeclareInputMacro( GetRMSE );
00175 igstkDeclareInputMacro( ResetCalibration );
00176 igstkDeclareInputMacro( CalibrationComputationSuccess );
00177 igstkDeclareInputMacro( CalibrationComputationFailure );
00178
00180 void ReportInvalidRequestProcessing();
00181 void AddTransformProcessing();
00182 void SetSingularValueThresholdProcessing();
00183 void ComputeCalibrationProcessing();
00184 void ResetCalibrationProcessing();
00185 void ReportSuccessInCalibrationComputationProcessing();
00186 void ReportFailureInCalibrationComputationProcessing();
00187 void GetTransformProcessing();
00188 void GetPivotPointProcessing();
00189 void GetRMSEProcessing();
00190
00191
00192 TransformContainerType m_Transforms;
00193
00194
00195
00196
00197
00198 TransformContainerType m_TmpTransforms;
00199
00200
00201
00202 TransformType m_Transform;
00203
00204
00205 itk::Point< double,3 > m_PivotPoint;
00206
00207
00208 double m_RMSE;
00209
00210
00211 double m_SingularValueThreshold;
00212 double m_TmpSingularValueThreshold;
00213
00214 };
00215
00216 }
00217
00218 #endif //__igstkPivotCalibrationAlgorithm_h