Differences between revisions 40 and 41
Revision 40 as of 2016-11-01 15:15:03
Size: 11040
Editor: 139
Comment:
Revision 41 as of 2016-11-01 15:24:57
Size: 11202
Editor: 139
Comment:
Deletions are marked like this. Additions are marked like this.
Line 166: Line 166:
{{attachment: repeatability_example.png}}   * Script outputs the trial number of the differences that are further than 2 standard deviations from the mean difference.
{{attachment:repeatability_example.png|Bland Altman Plot Example|height=700}}

Target Outcome

Prerequisites

Protocols

File Association

  1. Setting up the Directory
    1. Download and unpack the subject folder and place in MULTIS_trials folder
    2. The folder/file configuration should be the following
      • MULTIS_trials

        • MULTIS###-# (Subject folder containing all data)

          • Configuration - Configuration files and subject XML

          • Data - All "tdms" files

          • Ultrasound - All "dicom" files

      • PulseWidths300.csv - contains key to decode file association pulse

      • PythonScripts

        • FileAssociation.py

        • manualMatcherFA.py

        • plotterFA.py

        • XMLparser.py

        • dataAnalysis.py

        • tdsmParserMultis.py

  2. Running the File Association script
    1. Install libraries as needed
    2. Change Directory to match desired Subject ID
    3. Ensure Plot is True to save all verification plots
    4. Run script.
    5. Check directory in file browser under the subject folder for the following additions
      • FileAssociationPNG - folder
      • TimeSynchronization.txt - file containing trial numbers and delta T's of accepted trials only

      • MULTIS###-#readme.txt - human readable file which summarizes the file matching
  3. Manually Matching
    1. Open the 'MULTIS###-#readme.txt' file
      • Note the Unmatched and Accepted Trials, specifically the binary column
    2. Examine any files beginning with 'NMa', meaning no match found
      1. Locate the start and end pluses, each a burst of two peaks.
      2. Compare the binary of the trial run number to each of the pulse sequences found in the 'NMa' png's. Note the file names of each. At this point, it is known which file each of the missing accepted trial numbers belong to.
    3. Open the manualMatcherFA.py and plotterFA.py python scripts.

    4. Change the directory file names in the manualMatcherFA script to a pair of matching files found in step 2. Only one pair of files will be compared at a time. The files will be imported to the plotterFA script automatically.

    5. Run the plotterFA.py script, ensuring iteration is set to zero.
    6. Examine the figure generated.
      1. The pulse extracted from the dicom (bottom of figure) should match the pulse from the tdms file (top of figure). Note the dicom pulse will not always begin at the left most portion of the window as it is a continuous loop in the ultrasound machine.
      2. As before, locate the beginning and ending double pulses.
      3. Count the number of peaks present in the dicom pulse.
      4. Count the number of RWaves in the generated figure.
      5. It is likely that one or more of the RWaves are missing, as that is why the files did not match.
    7. Change the iteration from 0, to 1, to 2, and so on and re-plot each time until the RWaves appear to line up with the pulse peaks in the top figure.
    8. Identify which peaks have RWaves, and which do not.
      1. Each of the peaks in the upper figure has a number associated with it in the script. Starting from 0, instead of 1, the peaks are named accordingly.
      2. Record which peaks have RWaves. For example. (1,2,5,6) may have RWaves.
  4. Sample RWave analysis

    • 9 . Return to manualMatcherFA.py

      1. Ensure iteration is set to 2.
      2. Change the chosenRwaves variable to reflect the the recorded RWaves i.e. (1,2,5,6)
      3. Run the script
      4. Check the following items
        1. The filename of the dicom and tdms changed appropriately
        2. The trial number and time synch were added to
        3. The updated PNG was added to the FileAssociationPNG folder

Quality Assurance

  1. Setting up the Directory
    • same as file association with the addition of folders created by file association
  2. Running the dataAnalysis.py script
    1. Change Directory to reflect subject ID
    2. Run script
    3. Check the following
      1. A folder named AnalysisPNG should appear under MULTIS###-#

      2. 56 png files should be found within this folder
  3. Analysis
    1. There are two types of figures
      • Anatomical
        • 3 dicom images (at 1st pulse, minimum force, last pulse) over load cell data
      • Indentation
        • 4 dicom images (at pre, start, middle, max indentation) over load cell data
  4. Anatomical Analysis

  5. Indentation Analysis

Thickness Measurements

Version 1.0 places red circles at the coordinates of the previous frame that was analyzed, starting with the second frame. Version 1.1 moves red circles to the location with the closest matched distribution to the coordinates in the previous frame, starting with the second frame.

  1. Setting up the Directory
    1. Download and unpack the desired Subject ID folder, make sure you use the 'associated' data if you do not want to associate the files yourself.

      Note: If you have just completed the file association, confirm that the dicom and tdms files within the Ultrasound and Data folders have been matched (should begin with a three digit number) and that the corresponding deltaT values (as xml files) are located in the TimeSynchronization folder.

  2. The folder/file configuration should be the following
    • MULTIS###-# (Subject folder containing all data - the required data for the thickness measurements is shown below)

      • Configuration - Contains subject xml file for accepted trials

      • Data - Contains tdms files

      • Ultrasound - Contains dicom files

      • TimeSynchronization - Contains xml files with deltaT values for matched trials

  3. Required Python scripts
    • TA_sfm_v#.#.py

    • tdsmParserMultis.py

    • XMLparser.py

    • Plot_thicknessForce.py

  4. Running the manual thickness measurement script
    1. Install libraries as needed
    2. Change the directory to match where the Python scripts are located
    3. Run script
      • The first dialog window will allow you to select the Subject folder (you may also choose to hard code the path to the Subject folder, found within the getFiles() function)
        • Browse through to find the location of this folder and click 'ok'
      • A list will appear in another window which will show all the trials for that subject (you may have to scroll down to see the entire list)
      • Double-click on the location you would like to analyze
        • Example List of Locations to be Analyzed for one Subject

      • After a couple of seconds, the first image will appear
        • The program behaves differently depending on if the trial is anatomical or indentation
          • Anatomical - The program begins with the frame corresponding to the lowest resultant force
          • Indentation - The program begins with the frame that corresponds to the beginning of indentation
      • Drag the red dots so that the center of the dot is over each boundary (use the built in matplotlib toolbar to zoom in if needed)
        • Superficial Skin
        • Skin/Fat boundary
        • Fat/Muscle boundary
        • Muscle/Bone boundary
      • When you are happy with your selection, press 'enter' on your keyboard and the results will be calculated and saved to an xml file
        • Manual Thickness Analysis

      • To analyze the next image, hit the 'Next Image' button
      • Anatomical trials will give you the image corresponding to the next lowest force, until all frames within the first pulse and last pulse range have been analyzed
      • Indentation trials will give you the next image in the sequence until reaching the maximum force
      • You may end the program at any time by clicking the 'Save and Quit' button
      • The xml file that was saved will be re-formatted using pretty print
      • A PNG folder within the Analysis folder will be created that has saved images of the first frame that was analyzed as well as a graph showing the force/thickness relationships

      • All windows will be closed and the script will stop running
        • Example graph showing the force/thickness relationships

  5. Data storage
    • The xml file will be named using the tdms filename with '_manThick'+ time stamp appended
      • Version of software used for analysis (TA_sfm.py)
      • File Info includes the time stamp at the beginning of analysis as well as the user name at the time of program execution
      • Subject shows the MULTIS ID name
      • Source shows the Filename of the data (tdms) file
    • A new 'Frame' child is appended for each frame that is analyzed
      • The Frame child includes the following information:
        • Value - Frame number
        • Time - Reference time from the ultrasound time vector data (in ms)
        • Forces - Forces in the x, y, and z directions (in N)
        • Moments - Moments in the x, y, and z directions (in Nm)
        • Thicknesses - Skin, Fat, and Muscle layers (in mm)
          • XML results output

Multiple Subject Summary

  1. What you will need
    1. mass_analysis.py
    2. Subject xml files to include in the summary
  2. Running the summary script
    • Change the directory name to the main folder (containing all subjects)
    • A list of available subjects will appear, check the boxes of the subjects that you would like to include in the summary (use the 'Select All' button to automatically select all boxes)
    • Click 'Okay' and the script will run
    • A figure with all of the data will appear, refer to the attached example figure and key with the description of variables. summary_example.pngkey.png

Repeatability & Reproducibility

  • Bland & Altman plots showing the thicknesses of the first frame of each location that was analyzed (Plot_thicknessForce_reliability_ALL.py)

    • Blue line shows the mean difference
    • Red lines show 2 standard deviations above and below the mean difference
    • Script outputs the trial number of the differences that are further than 2 standard deviations from the mean difference.

Bland Altman Plot Example

Automated Thickness Measurement Development

  • Note: The automated development has been suspended until data is collected on additional subjects.
  • Texture analysis of boundaries (transducer/skin, skin/fat, fat/muscle, and muscle/bone)
    • Extract rectangles (3mm x 6mm) with boundary located in center
    • Analyze by regions
      • Fit to a Gaussian curve (average horizontally and then normalize by peak intensity)
      • Examine moments of the image using skimage.measure module (Hu's moments, first invariant is analogous to moment of inertia)

Initial results report (using 12 locations from MULTIS-001-1): report1.pdf

Specifications/DataAnalysis (last edited 2019-02-27 19:25:15 by owings)