GithubHelp home page GithubHelp logo

lastatistics's Introduction

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

lastatistics's People

Contributors

drsewilliams avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.