jzeyl / Ear-Measures

Custom R scripts to plot 3D wireframe figures and to extract measurements from "*.fcsv" files generated from 3D Slicer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ear-measures

This series of R scripts calculates various 3D distance, angle, and surface areas from 3D coordinate input in the form of *.fcsv files (collected from 3D Slicer) or *.pp files (collected from MeshLab). In addition, there are scripts to plot wireframe renderings of the measurements using the ‘rgl’ package. The permanent doi is here found here DOI

Data inputs

The inputs are a set of four *.fcsv files from 3D slicer and one picked point files (*pp) from Meshlab. Specifically, there are separate coordinates files for tympanic membrane (TM), extracolumella (EC), round window (RW), cochlear aqueduct (CA) and columella footplate (FP):

  1. a *.fcsv file outlining the perimeter of the tympanic membrane with > 20 points
  2. a *.fcsv file with 5 coordinates outlining the following landmarks, in this order:
           (1) tip of umbo
           (2) distal tip of columella
           (3) tip of suprastapedius
           (4) tip of infrastapedius
           (5) tip of endosseous cochlear duct length
  3. a *.pp file from MeshLab outlining the perimeter of the footplate with > 20 points
  4. a *.fcsv file outlining the perimeter of the round window with > 20 points
  5. a *.fcsv file outlining the perimeter of the cochlear aqueduct with > 20 points

Example input coordinates are in the 'Input' folder.

Data outputs

The outputs are three csv files with
(1) the computed values,
(2) tympanic membrane angles, and
(3) the coordinates used for calculations.

Computed values:

Ear region Measurements
Middle ear 1) Height of tympanic membrane protrusion, 2) Distance from columella to tympanic membrane base plane, 3) Extrastapedius length, 4) Columella length, 5) Angle of tympanic membrane,6) Angle between footplate and tympanic membrane, 7) Angle between the columella and the extracolumella, 8) Tympanic membrane area, 9) Footplate area
Inner ear 10) Length of endosseous cochlear duct, 11) Cochlear aqueduct area, 12) Round window area

Scripts

Script for importing the coordinates and running the calculation scripts:

Import, calculate and export MASTER.R

This main script calls the following calculation scripts:

Script file Tasks
1_Tympanic membrane area, EC object coltip 2nd position.R calculations of tympanic membrane area
2_Footplate area.R calculation of footplate area
3_Cochlear aqueduct area.R calculation of cochlear aqueduct area
4_Round window area.R calculation of round window area
5_3D planes of best fit and angles between.R calculation of planes of best fit for the base of the tympanic membrane and the columella footplate, and the angle between these two planes
6_Euclid_dist to plane_ EC length_ col length.R various 3D distance measurements
7_Plotting the shortest distance from point to plane calculations for plotting the shortest distance form a point to a plane
8_TM angles and EC_col angle calculation of angles of the tympanic membrane

The main script also calls a script for plotting the planes and coordinates of the values as a wireframe diagram:

plotearauto.R

alt text

The main script calls an export script, which exports the data in different formats:

outputs.R

For each specimen, the output scripts creates a unique set of data files, labelled with specimen ID and each file placed into one of 5 folders:

Directory Contents of output file
1) Coordinates X,Y,Z coordinates of all points in a single csv file
2) FCSV has fcsv points of all measurements for visualizing the wireframe plots in 3D Slicer
3) Single values the computed measurements from the structures
4) STL files STL files of the wireframe plots
5) TM angles files with the tympanic membrane angles for each 16 perimeter points

About

Custom R scripts to plot 3D wireframe figures and to extract measurements from "*.fcsv" files generated from 3D Slicer


Languages

Language:R 91.4%Language:Pascal 8.6%