Author: Marta Nuñez-Garcia ([email protected])
Quasi conformal flattening with regional constraints. This algorithm is an extension (simplification) of the left atrial flattening method described in: Fast quasi-conformal regional flattening of the left atrium. Marta Nuñez-Garcia, Gabriel Bernardino, Francisco Alarcón, Gala Caixal, Lluís Mont, Oscar Camara, and Constantine Butakoff. IEEE Transactions on Visualization and Computer Graphics (2020). Please cite this reference when using this code. Preprint available at: arXiv:1811.06896. The code runs in Linux and Windows.
Example:
Python scripts depending (basically) on VTK and VMTK.
Compute 2D LV map using quasi-conformal flattening and 2 spatial constraints: the LV apex is fixed in the center of the disk, and one selected point within the LV base contour is fixed in the external border of the disk where angle = pi.
Launch GUI and ask the user to select 3 seeds (please, see Example image above):
-
LV apex
-
point in the base contour (or close to) that should be placed in pi in the disk
-
point in the base contour (or close to) next to seed 2 and in anticlockwise direction when the RV is located on the left side of the LV. This point is used to find the correct contour direction.
After the quasi-conformal with constraints flattening, a more uniform mesh (spatial distribution of points) is obtained using the radial displacement presented in: "Patient independent representation of the detailed cardiac ventricular anatomy." Bruno Paun, et al. Medical image analysis (2017)
Clone the repository:
git clone https://github.com/martanunez/LV_flattening
cd LV_flattening
flat_LV.py [-h] [--lv_meshfile PATH] [--rv_meshfile PATH] [--n N]
Arguments:
--lv_meshfile PATH path to LV input mesh
--rv_meshfile PATH path to RV input mesh
optional arguments:
-h, --help show this help message and exit
--n N n for radial displacement
python flat_LV.py --lv_meshfile data/lv_mesh.vtk --rv_meshfile data/rv_mesh.vtk
The scripts in this repository were successfully run with:
- Ubuntu 16.04
- Ubuntu 16.04
- Windows 8.1
To install VMTK follow the instructions here. The easiest way is installing the VMTK conda package (it additionally includes VTK, NumPy, etc.). It is recommended to create an environment where VMTK is going to be installed and activate it:
conda create --name vmtk_env
conda activate vmtk_env
Then, install vmtk:
conda install -c vmtk vtk itk vmtk
Nevertheless, for Ubuntu, the easiest option for me was to build VMTK from source (slowly but surely). Instructions can be found here. In brief:
git clone https://github.com/vmtk/vmtk.git
mkdir vmtk-build
cd vmtk-build
ccmake ../vmtk
make
And edit the ~/.bashrc file,
gedit ~/.bashrc
adding the following line: source /home/{your_path_to_vmtk}/vmtk/vmtk-build/Install/vmtk_env.sh
You may need to slightly modify vmtkcenterlines.py from the VMTK package if you encounter the following error when running 1_mesh_standardisation.py:
for i in range(len(self.SourcePoints)/3):
TypeError: 'float' object cannot be interpreted as an integer
Find vmtkcenterlines.py file and edit as follows:
Line 128: change for i in range(len(self.SourcePoints)/3): by for i in range(len(self.SourcePoints)//3):
Line 133: change for i in range(len(self.TargetPoints)/3): by for i in range(len(self.TargetPoints)//3):
The code in this repository is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details: http://www.gnu.org/licenses/