This repo represents a collection of tools that were developed to characterize brain lesions of patients from the Vietnam Head Injury Study (VHIS) dataset (Raymont et al. 2011). It aims to replace the Analysis of Brain Lesions (ABLe) software (Solomon et al. 2007; Makale et al. 2002) that is not supported any more.
The compute_lesion_ROI_overlap.m
script produces the tables containing information about the supplied binary lesion masks, including:
- the overall lesion size (in voxels) and volume (in cm3),
- the extent of lesion overlap with different anatomical ROIs (in voxels and cm3),
- the percentage of a lesion falling into each anatomical ROI,
- the percentage of each anatomical ROI impacted by a lesion.
This script automates the procedure that can be done manually in MRIcroGL, as demonstrated in this video tutorial, and allows to do it for multiple lesion masks in one batch.
The script requires the SPM12 toolbox for MATLAB to be installed. Download the spm12
folder and add it to the MATLAB path. If a Mac refuses to run Mex files called by SPM, override the Gatekeeper in the Terminal by typing the following (replace LOCATION_OF_SPM
with the path where it’s stored):
sudo xattr -r -d com.apple.quarantine LOCATION_OF_SPM
sudo find LOCATION_OF_SPM -name \*.mexmaci64 -exec spctl --add {} \;
Copy and paste the anatomical atlas (both the .nii
and the .xml
) you want to use to spm12/atlas
or spm12/tpm
. A few atlases in the MNI space are provided with this code in the subfolder "MNI_atlases", including:
- three versions of the AAL atlas for SPM:
- AAL (2×2×2 mm voxels)
- AAL3v1 (2×2×2 mm voxels)
- AAL3v1_1mm (1×1×1 mm voxels)
- version of the Brodmann atlas, copied and modified from MRIcroGL’s predecessor MRIcron. Note that numbers in ROI names in brodmann.xml need to be zero-padded, otherwise
spm_atlas.m
will lump all double-digit ROIs into the corresponding single-digit one (so thatroi1
,roi11
,roi17
,roi18
androi19
will all be extracted intoroi1
). To find the atlases supplied with MRIcron or MRIcroGL on a Mac computer, go to Applications → right-click on the MRIcron/MRIcroGL icon to invoke the context menu → Show Package Contents
→ MRIcron: Contents/resources/templates
→ MRIcroGL: Contents/Resources/atlas
The compute_lesion_ROI_overlap.m
script takes three inputs:
atlas_name
— file name (without the extension) of the anatomical atlas of choice, that needs to be stored inspm12/atlas
orspm12/tpm
lesion_folder
— name of the subfolder containing the binary lesion masksvoxel_volume_cm3
— voxel volume in cm3; e.g., 1-mm isotropic voxel has the volume of (1^3)/10= 0.001 cm3; 2-mm isotropic voxel has the volume of (2^3)/1000 = 0.008 cm3
Make sure that the anatomical atlas and the lesion masks are in the same space (e.g., MNI) and have the same dimensions and resolution (voxel size). To check voxel size in MRIcroGL, right-click on the atlas name in the Layers window → Show Header.
Supplementary tools:
extract_all_atlas_rois_as_nii.m
— export anatomical ROIs from an atlas to separate.nii
files; the output of running this function on brodmann.nii is stored in the subfolder "ROIs_brodmann"flip_nii_files_LR.m
— flip images, in case the L-R orientation is not recognized correctly by the imaging software/image viewer; uses theflip_lr.m
function from the Tools for NIfTI and ANALYZE Image toolboxresample_nii_files_1mm.m
— resample images to 1×1×1 mm; uses thereslice_nii.m
function from the Tools for NIfTI and ANALYZE Image toolboxsplit_bilateral_rois_into_LvsR.tcsh
— a piece of T-shell code calling the AFNI function3dcalc
to split the bilateral Brodmann ROIs into two hemispheric ROIs; the output of running this function on the files stored in the subfolder "ROIs_brodmann" is saved in the same folder