Skip to content

Preprocessing pipelines to use SHIVA tools

Notifications You must be signed in to change notification settings

astudenova/SHIVApreproc

 
 

Repository files navigation

SHIVApreproc

Preprocessing pipelines to use SHIVA tools

Description

This repository contains simple preprocessing pipelines to process raw Nifti images to be ready for SHIVA segmentation tools:

The pipelines performs:

  1. Reorient image to standard (RAS/LAS)
  2. Coregister images to a reference modality (usually T1w)
  3. Resample images to 1x1x1 mm (if needed)
  4. Brain mask generation (if not provided)
  5. Image cropping to 160 × 214 × 176
  6. Intensity normalization inside the brain mask (min-max normalization with the max set to the 99th percentile of the brain voxel values to avoid "hot spots")

Dependency

  • FSL v.6.0.4
  • Nipype v.1.7.0 (python package)
  • If generating brainmask, SMP12 (we are using with Matlab v.R2021a)
  • Note that brainmask can be generated with FSL or SynthSeg (with Freesurfer 7.3.2), but the sample script included here will use SPM

Usage

  1. To preprocess the T1w and FLAIR raw images, please clone this GitHub repository.
  2. In the SHIVApreproc folder, run the following command in the terminal to install the shiva_preproc module:

python setup.py install

  1. Specify the information in config_process_subject.json and subjects_list.txt:
  • config_process_subject.json
{
    "svn_dir": "/path/to/shiva_preproc/folder", 
    "wd": "/path/where/preprocessed/images/will/be/store",
    "data_dir": "/path/to/raw/images",
    "in_dat_tmp": "%s_%s.%s",
    "in_dat_tmp_arg": {
        "T1": [["subject_id", "T1", "nii.gz"]],                        /name of T1w images (subject_id_T1.nii.gz)
        "FLAIR": [["subject_id", "FLAIR", "nii.gz"]],                  /name of FLAIR images (subject_id_FLAIR.nii.gz)
        "brainmask": [["subject_id", "braimask", "nii.gz"]] 
        /if a brain mask (subject_id_brainmask.nii.gz) will be provided rather than generated.  Otherwise delete this line)
        },
    "resampling_to_111": "False",            
     /if raw T1w images needs to be resample to 1 by 1 by 1 mm change to 'True' 
    "path_to_spm": "/path/to/spm",                                   /exapmle:    "/srv/shares/softs/spm12-full", 
    "spm_standalone": "/path/to/spm/standalone",                     /exapmle: "/srv/shares/softs/spm12/run_spm12.sh", 
    "mcr": "/path/to/mcr",                                           /example:     "/srv/shares/softs/MCR/v713" 
    "plugin": "MultiProc",
    "plugin_args": {"n_procs": 25}
}
  • subjects_list.txt Please provide the subject IDs of T1w, FLAIR, (and any other modality to be processed together), and optionally a brain mask (in reference T1w space) you would like to preprocess.
  1. Run the preprocessing_main.py file to start preprocessing the raw images:

python preprocessing_main.py

About

Preprocessing pipelines to use SHIVA tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.4%
  • MATLAB 1.6%