/DLICV

A repository that allows users to apply the DLICV method to their brain imaging data.

Primary LanguagePythonOtherNOASSERTION

DLICV - Deep Learning Intra Cranial Volume

Overview

DLICV uses a trained nnUNet model to compute the intracranial volume from structural MRI scans in the nifti image format, oriented in LPS orientation.

Installation

As a python package

pip install DLICV

Directly from this repository

git clone https://github.com/CBICA/DLICV
cd DLICV
conda create -n DLICV -y python=3.8 && conda activate DLICV
pip install .

Using docker

docker pull aidinisg/dlicv:0.0.0

Usage

A pre-trained nnUNet model can be found in the DLICV-0.0.0 release as an artifact. Feel free to use it under the package's license.

Import as a python package

from DLICV.compute_icv import compute_volume

# Assuming your nifti file is named 'input.nii.gz'
volume_image = compute_volume("input.nii.gz", "output.nii.gz", "path/to/model/")

From the terminal

DLICV --input input.nii.gz --output output.nii.gz --model path/to/model

Replace the input.nii.gz with the path to your input nifti file, as well as the model path.

Example:

Assuming a file structure like so:

.
├── in
│   ├── input1.nii.gz
│   ├── input2.nii.gz
│   └── input3.nii.gz
├── model
│   ├── fold_0
│   ├── fold_1
│   │   ├── debug.json
│   │   ├── model_final_checkpoint.model
│   │   ├── model_final_checkpoint.model.pkl
│   │   ├── model_latest.model
│   │   ├── model_latest.model.pkl
│   └── plans.pkl
└── out

An example command might be:

DLICV --input path/to/input/ --output path/to/output/ --model path/to/model/

Using the docker container

In the docker container, the default model is included, but you can also provide your own.

Without providing a model:

docker run --gpus all -it --rm -v /path/to/local/input:/workspace/input \
                               -v /path/to/local/output:/workspace/output \
                               aidinisg/dlicv:0.0.0  -i input/ -o output/

Providing a model:

docker run --gpus all -it --rm -v /path/to/local/model:/workspace/model \
                               -v /path/to/local/input:/workspace/input \
                               -v /path/to/local/output:/workspace/output \
                               aidinisg/dlicv:0.0.0  -i input/ -o output/  --model model/

Contact

For more information, please contact CBICA Software.

For Developers

Contributions are welcome! Please refer to our CONTRIBUTING.md for more information on how to report bugs, suggest enhancements, and contribute code.

If you're a developer looking to contribute, you'll first need to set up a development environment. After cloning the repository, you can install the development dependencies with:

pip install -r requirements-test.txt

This will install the packages required for running tests and formatting code. Please make sure to write tests for new code and run them before submitting a pull request.

Running Tests

You can run the test suite with the following command:

pytest