Skip to content

Commit d081ec9

Browse files
authored
Merge pull request #66 from KVSlab/update-vmtk
Upgrade morphMan to v.1.2
2 parents 981ab02 + 0ee0538 commit d081ec9

26 files changed

+139
-183
lines changed

.circleci/config.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ workflows:
77
jobs:
88
install-and-test:
99
docker:
10-
- image: cimg/python:3.6
10+
- image: cimg/python:3.10
1111
working_directory: ~/repo
1212
steps:
1313
- checkout
@@ -27,11 +27,11 @@ jobs:
2727
# Set conda parameters
2828
conda config --set restore_free_channel true
2929
conda config --set always_yes yes --set changeps1 no
30-
conda config --add channels vmtk
30+
conda config --add channels conda-forge
3131
conda config --add channels morphman
3232
3333
# Set up environment
34-
conda create -n morphman morphman pytest llvm=3.3
34+
conda create -n morphman morphman
3535
3636
# Activate environment
3737
source activate morphman
@@ -42,11 +42,6 @@ jobs:
4242
# Dependencies for code coverage
4343
pip install pytest-cov codecov
4444
45-
# Edit VMTK files
46-
sed -i -e 's/len(self.SourcePoints)\/3/len\(self.SourcePoints\)\/\/3/g' $HOME/miniconda/envs/morphman/lib/python3.6/site-packages/vmtk/vmtkcenterlines.py
47-
sed -i -e 's/len(self.TargetPoints)\/3/len\(self.TargetPoints\)\/\/3/g' $HOME/miniconda/envs/morphman/lib/python3.6/site-packages/vmtk/vmtkcenterlines.py
48-
sed -i -e 's/(len(values) - 1)\/2/\(len\(values\) - 1\)\/\/2/g' $HOME/miniconda/envs/morphman/lib/python3.6/site-packages/vmtk/vmtksurfacecurvature.py
49-
5045
# Run tests
5146
cd test
5247
pytest --cov=./

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Licence
3737
morphMan is licensed under the GNU GPL, version 3 or (at your option) any
3838
later version.
3939

40-
morphMan is Copyright (2016-2021) by the authors.
40+
morphMan is Copyright (2016-2022) by the authors.
4141

4242
Documentation
4343
-------------
@@ -56,7 +56,7 @@ Installation
5656

5757
For reference, morphMan requires the following dependencies: VTK > 8.1, Numpy <= 1.13, SciPy > 1.0.0, and VMTK 1.4.
5858
If you are on Windows, macOS or Linux you can install all the general dependencies through anaconda.
59-
First install Anaconda or Miniconda (preferably the Python 3.6 version).
59+
First install Anaconda or Miniconda (preferably the Python 3.10 version).
6060
Then execute the following command
6161

6262
conda create -n your_environment -c vmtk -c morphman morphman

appveyor.yml

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,12 @@ environment:
1717
CONDA_INSTALL_LOCN: "C:\\Miniconda-x64"
1818

1919
matrix:
20-
- PYTHON: "C:\\Python35_64"
21-
PYTHON_VERSION: "3.5"
20+
- PYTHON: "C:\\Python39_64"
21+
PYTHON_VERSION: "3.9"
2222
PYTHON_ARCH: "64"
23-
CONDA_PY: "35"
23+
CONDA_PY: "39"
2424
CONDA_NPY: "18"
25-
APP_CONDA_PY: "3.5.1"
26-
27-
- PYTHON: "C:\\Python36_64"
28-
PYTHON_VERSION: "3.6"
29-
PYTHON_ARCH: "64"
30-
CONDA_PY: "36"
31-
CONDA_NPY: "18"
32-
APP_CONDA_PY: "3.6.1"
25+
APP_CONDA_PY: "3.9.1"
3326

3427
platform:
3528
- x64
@@ -43,33 +36,21 @@ install:
4336
- cmd: conda config --set always_yes yes
4437
- cmd: conda update --quiet conda
4538
- cmd: conda install --quiet jinja2 conda-build=3.10.5 anaconda-client
46-
- cmd: conda config --set restore_free_channel true
4739

4840
# Add custom channels
49-
- cmd: conda config --add channels vmtk
41+
- cmd: conda config --add channels conda-forge
5042
- cmd: conda config --add channels morphman
5143

52-
# Install dependencies
53-
- cmd: conda install pytest scipy vtk vmtk python=3.6
54-
5544
# Set up environment
56-
- cmd: conda create -n morphman_env morphman
45+
- cmd: conda create -n morphman morphman pytest
5746

5847
build: false
5948

6049
test_script:
6150
# Activate environment
6251
- cmd: conda init cmd.exe
63-
- cmd: conda activate morphman_env
64-
65-
# Search and replace in vmtkcenterlines.py for / to //
66-
- cmd: sed -i "s/len(self.SourcePoints)\/3/len\(self.SourcePoints\)\/\/3/g" %CONDA_INSTALL_LOCN%\\Lib\\site-packages\\vmtk\\vmtkcenterlines.py
67-
- cmd: sed -i "s/len(self.TargetPoints)\/3/len\(self.TargetPoints\)\/\/3/g" %CONDA_INSTALL_LOCN%\\Lib\\site-packages\\vmtk\\vmtkcenterlines.py
68-
- cmd: sed -i -e "s/(len(values) - 1)\/2/\(len\(values\) - 1\)\/\/2/g" %CONDA_INSTALL_LOCN%\\Lib\\site-packages\\vmtk\\vmtksurfacecurvature.py
52+
- cmd: conda activate morphman
6953

7054
# Start testing
7155
- cd .\\test
72-
- ps: Start-FileDownload 'http://ecm2.mathcs.emory.edu/aneuriskdata/download/C0001/C0001_models.tar.gz'
73-
- tar --force-local -zxvf C0001_models.tar.gz
74-
- del /f C0001_models.tar.gz
7556
- pytest .
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
numpy:
2-
- 1.13.*
2+
- 1.23.*
33

44
python:
5-
- 3.5.1
6-
- 3.6.1
5+
- 3.8.*
6+
- 3.9.*
7+
- 3.10.*
78

89
vtk:
9-
- 8.1.0
10+
- 9.1.*

conda-build/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: "morphman"
3-
version: "1.1"
3+
version: "1.2"
44

55
source:
66
path: ../

demo/demo_manipulate_surface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
default_values["poly_ball_size"] = [250, 250, 250]
4545

4646
# Run manipulation - smooth the entire geometry except aneurysm dome
47-
#manipulate_surface(**default_values)
47+
manipulate_surface(**default_values)
4848

4949
### Add noise to the surface
5050
# Output file path

demo/get_test_data.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,26 @@
55
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
66
## PURPOSE. See the above copyright notices for more information.
77

8-
from os import system, path
8+
from os import system, path, makedirs
99
from sys import platform
1010

1111

1212
def download_case(case):
1313
abs_path = path.dirname(path.abspath(__file__))
14-
output_file = path.join(abs_path, "{}_models.tar.gz".format(case))
15-
url = "http://ecm2.mathcs.emory.edu/aneuriskdata/download/{}/{}_models.tar.gz".format(case, case)
14+
output_file = path.join(abs_path, case, "surface", "model.vtp")
15+
url = "https://github.com/hkjeldsberg/AneuriskDatabase/raw/master/models/{}/surface/model.vtp".format(case)
16+
17+
# Create test data folders
18+
if not path.exists(path.join(abs_path, case, "surface")):
19+
makedirs(path.join(abs_path, case, "surface"))
1620

1721
try:
1822
if platform == "darwin":
19-
system("curl {} --output {}".format(url, output_file))
20-
system("tar -zxvf {}".format(output_file))
21-
system("rm {}".format(output_file))
22-
23+
system("curl -L {} --output {}".format(url, output_file))
2324
elif platform == "linux" or platform == "linux2":
24-
system("wget {}".format(url))
25-
system("tar -zxvf {}".format(output_file))
26-
system("rm {}".format(output_file))
27-
25+
system("wget -O {} {}".format(output_file, url))
2826
elif platform == "win32":
2927
system("bitsadmin /transfer download_model /download /priority high {} {}".format(url, output_file))
30-
system("tar -zxvf {}".format(output_file))
31-
system("del /f {}".format(output_file))
3228

3329
except:
3430
raise RuntimeError("Problem downloading the testdata, please do it manually from "

docs/source/Miscellaneous.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ the geometric properties (curvature and torsion) of the centerline, set with
3838
2. Discrete derivatives (``disc``)
3939
3. VMTK (``vmtk``)
4040

41-
To perform landmarking, we will be using the model with `ID C0001 <http://ecm2.mathcs.emory.edu/aneuriskdata/download/C0001/C0001_models.tar.gz>`_
41+
To perform landmarking, we will be using the model with `ID C0001 <https://github.com/hkjeldsberg/AneuriskDatabase/tree/master/models/C0001>`_
4242
from the Aneurisk database. For the commands below we assume that there is a file `./C0001/surface/model.vtp`, relative to where you execute the command.
4343
To landmark the surface model, run the following command::
4444

@@ -71,7 +71,7 @@ manipulates only the centerline for a range of ``--alpha`` and
7171
``--beta`` values. The resulting 2D data can be fitted to a surface through cubic spline interpolation, from
7272
which one can easily collect appropriate values for ``--alpha`` and ``--beta``.
7373

74-
To estimate :math:`\alpha` and :math:`\beta`, we will be using the model with `ID C0005 <http://ecm2.mathcs.emory.edu/aneuriskdata/download/C0005/C0005_models.tar.gz>`_
74+
To estimate :math:`\alpha` and :math:`\beta`, we will be using the model with `ID C0005 <https://github.com/hkjeldsberg/AneuriskDatabase/tree/master/models/C0005>`_
7575
from the Aneurisk database. For the commands below we assume that there is a file `./C0005/surface/model.vtp`, relative to where you execute the command.
7676

7777
Imagine we are interested in changing the bend angle by :math:`\pm 10^{\circ}`.

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
# -- Project information -----------------------------------------------------
2929

3030
project = 'morphman'
31-
copyright = '2021, Aslak W. Bergersen & Henrik A. Kjeldsberg'
31+
copyright = '2022, Aslak W. Bergersen & Henrik A. Kjeldsberg'
3232
author = 'Aslak W. Bergersen & Henrik A. Kjeldsberg'
3333

3434
# The short X.Y version.
35-
version = '1.1'
35+
version = '1.2'
3636
# The full version, including alpha/beta/rc tags
37-
release = '1.1'
37+
release = '1.2'
3838

3939
# -- General configuration ---------------------------------------------------
4040

docs/source/installation.rst

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
============
44
Installation
55
============
6+
.. highlight:: console
7+
68
morphMan (morphological manipulation) is a collection of scripts to objectively manipulate
79
morphological features of patient-specific vascular geometries. The project is accessible through
810
`GitHub <https://github.com/KVSlab/morphMan/>`_ and `Anaconda <https://anaconda.org/morphman/morphman>`_.
@@ -12,21 +14,24 @@ Compatibility and Dependencies
1214
==============================
1315
The general dependencies of morphMan are
1416

15-
* VMTK 1.4.0
16-
* VTK 8.1.0
17-
* Numpy <= 1.13
18-
* SciPy 1.1.0
19-
* Python (2.7 or >=3.5)
17+
* VMTK 1.5.0
18+
* VTK 9.1.0
19+
* Numpy 1.23
20+
* SciPy 1.8.1
21+
* Python >=3.8
2022

2123
Basic Installation
2224
==================
2325
We recommend that you can install morphMan through Anaconda.
24-
First, install Anaconda or Miniconda (preferably the Python 3.6 version).
25-
Then execute the following command in a terminal window::
26+
First, install `Anaconda <https://www.anaconda.com/products/distribution>`_ or `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`_.
27+
Then execute the following command in a terminal window to create a Conda environment with morphMan installed::
28+
29+
$ conda create -n your_environment -c conda-forge -c morphman morphman
2630

27-
$ conda create -n your_environment -c vmtk -c morphman morphman
31+
.. note::
32+
Replace ``your_environment`` with the environment name.
2833

29-
You can then activate your environment by running ``source activate your_environment``.
34+
You can then activate your environment by running ``conda activate your_environment`` or ``source activate your_environment``.
3035
Now you are all set, and can start using morphMan. morphMan can be accessed by opening a Python console
3136
and typing::
3237

@@ -39,53 +44,32 @@ Alternatively you can use one of the six main methods of manipulation directly t
3944

4045
followed by the command line arguments for the selected method. A detailed explanation for usage of morphMan is described in :ref:`getting_started`.
4146

42-
.. WARNING:: The VMTK version 1.4, the one currently distributed with Anaconda, has a Python3 bug in `vmtkcenterlines` and `vmtksurfacecurvature`. As a workaround you have to change these files. To find out where it is located please execute::
43-
44-
$ which vmtkcenterlines
45-
/Users/[Name]/anaconda3/envs/[your_environment]/bin/vmtkcenterlines
46-
$ python -V
47-
Python 3.6.2 :: Continuum Analytics, Inc.
48-
49-
Now copy the path up until ``[your_environment]`` and add ``lib/python3.6/site-packages/vmtk/vmtkcenterlines.py``. Please change the path separation symbol to match your operating system and change ``python3.6`` to the python version you are using. If you are using Miniconda, replace `anaconda3` with `miniconda3`. Using this path you can run the two following lines::
50-
51-
$ sed -i -e 's/len(self.SourcePoints)\/3/len\(self.SourcePoints\)\/\/3/g' /Users/[Name]/anaconda3/envs/[your_environment]/lib/python3.6/site-packages/vmtk/vmtkcenterlines.py
52-
$ sed -i -e 's/len(self.TargetPoints)\/3/len\(self.TargetPoints\)\/\/3/g' /Users/[Name]/anaconda3/envs/[your_environment]/lib/python3.6/site-packages/vmtk/vmtkcenterlines.py
53-
54-
Similarly, for `vmtksurfacecurvature.py`, run the following command::
55-
56-
$ sed -i -e 's/(len(values) - 1)\/2/\(len\(values\) - 1\)\/\/2/g' /Users/[Name]/anaconda3/envs/[your_environment]/lib/python3.6/site-packages/vmtk/vmtksurfacecurvature.py
57-
58-
59-
.. WARNING:: Some users may experience the following Python compatibility issue::
60-
61-
ModuleNotFoundError: No module named 'vtkRenderingOpenGL2Python'
62-
63-
To fix this issue, a temporary solution is the install the ``llvm`` library directly in the virtual environment, using the following commands::
64-
65-
$ conda config --set restore_free_channel true
66-
$ conda install llvm=3.3
67-
6847
Development version
6948
===================
7049

7150
Downloading
7251
~~~~~~~~~~~
7352
The latest development version of morphMan can be found on the official
7453
`morphMan git repository <https://github.com/KVSlab/morphMan>`_ on GitHub.
75-
Make sure Git (>=1.6) is installed, which is needed to clone the repository.
54+
Make sure `Git <https://git-scm.com/>`_ is installed, which is needed to clone the repository.
7655
To clone the morphMan repository, navigate to the directory where you wish
7756
morphMan to be stored, type the following command, and press Enter::
7857

79-
$ git clone https://github.com/KVSlab/morphMan
58+
$ git clone https://github.com/KVSlab/morphMan
8059

60+
If it not already present, this will install Python for you.
8161
After the source distribution has been downloaded, all the files required will be located
8262
in the newly created ``morphMan`` folder.
8363

8464
Building
8565
~~~~~~~~
8666
In order to build and install morphMan, navigate into the ``morphMan`` folder, where a ``setup.py``
8767
file will be located. First, make sure that all dependencies are installed. Then, building and installation of morphMan
88-
can be performed by simply running the following command from the terminal window::
68+
can be performed with ``pip`` by running the following command::
69+
70+
$ python -m pip install .
71+
72+
Alternatively, morphMan can be installed using Python directly (deprecated)::
8973

9074
$ python setup.py install
9175

0 commit comments

Comments
 (0)