rohanbanerjee / template

A framework for creating unbiased MRI templates of the spinal cord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spinal cord MRI template

Framework for creating unbiased MRI templates of the spinal cord.

Dependencies

SCT is used for all preprocessing steps, including extraction of centerline, generation of average centerline in the template space, and straightening/registration of all spinal cord images on the initial template space.

ANIMAL is used for generating the template, using iterative nonlinear deformation. The recommanded pipeline for generating a template of the spinal cord is the nonlinear symmetrical template model.

Installation:

git clone https://github.com/vfonov/nist_mni_pipelines.git

Add the following lines to you ~/.bashrc (change the path):

export PYTHONPATH="${PYTHONPATH}:path/to/nist_mni_pipelines"
export PYTHONPATH="${PYTHONPATH}:path/to/nist_mni_pipelines/"
export PYTHONPATH="${PYTHONPATH}:path/to/nist_mni_pipelines/ipl/"
export PYTHONPATH="${PYTHONPATH}:path/to/nist_mni_pipelines/ipl"

You will also need to install scoop with: pip install scoop

The Minc Toolkit is a dependency of the template generation process.

On OSX, you may need to recompile Minc Toolkit from source to make sure all libraires are linked correctly.

Install this python library in SCT python.

Get started

The script "pipeline.py" contains several functions to preprocess spinal cord MRI data. Preprocessing includes:

  1. extracting the spinal cord centerline and compute the vertebral distribution along the spinal cord, for all subjects.
  2. computing the average centerline, by averaging the position of each intervertebral disks. The average centerline of the spinal cord is straightened and merged with the ICBM152 template.
  3. generating the initial template space, based on the average centerline and positions of intervertebral disks.
  4. straightening of all subjects on the initial template space

A small dataset, containing 5 T1w and T2w images, is available here and is used as example for preprocessing. The dataset is downloaded automatically by the preprocessing script. To use your own dataset and images, follow the section How to generate your own template?. The data preprocessing is performed by running the script pipeline.py, after making sure to use SCT python:

source sct_launcher
python pipeline.py

One the preprocessing is performed, please check your data. The preprocessing results should be a series of straight images registered in the same space, with all the vertebral levels aligned with each others.

Now, you can generate the template using the IPL pipeline with the following command, where N has to be replace by the number of subjects:

python -m scoop -n N -vvv generate_template.py

How to generate your own template?

The template generation framework can be configured by the file "configuration.json", that includes the following variables:

  • "path_data": absolute path to the dataset, including all images correctly structured.
  • "path_template": absolute path to the output folder, in which the final template will be placed.
  • "subjects": list of subjects names, that must be the same as folder names in the dataset structure.
  • "suffix_centerline": suffix for binary centerline.
  • "suffix_disks": suffix for binary images of the intervertebral disks labeling.
  • "suffix_segmentation": optional suffix for the spinal cord segmentation, that can be used to register the segmentation on the template space and generate probabilistic atlases.

Dataset structure

The dataset should be arranged in a structured fashion, as the following:

  • subject_name/
    • t1/
      • t1.nii.gz
      • t1{suffix_centerline}.nii.gz
      • t1{suffix_disks}.nii.gz
      • t1{suffix_segmentation}.nii.gz
    • t2/
      • t2.nii.gz
      • t2{suffix_centerline}.nii.gz
      • t2{suffix_disks}.nii.gz
      • t2{suffix_segmentation}.nii.gz
    • dmri/
      • dmri.nii.gz
      • dmri{suffix_centerline}.nii.gz
      • dmri{suffix_disks}.nii.gz
      • bvecs.txt
      • bvals.txt
    • ...

Licence

This repository is under a MIT licence.

About

A framework for creating unbiased MRI templates of the spinal cord

License:MIT License


Languages

Language:Python 100.0%