Skip to content

Commit

Permalink
Merge pull request #4 from pnlbwh/revert-3-revise-installation
Browse files Browse the repository at this point in the history
Revert "Revise installation infrastructure"
  • Loading branch information
tashrifbillah authored Jul 6, 2024
2 parents b121f1c + 9fb9de7 commit 2697f92
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
4 changes: 2 additions & 2 deletions HD_BET/paths.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from os.path import dirname, abspath, join as pjoin
import os

# please refer to the readme on where to get the parameters. Save them in this folder:
folder_with_parameter_files = pjoin(dirname(abspath(__file__)),'params')
folder_with_parameter_files = os.path.join(os.path.expanduser('~'), 'hd-bet_params')
45 changes: 19 additions & 26 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,30 @@ coefficient and -0.80 to -2.75 mm for the Hausdorff distance (Bonferroni-adjuste
- HD-BET is very fast on GPU with <10s run time per MRI sequence. Even on CPU it is not slower than other commonly
used tools.

## Installation Instructions

Psychiatry Neuroimaging Laboratory has redefined the installation scheme for this program to work on
all modern GPUs: RTX 4080, RTX 4090, RTX A6000, A100, and GTX 1080. This redefinition came out of days of research
at Psychiatry Neuroimaging Laboratory, Brigham and Women's Hospital, Boston, Massachusetts. The steps are:
## Installation Instructions
Note that you need to have a python3 installation for HD-BET to work. Please also make sure to install HD-BET with the
correct pip version (the one that is connected to python3). You can verify this using the `--version` command:

```
conda create -y -n hd-bet python=3.6
conda activate hd-bet
git clone --single-branch --branch pnl [email protected]:pnlbwh/HD-BET.git
cd HD-BET/
pip install .
conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia
(dl_venv) fabian@Fabian:~$ pip --version
pip 20.0.2 from /home/fabian/dl_venv/lib/python3.6/site-packages/pip (python 3.6)
```

The last `pytorch-cuda=12.1` makes it possible to run `hd-bet` on our GPUs that are CUDA `v12.*` compatible.
Both channels `-c pytorch -c nvidia` are necessary to install dependencies of `pytorch-cuda=12.1`

After completing installation, you can invoke `hd-bet` by absolute path without sourcing or activating any environment:

> /path/to/miniconda3/envs/hd-bet/bin/hd-bet --help
If it does not show python 3.X, you can try pip3. If that also does not work you probably need to install python3 first.

<details><summary>References</summary>

* https://anaconda.org/pytorch/pytorch-cuda/files
* https://www.reddit.com/r/pytorch/comments/11z9vkf/pytorch_installation_with_cuda_121/
* https://pytorch.org/get-started/locally/
Once python 3 and pip are set up correctly, run the following commands to install HD-BET:
1) Clone this repository:
```bash
git clone https://github.com/MIC-DKFZ/HD-BET
```
2) Go into the repository (the folder with the setup.py file) and install:
```
cd HD-BET
pip install -e .
```
3) Per default, model parameters will be downloaded to ~/hd-bet_params. If you wish to use a different folder, open
HD_BET/paths.py in a text editor and modify ```folder_with_parameter_files```

</details>

## How to use it

Expand Down Expand Up @@ -129,4 +122,4 @@ This depends on your MRI image size. Typical run times (preprocessing, postproce

<sup>1</sup>https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Fslutils

<sup>2</sup>https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Orientation%20Explained
<sup>2</sup>https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Orientation%20Explained
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
numpy>=1.14.5
torch>=0.4.0
scikit-image>=0.14.0
SimpleITK==2.0.2

0 comments on commit 2697f92

Please sign in to comment.