Download this repository using git
mkdir -p ~/code & git clone https://github.com/alonsoJASL/imatools ~/code/imatools
Poetry is a tool for dependency management. We create the environment with Anaconda and manage dependencies with Poetry.
- Install Poetry in your computer
- Install Anaconda
- Create a new environment with the file provided:
conda env create -f environment.yaml
- Activate the environment
conda activate imatools
- Install the dependencies using Poetry
poetry install --only main
.
Poetry will read from the poetry.lock file and install the exact dependencies used to develop this project.
If you want to experiment with dependencies versions, delete the lock file and modify the pyproject.toml before
poetry install --only main
Anaconda is useful, but it can be slow at managing dependencies. It is recommended to use poetry.
Setup conda environment
You only need to do this once
Download anaconda, then on a terminal type:
conda create -n imatools python=3.9 -y & conda activate imatools
Copy the following to install the python dependencies of this project
conda install -c conda-forge vtk=9.2.6 simpleitk numpy scipy=1.9.2 matplotlib pandas seaborn networkx scikit-image nibabel pydicom -n imatools -y
Sometimes you will need to set the PYTHONPATH
variable, do this by opening a termina, changing into imatools directory cd /path/to/imatools
and pasting the following:
export PYTHONPATH=$PYTHONPATH:$(pwd)
Open a Terminal. Navigate to the code folder:
cd ~/code/imatools
Activate the anaconda environment
conda activate imatools
Run the volume code by typing
python calculate_volume.py /path/to/file.vtk
You can type
python calculate_volume.py
+ SPACE and then drag the file from Finder into the terminal window if you do not know the path.
While this is OK, it is not necessary as we use VTK 9.2.6, which allows to specify the version of Legacy VTK ASCII files. To use with VTK 8.1 to save vtk meshes in legacy VTK Writer 4.2.
conda create -n vtk81 python=3.6 -y
conda activate vtk81
conda install -c conda-forge vtk=8.1 -y
conda install -c conda-forge numpy -n vtk81 -y
conda install -c conda-forge itk