pylarid

Load Arrays of Imaging Data


Keywords
mri, fmri
License
MIT
Install
pip install pylarid==0.1.dev0

Documentation

pylarid: Load Arrays of Imaging Data

pylarid is a Python extension module that is intended to facilitate analysis of functional magnetic resonance imaging (fMRI) datasets. pylarid provides a class for loading datasets as NumPy arrays.

Run-time Dependencies

Running pylarid requires CPython 3.9.1 or newer and NumPy 1.20.1 or newer.

Building pylarid

To build and install pylarid from source, CMake and a C compiler that supports C11 are required. The nifti1.h and nifti2.h header files are also required. These headers provide the NIfTI-1.1 and NIfTI-2 file format specifications. nifti1.h and nifti2.h are available from the Neuroimaging Informatics Technology Initiative. To specify where nifti1.h and nifti2.h are located on the build system, use the CMake options -DNIFTI1_DIR= and -DNIFTI2_DIR= or set the environment variables NIFTI1_DIR and NIFTI2_DIR.

There are two methods for building and installing pylarid from source: scikit-build and manual build.

Build using scikit-build (recommended)

The recommended method for building and installing pylarid from source uses setuptools and scikit-build. This method is recommended because installation of official releases via pip will use scikit-build.

To install build-time and run-time dependencies from PyPI, use the following (preferably in a Python virtual environment):

pip install --upgrade pip setuptools numpy scikit-build

If CMake is not already installed, the PyPI version can be used:

pip install cmake

To build pylarid from the latest source code and install in development mode, use the following:

git clone git@github.com:jme2041/pylarid.git
cd pylarid
python setup.py build develop

The default build is a release build. For a debug build, use:

python setup.py build develop --build-type=Debug

To uninstall, use:

pip uninstall pylarid

The test_pylarid folder contains tests. To run individual categories of unit test, specify the name of the test as an argument to python -m unittest. For example:

python -m unittest test_pylarid.test_larid --verbose
python -m unittest test_pylarid.test_dset --verbose
python -m unittest test_pylarid.test_morder --verbose
python -m unittest test_pylarid.test_cast --verbose
python -m unittest test_pylarid.test_rescale --verbose

To run all tests, use:

python -m unittest --verbose

Manual build using CMake (advanced)

To build and install pylarid directly using CMake (without setuptools or scikit-build), use the following (preferably in a Python virtual environment):

git clone git@github.com:jme2041/pylarid.git
cd pylarid
mkdir build
cd build
cmake ..
make
make install

To uninstall, delete the larid folder from the site-packages directory. To find the full path to the larid folder, start Python and run:

import os
import larid
os.path.dirname(os.path.realpath(larid.__file__))

License

Copyright (c) 2021, Jeffrey M. Engelmann

pylarid is released under the revised (3-clause) BSD license. For details, see LICENSE.txt.