Skip to content

Code to calculate left atrial geometry statistics from a segmentation

Notifications You must be signed in to change notification settings

drsewilliams/LAstatistics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LAstatistics

Code to calculate left atrial geometry statistics from a segmentation

Mitral Valve Geometry

{: .no_toc }

Table of contents

{: .no_toc .text-delta }

  1. TOC {:toc}

Background

This page documents a technique to calculate the area and perimeter of the mitral valve annulus. By specifying the -c flag in the call to LAstatistics.py, it is also possible to output the atrial volume and surface area which may be a better solution than here.

View it on GitHub{: .btn .fs-5 .mb-4 .mb-md-0 }

Quickstart

git clone https://github.com/drsewilliams/LAstatistics LAstatistics
cd LAstatistics
./run.sh ./vtkfiles
hVtk = VTKReader('openfile')
hVtk.readAllData()
h = drawFreeBoundary(hVtk.getTriRep, 'k')
l = lineLength(h)
batchProcessMitralStatistics

Left atrial shells should be placed in the ./vtkfiles subdirectory first. Note it is important not to have a trainling / after the folder specified for the .vtk file locations.

Dependencies

Process

run.sh

The initial run script serves to iterate through every .vtk file in the vtkfile directory. The LAstatistics.py program is called, via pvpython on each file in turn.

LAstatistics.py

This python program does the main body of the work as follows.

  1. Loads a vtk file
  2. Runs Feature Edges to identify the mitral valve annulus
  3. Uses Delaunay 2D followed by Extract Surface to create a mesh of the mitral valve annulus.
  4. By default, this mesh is saved next to the input file with the suffix __MV__.
  5. Uses Append Geometry followed by Extract Surface to create a closed volume representing the LA. By default the closed shell is not written to disk.

LAstatistics.py accepts the following input

`-h` --help
`-i` --the input VTK file
`-c` --specify the output file for the closed mesh (multiple formats are possible including .vtk and .stl). If blank, no file is written to disk.
`-m` --specify the output file for the mitral valve annulus. If blank, no file is written to disk.
`-s` --run in silent mode.

MassProperties

Finally, MassProperties is called on the mitral annulus mesh and the mitral area is calculated. If a closedmesh has been saved by specifying the -c flag in the call to LAstatistics.py, then in addition the left atrial surface area and left atrial volume are also calculated.

MassProperties has to be compiled with VTK, and subsequently placed in a directory on your path, e.g. /Users/<user>/Documents/bin

lineLength.m

The resulting mitral annulus segmentation can be loaded into Matlab using VTKReader, and the length of the perimeter calcualted using freeBoundary and lineLength, all of which are available in the standard WLCD library.

In addition, a batch processing script is available (batchProcessLAStatistics.m) which applies these functions to every .vtk containing __MV__ in the filename. For example,

batchProcessMitralStatistics

Example output

./vtkfiles/leftatriumexample.vtk
===================================

MITRAL VALVE PROPERTIES
Volume: 2265.75
    VolumeX: -2264.47
    VolumeY: -2266.23
    VolumeZ: -2263.78
Area:   2382.81
    MinCellArea: 2.24307e-06
    MinCellArea: 262.869
NormalizedShapeIndex: 1.69005

About

Code to calculate left atrial geometry statistics from a segmentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published