Obtaining Coordinates of Registration Marker Centers
The registration markers are spherical objects. The boundaries of these spheres will be digitized from magnetic resonance imaging and during joint testing using a digitizing probe, see Previous Protocols above. More than 10 points are expected to be acquired for each registration marker for a given experimentation modality. For TibioFemoral Joint Experimentation, roughly 10 surface points will be acquired for each registration markers. For PatelloFemoral Joint Experimentation, the locations of the 12 divot points will be acquired (see Specifications/SpecimenPreparation). For Anatomical Imaging, surface coordinates will be acquired from the .stl model of each registration marker.
The following scripts, which can be found in the repository at https://simtk.org/websvn/wsvn/openknee/utl/Registration/, will allow for a relationship between the coordinate systems.
TibioFemoral Joint Configuration Files
TFSphereTransform.py
 goal
 to find the location of the center of the registration markers (on the femur and tibia) with regards to the optotrak sensor coordinate system given the coordinates of points on the surface of the markers with respect to the global optotrak coordinate system
 requirements
python [version 2.7] (https://www.python.org) and numpy (https://www.numpy.org)
 input
the name/path of a Sim Vitro state configuration file, specific to TibioFemoral Joint Experimentation data, containing the coordinates of MRI Fiducial Sphere Positions, n surface locations for each of three registration markers (n > 10), totaling about 30 locations
 logic
 upon running the script, the user is prompted with a dialog box that allows them to select the state configuration file they would like to use
 the python script finds the [MRI Fiducial Sphere Positions] section of the specified state configuration file, extracts the coordinates for the registration marker (x,y,z) and the position sensor (x,y,z,roll,pitch,yaw) and enters them into matrices
 it then extracts the transformation matrices that gives the relationship between the the optotrak global coordinate system and the optotrak bone sensor from the position sensor matrix for each of the 30 locations
 the inverse of this transformation matrix for each set of coordinates is multiplied by the respective set of coordinates (x,y,z) to obtain the new coordinates in the the optotrak bone sensor coordinate system
 the coordinates are then split up into three matrices for the three respective registration markers
 finally we set a sphere to the respective coordinates for each registration marker, returning the center in bone sensor coordinates and the radius of the marker as well as the centroid amongst the three spheres
 math
 the transformation matrix extracted from each position sensor coordinate set (x,y,z,r,p,w) is as followed:
Imagine the matrix containing points portraying the position of registration markers in the world coordinates as "A" and the transformation matrix we extracted as "T", and B is the coordinates in the bone sensor coordinates that we want
As a result we need the inverse of that transformation matrix to multiply by A
(Side Note: the transformation matrix is 4 by 4 for each set of x,y,z coordinates. As a result we change the thirty 3 by 1 coordinate arrays into a 4 by 1 array by adding a 1 at the end. This will cancel out by the end and we can just take the first 3 resulting coordinates of the array since the 4th will still be a 1)
 output
the script prints the center and radius (in meteres) of each sphere (x, y, z) and r that best represents the spherical distribution of n locations as well as the centroid between the three spheres, in addition it exports this data to the "Tibia_Results.csv" and "Femur_Results.csv" files, respectively, located in the Results  Marker Optotrak Coordinates folder.
 examples
[%username% Registration]$ python TFSphereTransform.py
(dialog box appears)
The center of the sphere fit to Rigid Body 1 (Tibia) Registration Marker 1, in Tibia Optotrak Sensor Coordinates, with the units being meters, is located at: [0.08231697 0.00683181 0.04593537]
And the radius is: 0.0106449411987
The center of the sphere fit to Rigid Body 1 (Tibia) Registration Marker 2, in Tibia Optotrak Sensor Coordinates, with the units being meters, is located at: [0.0232474 0.00014573 0.05992128]
And the radius is: 0.0104587217176
The center of the sphere fit to Rigid Body 1 (Tibia) Registration Marker 3, in Tibia Optotrak Sensor Coordinates, with the units being meters, is located at: [0.04869049 0.01748811 0.01951902]
And the radius is: 0.0104835155492
The centroid of the Rigid Body 1 (Tibia) sensors, in Tibia Optotrak Sensor Coordinates, with the units in meters, is located at: [0.05141829 0.00360068 0.04179189]
The center of the sphere fit to Rigid Body 2 (Femur) Registration Marker 1, in Femur Optotrak Sensor Coordinates, with the units being meters, is located at: [0.0329999 0.01907689 0.02117003]
And the radius is: 0.0104997342103
The center of the sphere fit to Rigid Body 2 (Femur) Registration Marker 2, in Femur Optotrak Sensor Coordinates, with the units being meters, is located at: [0.09081468 0.00377113 0.04492377]
And the radius is: 0.0104194016865
The center of the sphere fit to Rigid Body 2 (Femur) Registration Marker 3, in Femur Optotrak Sensor Coordinates, with the units being meters, is located at: [0.08071711 0.00088821 0.00391487]
And the radius is: 0.0102451485457
The centroid of the Rigid Body 2 (Femur) sensors, in Femur Optotrak Sensor Coordinates, with the units being meters, is located at: [0.06817723 0.00480585 0.02333622]
Results have been exported to "Tibia_Results.csv" and "Femur_Results.csv".
Patellofemoral Joint Configuration Files
PFSphereTransform.py
 goal
 to find the location of the center of the registration markers (on the patella) with regards to the optotrak sensor coordinate system given the coordinates of the divot points on the registration marker with respect to the global optotrak coordinate system
 requirements
python [version 2.7] (https://www.python.org) and numpy (https://www.numpy.org)
 input
the name/path of a Sim Vitro state configuration file, specific to PatelloFemoral Joint Experimentation data, containing the coordinates of the Patella MRI Marker, 12 divot point locations on the marker
 logic

 upon running the script, the user is prompted with a dialog box that allows them to select the state configuration file they would like to use
 the python script finds the [MRI Patella Marker] section of the specified state configuration file, extracts the 12 divot point coordinates for the registration marker (x,y,z) and the position sensor (x,y,z,roll,pitch,yaw) and enters them into matrices
 it then extracts the transformation matrices that gives the relationship between the the optotrak global coordinate system and the optotrak bone sensor from the position sensor matrix for each of the 12 locations
 the inverse of this transformation matrix for each set of coordinates is multiplied by the respective set of coordinates (x,y,z) to obtain the new coordinates in the the optotrak bone sensor coordinate system
 because the patellofemoral joint configuration file does not have the surface coordinates on spheres (like tibiofemoral does), rather, it has measurements on divot points on the 3D printed patella registration marker assembly.
the CAD dimensions are then extracted from CAD_PT_DIMENSIONS.csv (https://simtk.org/websvn/wsvn/openknee/utl/PatFem_Registration/CAD_PT_DIMENSIONS.csv) to find the 3 centers of the 3 MRI spheres in optotrak sensor coordinates
 if the script is unable to locate this file in the user's local repository, the user will be prompted with an alert and another dialogue to find the file themselves
 math
the math to convert the points from optotrak global coordinates to optotrak sensor coordinates is the same as for TibioFemoral
in addition, in order to find the location of the centers of three spheres given the 12 divot points, the dimensional relationship among the CAD points is used. This relationship is described at https://simtk.org/websvn/wsvn/openknee/utl/PatFem_Registration/CAD_PT_DIMENSIONS.csv
 the center of the marker was found by averaging the 12 points in the CAD coordinate, and then finding the distance from the center of the marker to each of the spheres
 this distance was then added to the center of the registration marker in optotrak sensor coordinates, which was found by averaging the 12 points in optotrak sensor coordinates, to find the location of the spheres in optotrak sensor coordinates
 output
the script prints the center (in meteres) of each sphere (x, y, z) and in addition it exports this data to the "Patella_Results.csv" file, respectively, located in the Results  Marker Optotrak Coordinates folder.
 examples
[%username% Registration]$ python PFSphereTransform.py
(dialog box appears)
The origin of Patella MRI registration marker is: [0.14644472749814882, 0.054232975602513313, 0.11892285921909156]
The center of Point 2 is: [ 0.14619473 2.79314964 36.72433953]
The center of Point 3 is: [ 28.31180527 9.10314964 19.40666047]
The center of Point 4 is: [28.60519473 9.10414964 19.40566047]
Results have been exported to "Patella_Results.csv".
Anatomical Imaging Files
STLSphereTransform.py
 goal
 to import an .stl file and extract the coordinates from the surface of a registration marker in anatomical imagining coordinates, fit a sphere to that registration marker, find the center and radius of that sphere, and export the results to later form a relationship between the optotrak world coordinates and the MRI imaging coordinates
 requirements
python [version 2.7] (https://www.python.org), numpy (https://www.numpy.org), and the numpystl 1.4.2 folder (https://pypi.python.org/pypi/numpystl)
 input
 upon running the script, the user will be prompted with a dialog box that will allow them to choose the .stl file they wish to use
 logic
 the script will extract the coordinates of the vertices of each of the triangles within the stl file and use those coordinates to fit a sphere to those coordinates
 output
 the script will return the fitted sphere center (x,y,z) and radius (r) [the data is in mm] and then write a .txt with the user's specified name containing the data
 examples
[%username% Registration]$ python stldataprocess.py
(dialog box appears)
Radius (mm): 8.06225848609
Center (mm): [38.21938621 13.89618373 77.8407352 ]
The results will now be stored in a .txt file.
Creating new text file...
Enter string for name of text file:'test1'
These results are stored in the specified file.
Transformation Matrices
 aerdemir 20150630 12:31:16 This session already has documentation to calculate transformation matrices between bone registration marker coordinate system and Optotrak coordinate system and bone registration marker coordinate system and image coordinate system. It will be good to expand this session for patellofemoral registration marker assembly. Particularly, by providing the necessary inputs for calculations. Also, we need to correct the information to emphasize that we are finding transformation matrices in reference to local (bone specific) Optotrak coordinate systems not global.
Femur
It is assumed that all the registration marker locations described below are obtained following the protocol described above. Variables to establish the transformation matrix between femur and joint testing coordinate systems are:
: center of the central/posterior registration marker on the femur in Optotrak global coordinate system
: center of the lateral registration marker on the femur in Optotrak global coordinate system
: center of the medial registration marker on the femur in Optotrak global coordinate system
: origin of the femur fixed registration marker coordinate system in Optotrak global coordinate system
: xaxis of the femur fixed registration marker coordinate system in Optotrak global coordinate system
: yaxis of the femur fixed registration marker coordinate system in Optotrak global coordinate system
: zaxis of the femur fixed registration marker coordinate system in Optotrak global coordinate system
: transformation matrix from femur fixed registration marker coordinate system to Optotrak global coordinate system
The transformation matrix between femur and joint testing coordinate system can be obtained as:
Variables to establish the transformation matrix between femur and imaging coordinate systems are:
: center of the central/posterior registration marker on the femur in anatomical imaging coordinate system
: center of the lateral registration marker on the femur in anatomical imaging coordinate system
: center of the medial registration marker on the femur in anatomical imaging coordinate system
: origin of the femur fixed registration marker coordinate system in anatomical imaging coordinate system
: xaxis of the femur fixed registration marker coordinate system in anatomical imaging coordinate system
: yaxis of the femur fixed registration marker coordinate system in anatomical imaging coordinate system
: zaxis of the femur fixed registration marker coordinate system in anatomical imaging coordinate system
: transformation matrix from femur fixed registration marker coordinate system to anatomical imaging coordinate system
The transformation matrix between femur and imaging coordinate system can be obtained by following the steps already outlined above.
Tibia
It is assumed that all the registration marker locations described below are obtained following the protocol described above. Variables to establish the transformation matrix between tibia and joint testing coordinate systems are:
: center of the central/posterior registration marker on the tibia in Optotrak global coordinate system
: center of the lateral registration marker on the tibia in Optotrak global coordinate system
: center of the medial registration marker on the tibia in Optotrak global coordinate system
: origin of the tibia fixed registration marker coordinate system in Optotrak global coordinate system
: xaxis of the tibia fixed registration marker coordinate system in Optotrak global coordinate system
: yaxis of the tibia fixed registration marker coordinate system in Optotrak global coordinate system
: zaxis of the tibia fixed registration marker coordinate system in Optotrak global coordinate system
: transformation matrix from tibia fixed registration marker coordinate system to Optotrak global coordinate system
The transformation matrix between tibia and joint testing coordinate system can be obtained through similar calculations conducted for femur above. Variables to establish the transformation matrix between tibia and imaging coordinate systems are:
: center of the central/posterior registration marker on the tibia in anatomical imaging coordinate system
: center of the lateral registration marker on the tibia in anatomical imaging coordinate system
: center of the medial registration marker on the tibia in anatomical imaging coordinate system
: origin of the tibia fixed registration marker coordinate system in anatomical imaging coordinate system
: xaxis of the tibia fixed registration marker coordinate system in anatomical imaging coordinate system
: yaxis of the tibia fixed registration marker coordinate system in anatomical imaging coordinate system
: zaxis of the tibia fixed registration marker coordinate system in anatomical imaging coordinate system
: transformation matrix from tibia fixed registration marker coordinate system to anatomical imaging coordinate system
The transformation matrix between tibia and imaging coordinate system can be obtained by following the steps outlined for the femur, see above.
Patella
The following information should be available from CAD drawing of the patella registration marker assembly:
: divot coordinates on patella registration marker assembly in CAD coordinate system (i = 1 to 12)
: center of the central/superior registration marker on the patella in CAD coordinate system
: center of the lateral registration marker on the patella in CAD coordinate system
: center of the medial registration marker on the patella in CAD coordinate system
The location of divot coordinates should be measured during specimen preparation:
: divot coordinates on patella registration marker assembly in Optotrak global coordinate system (i = 1 to 12)
Singular value decomposition, e.g. Söderkvist and Wedin (1993), using divot coordinates measured in two coordinate systems can provide the following transformation matrix:
: transformation matrix from CAD based registration marker coordinate system to Optotrak global coordinate system
Using center of patella registration markers with this transformation matrix one can obtain:
: center of the central/superior registration marker on the patella in Optotrak global coordinate system
: center of the lateral registration marker on the patella in Optotrak global coordinate system
: center of the medial registration marker on the patella in Optotrak global coordinate system
: transformation matrix from patella fixed registration marker coordinate system to Optotrak global coordinate system
The transformation matrix between patella and joint testing coordinate system can be obtained by following the steps outlined for the femur, see above.
Variables to establish the transformation matrix between patella and imaging coordinate systems are:
: center of the central/superior registration marker on the patella in anatomical imaging coordinate system
: center of the lateral registration marker on the patella in anatomical imaging coordinate system
: center of the medial registration marker on the patella in anatomical imaging coordinate system
: origin of the patella fixed registration marker coordinate system in anatomical imaging coordinate system
: xaxis of the patella fixed registration marker coordinate system in anatomical imaging coordinate system
: yaxis of the patella fixed registration marker coordinate system in anatomical imaging coordinate system
: zaxis of the patella fixed registration marker coordinate system in anatomical imaging coordinate system
: transformation matrix from patella fixed registration marker coordinate system to anatomical imaging coordinate system
The transformation matrix between patella and imaging coordinate system can be obtained by following the steps outlined for the femur, see above.
References
Söderkvist I, Wedin PA. Determining the movements of the skeleton using wellconfigured markers. J Biomech. 1993 Dec;26(12):14737. PubMed