This repository contains research and project code for using implicit neural representations with magnetic resonance (MR) images.
To quickly recreate the development environment, install the anaconda packages found in
mrinr.txt
and the pypi packages found in requirements.txt
. For example:
# Clone the repository
git clone git@github.com:TylerSpears/mr-inr.git
cd mr-inr
# Make sure to install mamba in your root anaconda env for package installation.
# Explicit anaconda packages with versions and platform specs. Only works on the same
# platform as development.
mamba create --name mrinr --file mrinr.txt
# Move to the new environment.
conda activate mrinr
# Install pip packages, try to constrain by the anaconda package versions, even if pip
# does not detect some of them.
pip install --requirement requirements.txt --constraint pip_constraints.txt
# Install as a local editable package.
pip install -e .
If the previous commands fail to install the environment (which they likely will), then the following notes should be sufficient to recreate the environment.
- All package versions are recorded and kept up-to-date in the
environment/
directory. If you encounter issues, check these files for the exact versions used in this code. Further instructions are found in the directory'sREADME.md
. - If the various
jax
andjaxlib
packages are giving installation errors, try theenvironment/mrinr_pip_only_no_jax_requirements.txt
file. Jax is only an optional requirement (mostly used for GPU tractography), and this environment file comments out anyjax
packages or their associatednvidia-*
packages. - All packages were installed and used on a Linux x86-64 system with Nvida GPUs. Using this code on Windows or Mac OSX is not supported.
- This environment is managed by
mamba
, which wrapsanaconda
.mamba
requires that no packages come from thedefaults
anaconda channel (see https://mamba.readthedocs.io/en/latest/user_guide/troubleshooting.html#using-the-defaults-channels for details). All anaconda packages come from the following anaconda channels:conda-forge
pytorch
nvidia
simpleitk
mrtrix3
nodefaults
(simply excludes thedefaults
channel)
- Various packages conflict between
anaconda
and pypi, and there's no great way to resolve this problem. Generally, you should installanaconda
packages first, thenpip install
packages from pypi, handling conflicts on a case-by-case basis. Just make sure that pip does not overridepytorch
packages that make use of the GPU. - The
jax
andjaxlib
packages are installed withpip
, but are hosted on Google's repositories. So, installing from therequirements.txt
will usually fail. See thejax
installation docs at https://jax.readthedocs.io/en/latest/installation.html#pip-installation-gpu-cuda-installed-via-pip-easier for details on installingjax
andjaxlib
. - The
antspyx
package is not versioned because old versions of this package get deleted from pypi. See https://github.com/ANTsX/ANTsPy#note-old-pip-wheels-will-be-deleted
To install this repository as a python package, install directly from github:
pip install git+ssh://git@github.com/TylerSpears/mrinr.git
To install an editable version for development:
pip install -e .