Skip to content

Commit

Permalink
Merge pull request #16 from brudfors/fix-dependencies
Browse files Browse the repository at this point in the history
Fix dependencies
  • Loading branch information
brudfors authored Nov 23, 2021
2 parents fdeee7b + f825ec6 commit bfe2905
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,27 @@ An installation-free demo of UniRes is available in Colab:

## 1. Python

### 1.1. Dependencies
The *NITorch* package is required to use *UniRes*; simply follow the quickstart
guide on its GitHub page: https://github.com/balbasty/nitorch.

Next, activate a *NITorch* virtual environment and move to the *UniRes* project
directory. Then install the package using either setuptools or pip:
``` bash
cd /path/to/unires
### 1.1. Installation
Clone `UniRes`:
```shell
git clone https://github.com/brudfors/UniRes
```
Then `cd` into the `UniRes` folder and install it by:
```shell
pip install .
```
```
**OBS**: The algorithm runs much faster if the compiled backend is used:
```shell
NI_COMPILED_BACKEND="C" pip install --no-build-isolation .
```
However, for running on the GPU, this only works if you ensure that the PyTorch installation uses the same CUDA version that is on your system; therefore, it might be worth installing PyTorch beforehand, *i.e.*:
```shell
pip install torch==1.9.0+cu111
NI_COMPILED_BACKEND="C" pip install --no-build-isolation .
```
where the PyTorch CUDA version matches the output of `nvcc --version`.

### 1.2. Example use cases
### 1.2. Example usage

Running *UniRes* is straight forward. Let's say you have three
MR images: `T1.nii.gz`, `T2.nii.gz` and `PD.nii.gz`, then
Expand Down
18 changes: 10 additions & 8 deletions setup.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from setuptools import setup, find_packages
from setuptools import (setup, find_packages)


setup(
name='unires',
version='0.1a',
packages=find_packages(),
url='https://github.com/brudfors/UniRes',
author='Mikael Brudfors',
author_email='[email protected]',
description='UniRes: Unified Super-Resolution of Medical Imaging Data',
entry_points={'console_scripts': ['unires=unires._cli:run']},
description='UniRes: Unified Super-Resolution of Neuroimaging Data',
python_requires='>=3.6'

install_requires=[
"nitorch[all]@git+https://github.com/balbasty/[email protected]#egg=nitorch",
],
name='unires',
packages=find_packages(),
python_requires='>=3.6',
url='https://github.com/brudfors/UniRes',
version='0.0.1a',
)
3 changes: 2 additions & 1 deletion unires/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ def init(data, sett=settings()):
# Makes recons aligned with same grid, across subjects
sett.do_atlas_align = True
sett.crop = True
sett.pow = 256
if sett.pow == 0:
sett.pow = 256

# Read and format data (images and labels)
x = _read_data(data, sett)
Expand Down

0 comments on commit bfe2905

Please sign in to comment.