7 #ifndef __vtkPlusProbeCalibrationAlgo_h 8 #define __vtkPlusProbeCalibrationAlgo_h 10 #include "vtkPlusCalibrationExport.h" 16 #include <vnl/vnl_double_3.h> 18 #include "vtkObject.h" 24 class vtkXMLDataElement;
37 virtual void PrintSelf( ostream& os, vtkIndent indent );
43 PlusStatus ReadConfiguration( vtkXMLDataElement* aConfig );
46 vtkGetStringMacro( ImageCoordinateFrame );
48 vtkGetStringMacro( ProbeCoordinateFrame );
50 vtkGetStringMacro( PhantomCoordinateFrame );
52 vtkGetStringMacro( ReferenceCoordinateFrame );
66 PlusStatus Calibrate( vtkIGSIOTrackedFrameList* validationTrackedFrameList,
int validationStartFrame,
int validationEndFrame, vtkIGSIOTrackedFrameList* calibrationTrackedFrameList,
int calibrationStartFrame,
int calibrationEndFrame, vtkIGSIOTransformRepository* transformRepository,
const std::vector<PlusNWire>& nWires );
75 PlusStatus Calibrate( vtkIGSIOTrackedFrameList* validationTrackedFrameList, vtkIGSIOTrackedFrameList* calibrationTrackedFrameList, vtkIGSIOTransformRepository* transformRepository,
const std::vector<PlusNWire>& nWires );
78 void GetImageToProbeTransformMatrix( vtkMatrix4x4* imageToProbeMatrix );
81 vtkSetStringMacro( CalibrationDate );
83 vtkGetStringMacro( CalibrationDate );
86 double GetCalibrationReprojectionError3DMean();
88 double GetCalibrationReprojectionError3DStdDev();
91 double GetValidationReprojectionError3DMean();
93 double GetValidationReprojectionError3DStdDev();
95 PlusStatus GetCalibrationReport( std::vector<double>* calibError, std::vector<double>* validError, vnl_matrix_fixed<double, 4, 4>* imageToProbeTransformMatrix );
102 std::string GetResultString(
int precision = 3 );
114 PlusStatus GetXMLCalibrationResultAndErrorReport( vtkIGSIOTrackedFrameList* validationTrackedFrameList,
int validationStartFrame,
115 int validationEndFrame, vtkIGSIOTrackedFrameList* calibrationTrackedFrameList,
int calibrationStartFrame,
int calibrationEndFrame, vtkXMLDataElement* probeCalibrationResult );
119 return this->Optimizer;
122 void ComputeError2d(
const vnl_matrix_fixed<double, 4, 4>& imageToProbeMatrix,
double& errorMean,
double& errorStDev,
double& errorRms );
123 void ComputeError3d(
const vnl_matrix_fixed<double, 4, 4>& imageToProbeMatrix,
double& errorMean,
double& errorStDev,
double& errorRms );
132 LAST_PREPROCESSED_WIRE_POS_ID
135 void ComputeError3d( std::vector<double>& reprojectionErrors, PreProcessedWirePositionIdType datasetType,
const vnl_matrix_fixed<double, 4, 4>& imageToProbeMatrix );
137 void ComputeError2d( PreProcessedWirePositionIdType datasetType,
const vnl_matrix_fixed<double, 4, 4>& imageToProbeMatrix,
138 double& errorMean,
double& errorStDev,
double& errorRms,
139 std::vector< std::vector< vnl_vector_fixed<double, 2> > >* ReprojectionError2Ds = NULL );
147 PlusStatus AddPositionsPerImage( igsioTrackedFrame* trackedFrame, vtkIGSIOTransformRepository* transformRepository, PreProcessedWirePositionIdType datasetType );
157 PlusStatus ComputeReprojectionErrors3D( PreProcessedWirePositionIdType datasetType,
const vnl_matrix_fixed<double, 4, 4>& imageToProbeTransformMatrix );
167 PlusStatus ComputeReprojectionErrors2D( PreProcessedWirePositionIdType datasetType,
const vnl_matrix_fixed<double, 4, 4>& imageToProbeTransformMatrix );
174 void SetAndValidateImageToProbeTransform(
const vnl_matrix_fixed<double, 4, 4>& imageToProbeTransformMatrix, vtkIGSIOTransformRepository* transformRepository );
179 PlusStatus SaveCalibrationResultAndErrorReportToXML( vtkIGSIOTrackedFrameList* validationTrackedFrameList,
int validationStartFrame,
int validationEndFrame, vtkIGSIOTrackedFrameList* calibrationTrackedFrameList,
int calibrationStartFrame,
int calibrationEndFrame );
184 PlusStatus ComputeImageToProbeTransformByLinearLeastSquaresMethod( vnl_matrix_fixed<double, 4, 4>& imageToProbeTransformMatrix, std::set<int>& outliers );
188 void UpdateNonOutlierData(
const std::set<int>& outliers );
190 static double PointToWireDistance(
const vnl_double_3& aPoint,
const vnl_double_3& aLineEndPoint1,
const vnl_double_3& aLineEndPoint2 );
194 vtkSetStringMacro( ImageCoordinateFrame );
196 vtkSetStringMacro( ProbeCoordinateFrame );
198 vtkSetStringMacro( PhantomCoordinateFrame );
200 vtkSetStringMacro( ReferenceCoordinateFrame );
286 : ReprojectionError3DMean( -1.0 )
287 , ReprojectionError3DStdDev( -1.0 )
300 FramePositions.clear();
324 #endif // __vtkPlusProbeCalibrationAlgo_h vnl_matrix_fixed< double, 4, 4 > ImageToProbeTransformMatrix
vtkPlusProbeCalibrationOptimizerAlgo * Optimizer
char * ImageCoordinateFrame
double ReprojectionError3DMean
Refines the image to probe transform using non-linear optimization.
char * ReferenceCoordinateFrame
double ReprojectionError3DStdDev
std::vector< vnl_vector_fixed< double, 2 > > ReprojectionError2DMeans
char * PhantomCoordinateFrame
double ReprojectionError3DMax
PreProcessedWirePositionIdType
std::vector< NWirePositionType > FramePositions
double ErrorConfidenceLevel
std::vector< vnl_vector_fixed< double, 4 > > MiddleWireIntersectionPointsPos_Probe
std::vector< std::vector< double > > ReprojectionError3Ds
vtkPlusProbeCalibrationOptimizerAlgo * GetOptimizer()
char * ProbeCoordinateFrame
std::vector< std::vector< vnl_vector_fixed< double, 2 > > > ReprojectionError2Ds
NWireErrorType NWireErrors
std::vector< vnl_vector_fixed< double, 2 > > ReprojectionError2DStdDevs
std::vector< vnl_vector_fixed< double, 4 > > AllWiresIntersectionPointsPos_Image
vnl_matrix_fixed< double, 4, 4 > ProbeToPhantomTransform
std::vector< PlusNWire > NWires
Probe calibration algorithm class.