DualDXA MatlabCode_processingSteps_v1 David Wagner, 9/17/13 This is a readme file that provides a brief description of some of the code files/folders in the current directory. The files are related to the VA pilot project titled, "Assessing Skeletal Risk During Rehabilitation in Patients after Chronic Disuse," (1I21RX000920-01; GRANT11015652; PI: Beaupre) that we have nicknamed 'DualDXA'. FOLDER /analyzeCTImage/ - a folder that contains code for processing outputted pQCT scanned files. pQCT files are named I00nnnnn.Mxx. Files from the scan have the same nnnnn, while xx refer to different slices within the same scan, and count incrementally using a Hex base (e.g., 01…08,09,0A,0B,0C,0D,0E,0F,10,11,12…18,19,1A,1B, etc.). Open the main_calculateSectionPropsFromCT_DualDXA.m file (this is the entrance to running the code in this folder. Before running the code, first move the pQCT files into this folder, then copy the file names of those pQCT files into fileNameList{} (inside main_calculateSectionPropsFromCT_DualDXA.m). You should copy the file names in hex order, as that corresponds to the order they were scanned. This may be a different order than is displayed in Windows File explorer. To run the code, open Matlab, change to the /analyzeCTImage directory, and type main_calculateSectionPropsFromCT_DualDXA at the prompt. When the code runs, you will be asked to contour the bone manually. Due to the thin cortical shell and low mineral density in the distal femur region, I am currently recommending to perform a tight contour around the periosteal surface. I conducted some initial tests. It looks like a tight contour closely around the bone, with the threshold to 0, will get us an area (and computed areal MOI variables) that are close to those computed using the pQCT software contouring algorithm 31/2 that produces reasonable plots and results. Copy the output_axialSlice values (with rows corresponding to files in fileNameList) and columns corresponding to: [I_AP, I_ML, I_AP+30, I_AP-30, PolarMOI, I_min, I_max, Ixy_AP_ML_Axes] to the DualDXA_pQCT_ORS2014_unsmoothed_CURRENT.xlsx, sheet pQCT data. FOLDER /DXAparser/ - a folder that contains code for processing single and multiple DXA files. Start by copying the dxa files (AP, ML, APplus30, APminus30, + repeats?) into this folder. Start with main_calculateMOI_fromBMDmap_ORS2014.m. You will need to process each .Rxx/.Pxx using the GUI to create a .mat file with the same name. Copy the filename of the file you want to process into the filename variable at the top of the code. Run main_calculateMOI_fromBMDmap_ORS2014.m, if this is the first time running the code with this file, the GUI will start up to help create the .mat file. When the GUI starts up do the following steps: 1. Click the load file button at the bottom of the GUI box and select the .Rxx file you want to process 2. Click the Global ROI button (nothing will happen, but just click it…) 3. Click the Auto Contour button, you will be prompted to then left click on the inside of the bone. 4. The analysis will be run for the auto contour. If for some reason the contour does not look appropriate, close the plots that were opened and in the main GUI, click Edit Contour 4b. Editing the contour - left click and drag any/all vertices as necessary. When done, double click on a vertex to accept the entire contour. Note that you can use the zoom and move plot features to help get a better view of the contour. 5. When happy with the contour (green line in GUI), then click the Calc_MOI button (shouldn't be necessary, but just do it anyway). 6. Then click the Export AllData button and either keep the filename or change it. Now that a .mat file has been created, re-run main_calculateMOI_fromBMDmap_ORS2014.m Copy the Izz values, which are the density scaled MOI values for each vertical line (starting at the left side of the image and moving to the right). Copy these into a spreadsheet with a corresponding header documenting AP/ML/APplus30/APminus30 and specimen name and repetition. See DualDXA_pQCT_ORS2014_unsmoothed_CURRENT.xlsx as an example, sheet 'DXA data_raw'. Repeat processing steps above for all the DXA files that were exported from the scanner. When have data for AP, ML, APPlus30 and APminus30, make a new spreadsheet and align all the data such that the first row of non-zeros is the same for 4 columns of data (see DXA data_aligned sheet in DualDXA_pQCT_ORS2014_unsmoothed_CURRENT.xlsx for example). Open main2_processMOI_DXAdata_ORS2014.m. Copy the aligned data into the imageDerivedData variable. Run main2_processMOI_DXAdata_ORS2014. Copy the 5 output columns from the matlab window to columns J-N in the DualDXA_pQCT_ORS2014_unsmoothed_CURRENT.xlsx DXA data_aligned spreadsheet. I have verified that the calculations of Ixy, Ix, Imin and Imax are all equivalent to the those values when the equations in Cleek and Whalen 2002 are used. I didn't just type those equations in, but rederived them (in an unsimplified form) from equations in my Engineeing Mechanics of Solids book. To get the angle, as defined in Cleek and Whalen, use equation A.8 and A.9 (can implement in spreadsheet). The angle I calculate is the angle required to rotate the image to align the I_AP axis to the Imax axis. I do not report this angle, but it is available after running the matlab code as estimatedMOIstruct.thetatoAlignI_AP_toImax. FOLDER /Other code/ => folder with some other code files I have written. main3_createPlots_ORS2014.m may be of some interest as it is an example of plotting/processing the output data from the /analyzeCTImage/ folder and the /DXAparser folder/.