Additional information can be found on the Discussion page.
Target Outcome
To process Tekscan pressure data for a static loading condition (exported as csv file) and generate:
- an XML file containing: averaged pressure data for all temporal frames, contact metrics (force, area, peak pressure)
- an image (png) displayng the averaged pressure data
Prerequisites
Infrastructure
Python. Python is a programming language (GPL compatible license, http://www.python.org/). Python is the default scripting environment for Open Knee(s); for more details, please refer to Infrastructure/ScriptingEnvironment.
SciPy. SciPy is a Python based open-source software for mathematics, science, and engineering (BSD license, see http://www.scipy.org/).
Spyder. Spyder is an interactive development environment for Python with advanced editing, interactive testing, debugging and introspection features (MIT license, see http://code.google.com/p/spyderlib/).
npTDMS. npTDMS is Cross-platform, NumPy based module for reading TDMS files produced by LabVIEW. TDMS files are the binary files used for the robotic testing raw data. (LGPL license, see https://pypi.python.org/pypi/npTDMS/).
Previous Protocols
Requirements
Python [Version 3] [tested with Version 3.3.2] (https://www.python.org)
NumPy [tested with Version 1.9.2] (https://www.numpy.org)
matplotlib [tested with Version 1.4.3] (https://matplotlib.org/)
Python Script
https://simtk.org/websvn/wsvn/openknee/utl/PressureAnalysis/Tekscan_contact_metrics.py
Input
- Tekscan pressure data exported as a csv file, which includes an arbitrary number of temporal frames, at a static loading condition.
- Pressure Sensor:
- VERSION: Tekscan Pressure Measurement System 7.60-18I
- HARDWARE: 102-4201
- MAP_VERSION: 6.4
- SENSOR_TYPE: 5051
Procedures
Import Tekscan Parameters
The script is robust in that in imports both values and units (defaults listed below) from the csv file. Tekscan data imported includes:
- Sensor dimensions
- number of sensel rows
- number of sensel columns
- sensel row dimension (mm)
- sensel column dimension (mm)
- sensel area (mm^2)
- Calibration data
- noise threshold (raw)
- scale factor (MPa/raw)
- exponent
- saturation pressure (MPa)
- calibration points
- force (N)
- sum (raw)
- number of loaded cells
- Pressure array data
- accumulate all temporal pressure frame arrays (MPa) into a single array (for subsequent averaging)
- record number of temporal frames
Compute contact metrics
- contact area (mm^2) = 'number of loaded sensels' * 'sensel area'
- contact force (N) = SUM( 'averaged sensel pressure' * 'sensel area' )
- peak average pressure (MPa)
- location, sensel indices [row,column]
Compute averaged pressure array data
- divide accumulated pressure array by the number of frames
Output
XML file
Includes (as specified above):
- input filename (Tekscan csv)
- imported Tekscan parameters
- contact metrics
- averaged pressure data (numpy array, as string)
Average pressure sensor image
File type: png
- Plot of averaged pressure sensor data (MPa)
- Title includes:
- name of associated xml file that contains the average pressure sensor data
- contact metrics: force (N), area (mm^2)
- peak average pressure (MPa)
- Sensor dimensions: mm
- Colormap scale: [0.0 - 'peak average pressure'] (MPa)
Sample Results
Following are example output files (xml, png) for analysis of oks007 at a flexion angle of 60 degrees and and quadriceps force of 600N.
XML file
<Pressure_Sensor>
<Input_File type="csv">oks007-intact-60-600-2_M.csv</Input_File>
<Dimensions>
<rows units="sensels">44</rows>
<cols units="sensels">44</cols>
<sensel_area units="mm^2">1.6129</sensel_area>
</Dimensions>
<Calibration>
<noise_threshold units="raw">3</noise_threshold>
<scale_factor units="MPa/raw">0.0011882</scale_factor>
<exponent>1.5754</exponent>
<saturation_pressure type="Exponential Extrapolation" units="MPa">7.34773</saturation_pressure>
<Points>
<Point num="1">
<force units="N">49.9998</force>
<sum units="raw">3173</sum>
<loaded_cells units="count">109</loaded_cells>
</Point>
<Point num="2">
<force units="N">100.0</force>
<sum units="raw">5370</sum>
<loaded_cells units="count">135</loaded_cells>
</Point>
<Point num="3">
<force units="N">200.0</force>
<sum units="raw">9195</sum>
<loaded_cells units="count">176</loaded_cells>
</Point>
<Point num="4">
<force units="N">400.0</force>
<sum units="raw">15543</sum>
<loaded_cells units="count">231</loaded_cells>
</Point>
<Point num="5">
<force units="N">599.998</force>
<sum units="raw">21169</sum>
<loaded_cells units="count">268</loaded_cells>
</Point>
</Points>
</Calibration>
<Contact_Metrics>
<area units="mm^2">783.8694</area>
<force units="N">387.19987076</force>
<Peak_Pressure>
<value units="MPa">2.1456</value>
<Location>
<row units="sensels">19</row>
<col units="sensels">40</col>
</Location>
</Peak_Pressure>
</Contact_Metrics>
<Pressure_Array processing="averaged" type="numpy array" units="MPa">array([[0.0000,...],...])</Pressure_Array>
</Pressure_Sensor>
Average pressure sensor image