##### Child pages
• z_*OBSOLETE* Calculate Rigid Body Motion in Matlab

# Page History

## Key

• This line was removed.
• Formatting was changed.

# Background

Despite the high precision of the biplanar fluoroscopy system, digitized data contain errors compounded from several potential sources. (1) The undistortion relies on accurately determining the centroids of the grid. Image quality and/or imperfection in flattening the grid may cause small error. (2) camera calibration provides a "best estimate" of camera position based on digitized clicks on the image and the "true" measured distances of the points on the calibration object. Digitizing error and/or offsets in the calibration object point distances can also add uncertaintly. (3) Digitizing, whether automated or by hand can also add error and finally (4) 3D reconstruction between the two cameras may also add error.

Even very small error for individual markers can cause larger and more noticeable errors in rigid object orientation. This is clearly visible as "jittery bones" when raw data are used to drive animations.

## Two Smoothing Steps

1. "Smart" smoothing. - using "measured" intermarker distances from CT data to constrain digitized data

2. Standard smoothing - butterworth filter to remove high frequency noise from bone orientations

### "Smart" smoothing - basic instructions

What you need:

What to do:

• Open matlab and type smoothData
• Wiki Markup
You will be asked for the $prefix$xyzpts file. Select it.
• You will then be asked for the CT Marker coordinate file. Select it.
• Input how many bones
• Select the markers associated with bone1 and click OK
• Repeat last for all other bones
• Wiki Markup
Save the output file (default is $prefix$xyzpointsBones.csv)

What you get:

• The .csv file contains 6 columns per bone. 3 translations and 3 rotations
• This format can be read in maya using impRigid. see maya animation step 4
• You will probably get a less jittery but not perfect animation using only this smoothing step. Continue to Standard smoothing for best results.

### Standard Smoothing

under construction

# *** OBSOLETE, DO NOT USE ***

## Calculate Rigid Body Motion

1. Type rigidBody into the MATLAB commandline.
2. Select the .csv file with your calculated CT marker coordinates.
3. Select your unfiltered (xyzpts.csv) or filtered (xyzptsButter##.csv) data file.
4. Type the number of bones in the input box.
5. Select the markers associated with each bone (omit any markers with all NaNs, i.e. markers that were not digitized).
6. Save the file output.
##### Other details:
• rigidBody calls 2 additional scripts: svdrigid and mayaMatrixFormat
• svdrigid takes marker data for a single bone and outputs rotations and translations
• mayaMatrixFormat converts the framex3x3 rotation matrices and framex3 translations and converts them to a framex16 rotation matrix in a Maya-friendly format
• you need a minimum of 3 markers per bone in order for the program to have enough information to calculate the rigid body motion.