Package 'neuronorm'

Title: Preprocessing of Structural MRI for Multiple Neurodegenerative Diseases
Description: Preprocessing pipeline for normalizing and cleaning T1-weighted, T2-weighted and FLAIR MRI images coming from different sources, diseases, patients, scanners and sites.
Authors: David Payares [aut, cre], Jorge Mateu [ctb], Wiebke Schick [ctb], Nicholas J. Tustison [cph], Brian B Avants [cph], Philip A. Cook [cph], Yuanjie Zheng [cph], Alexander Egan [cph], Paul A. Yushkevich [cph], James C. Gee [cph], M. Grossman [cph], Jean-Philippe Fortin [cph], Elizabeth M. Sweeney [cph], John Muschelli [cph], Ciprian M. Crainiceanu [cph], Russell T. Shinohara [cph], Yongyue Zhang [cph], J. Michae Brady [cph], Stephen Smith [cph]
Maintainer: David Payares <[email protected]>
License: GPL-2
Version: 1.0.2
Built: 2024-12-05 07:14:13 UTC
Source: CRAN

Help Index


Create a vector of the corregistered images based on the available MRI images modalities.

Description

This function creates a vector of coregistered T2-weighted and/or FLAIR images for a patient. The vector contains a vector of length one for only one MRI modality (T2-weighted or FLAIR) or a vector of length two including both modalities (T2-weighted or FLAIR).

Usage

coregistration_images(vector)

Arguments

vector

output object from the coregistration function.

Value

vector of coregistered images based on modalities available.


Create a vector of inhomogeneity corrected images based on the available MRI images modalities.

Description

This function creates a vector of imhomogeneity corrected images for a patient. The vector contains a vector of the length of the MRI modalities (T1-weighted, T2-weighted and/or FLAIR).

Usage

create_bias_list(modalities, bias_T1, list_corregister)

Arguments

modalities

vector of strings containing the modalities to be preprocessed. It must always contains the T1-weighted sequence scan.

bias_T1

bias image in NifTI format.

list_corregister

list of paths of corregisted images.

Value

vector of inhomogeneity corrected images based on modalities available.


Create a vector of strings with the MRI modalities available in a patient's folder.

Description

This function creates a vector with the name of the image modalitities for a patient.

Usage

get_modalities(patient)

Arguments

patient

paths of MRI scans per patient.

Value

vector of strings containing the modalities available for a patient.


Wrapper function for RAVEL normalization of T1-weighted images

Description

Ravel intensity normalization using control voxels and clinical covariates.

Usage

image_normalization_ravel(
  masked.paths,
  csf.paths,
  ravel.paths,
  demographics,
  brain.mask,
  patients.folder,
  modality = "T1"
)

Arguments

masked.paths

list or vector of paths of the preprocessed input NIfTI images to be normalized.

csf.paths

NIfTI image paths for the binary control region masks.

ravel.paths

list or vector of paths of the output NIfTI images.

demographics

table of covariates associated to the MRI scans. Number of rows should be equal to the number of images.

brain.mask

NIfTI image path for the binary brain mask. Must have value 1 for the brain tissue and 0 otherwise.

patients.folder

folder to save the output control mask.

modality

string describing the modality to perform the normalization. It should be one of T1, T2 or FLAIR.

Value

RAVEL-corrected images are saved in disk.

Author(s)

David Payares

References

Jean-Philippe Fortin, Elizabeth M Sweeney, John Muschelli, Ciprian M Crainiceanu, Russell T Shinohara, Alzheimer’s Disease Neuroimaging Initiative, et al. Removing inter-subject technical variability in magnetic resonance imaging studies. NeuroImage, 132:198–212, 2016.

Examples

## Not run: 
# Get general folder
folder <- system.file("extdata", package = "neurodata")
# Get covariates
covariates <- system.file("covariates.txt", package = "neurodata")
# Read covariates information
clinical_info <- read.csv(file = covariates, sep = ';')

# Defining the RAVEL output files for the patients
# with a T2-weighted sequence (patient 1,2 and 4)
patients <- c(1,2,4)
output_files <- lapply(patients, function(x) {
           file.path(folder, paste0("patient0",x),"T2_ravel.nii.gz")})

# Getting the files of the preprocessed images (without intensity normalization)
# and the CSF masks computed by the preprocessing.
csf_paths <- lapply(paths_preprocess_patients[patients], function(x){x$csf_mask})
masked_paths <- lapply(paths_preprocess_patients[patients], function(x){x$stripped[2]})

Subseting covariares info
cov_pat <- clinical_info[clinical_info$patient %in% patients,]

Normalizing T2 sequences with RAVEL
image_normalization_ravel(masked.paths = masked_paths, csf.paths = csf_paths,
                         ravel.paths = output_files, demographics = cov_pat,
                         brain.mask = atlas_mask, patients.folder = folder,
                         modality = "T2")


## End(Not run)

Load MRI per group or disease

Description

This function loads the MRI scans from multiple patients. It assumes that the patients' folders containing the MRI scans are sub-folders of a general folder.

Usage

load_mri_group(folder)

Arguments

folder

general folder containing the sub-folders with the MRI scans.

Value

paths of MRI scans per patient if they exist.


Load MRI scans per patient

Description

This function loads the MRI scans from a patient. It assumes that the MRI scans are contained in the same folder and refer to MRI modalities T1-weighted, T2-weighted and FLAIR. Only the first MRI scan that matched the modalities keywords ('T1','T2' or 'FLAIR') will be kept.

Usage

load_mri_patient(folder, modalities = c("T1", "T2", "FLAIR"))

Arguments

folder

folder containing the MRI scans. The MRI scans should be in format NiFTI.

modalities

string or vector of strings with the MRI modalities to be considered. Should be at least one of T1, T2 or FLAIR. By default, all modalities are searched within the folder.

Value

paths of MRI scans for a patient if they exist.


Preprocess group of MRI scan for one patient

Description

This function preprocesses raw T1-weighted, T2-weighted and FLAIR MRI scans and generates a segmentation MRI scan using the FAST algorithm. The preprocesising steps comprises imhomogeneity correction 'N4', coregistration of other sequences to the T1-weighted scan, non-linear registration to the MNI152 template with an isotropic voxel size of 1mm, using the 'SyN' transformation, skull stripping, brain segmentation and intensity normalization using the RAVEL or White Stripe algorithms.

Usage

preprocess_modalities(
  mri.patient,
  folder.patient,
  modalities,
  atlas,
  mask,
  inhomogeneity = "N4",
  transformation = "SyN"
)

Arguments

mri.patient

path of the MRI scans.

folder.patient

folder containing the MRI scans. This folder usually refers to the patient.

modalities

vector of strings containing the modalities to be preprocessed. It must always contains the T1-weighted sequence scan.

atlas

atlas template in NifTI format to spatially register the MRI scans. By default the MNI152 atlas template is used.

mask

brain mask in NifTI format of the atlas template to performed the skull stripping.

inhomogeneity

inhomogeneity correction algorithm to be applied. The correction by default is the 'N4' bias correction.

transformation

non-linear transformation for registering the T1-w MRI scan to the reference template. 'SyN' transformation is used by default.

Value

paths of preprocessed MRI scans.

Author(s)

David Payares

References

Nicholas J. Tustison, Brian B. Avants, Philip A. Cook, Yuanjie Zheng, Alexander Egan, Paul A. Yushkevich, and James C. Gee. N4ITK: Improved N3 Bias Correction. IEEE Trans Med Imaging, 29:1310–1320, 2010.

B. B. Avants, C. L. Epstein, M Grossman, J. C. Gee Symmetric diffeomorphic image registration with cross-correlation: evaluating automated labeling of elderly and neurodegenerative brain. Medical Image Analysis, 12:1310–1320, 2008.

Evans, A.C., Fox, P.T., Lancaster, J., Zilles, K., Woods, R., Paus, T., Simpson, G., Pike, B., Holmes, C., Collins, D.L., Thompson, P., MacDonald, D., Iacoboni, et al. A probabilistic atlas and reference system for the human brain: International Consortium for Brain Mapping (ICBM). Philos. Trans. R. Soc. London B Biol, 356:1293-1322, 2001.

Yongyue Zhang, J. Michael Brady, Stephen Smith Hidden Markov random field model for segmentation of brain MR image. Medical Imaging 2000: Image Processing, 2000.

Jean-Philippe Fortin, Elizabeth M Sweeney, John Muschelli, Ciprian M Crainiceanu, Russell T Shinohara, Alzheimer’s Disease Neuroimaging Initiative, et al. Removing inter-subject technical variability in magnetic resonance imaging studies. NeuroImage, 132:198–212, 2016.

Examples

## Not run: 
# Get general folder
folder <- system.file("extdata", package = "neurodata")
# Get covariates
covariates <- system.file("covariates.txt", package = "neurodata")
# Read covariates information
clinical_info <- read.csv(file = covariates, sep = ';')

# Folder of the patient
patient_folder <- file.path(folder,"patient01")

# Getting the paths of the MRI scan sequences for one patient
# the NeuroNorm built-in function load_mri_patient() can be used for this.
sequences <- load_mri_patient(patient_folder)

# Getting preferred atlas template and template mask
# Using the MNI152 template available in the MNITemplate package
library(MNITemplate)
atlas <- getMNIPath()
atlas_mask <- readMNI("Brain_Mask")

# Preprocessing the patient's sequences
patient_preprocessed_mri <- preprocess_modalities(mri.patient = sequences,
                                                  folder.patient = patient_folder,
                                                  modalities = c('T1','T2','FLAIR'),
                                                  atlas = atlas, mask = atlas_mask,
                                                  inhomogeneity = 'N4',
                                                  transformation = 'SyN')



## End(Not run)

Preprocess T1-weighted MRI scan for one patient

Description

This function preprocesses a raw T1-w MRI scan and generates a segmentation MRI scan using the FAST algorithm. The preprocesising steps comprises imhomogeneity correction 'N4', registration to the MNI152 template with isotropic voxel size of 1mm^3 using the 'SyN' transformation, and skull stripping.

Usage

preprocess_modality_t1(
  mri.patient,
  folder.patient,
  atlas,
  mask,
  inhomogeneity = "N4",
  transformation = "SyN"
)

Arguments

mri.patient

path of the T1-weighted scan.

folder.patient

folder containing the T1-weighted scan. This folder usually refers to the patient.

atlas

atlas template in NifTI format to spatially register the T1-weighted scans. By default the MNI152 atlas template is used.

mask

brain mask in NifTI format of the atlas template to performed the skull stripping.

inhomogeneity

inhomogeneity correction algorithm to be applied. The correction by default is the 'N4' bias correction.

transformation

non-linear transformation for registering the T1-w MRI scan to the reference template. 'SyN' transformation is used by default.

Value

paths of preprocessed MRI scans.

Author(s)

David Payares

References

Nicholas J. Tustison, Brian B. Avants, Philip A. Cook, Yuanjie Zheng, Alexander Egan, Paul A. Yushkevich, and James C. Gee. N4ITK: Improved N3 Bias Correction. IEEE Trans Med Imaging, 29:1310–1320, 2010.

B. B. Avants, C. L. Epstein, M Grossman, J. C. Gee Symmetric diffeomorphic image registration with cross-correlation: evaluating automated labeling of elderly and neurodegenerative brain. Medical Image Analysis, 12:1310–1320, 2008.

Evans, A.C., Fox, P.T., Lancaster, J., Zilles, K., Woods, R., Paus, T., Simpson, G., Pike, B., Holmes, C., Collins, D.L., Thompson, P., MacDonald, D., Iacoboni, et al. A probabilistic atlas and reference system for the human brain: International Consortium for Brain Mapping (ICBM). Philos. Trans. R. Soc. London B Biol, 356:1293-1322, 2001.

Yongyue Zhang, J. Michael Brady, Stephen Smith Hidden Markov random field model for segmentation of brain MR image. Medical Imaging 2000: Image Processing, 2000.

Jean-Philippe Fortin, Elizabeth M Sweeney, John Muschelli, Ciprian M Crainiceanu, Russell T Shinohara, Alzheimer’s Disease Neuroimaging Initiative, et al. Removing inter-subject technical variability in magnetic resonance imaging studies. NeuroImage, 132:198–212, 2016.

Examples

## Not run: 
# Get general folder
folder <- system.file("extdata", package = "neurodata")
# Get covariates
covariates <- system.file("covariates.txt", package = "neurodata")
# Read covariates information
clinical_info <- read.csv(file = covariates, sep = ';')

# Folder and T1-weighted file of the patient
patient_folder <- file.path(folder,"patient01")
patient_T1 <- file.path(patient_folder,"patient01_T1.nii.gz")

# Getting preferred atlas template and template mask
# Using the MNI152 template available in the MNITemplate package
library(MNITemplate)
atlas <- getMNIPath()
atlas_mask <- readMNI("Brain_Mask")

# Preprocessing the patient's sequences
patient_preprocessed_mri <- preprocess_modality_t1(mri.patient = patient_T1,
                                                  folder.patient = patient_folder,
                                                  atlas = atlas, mask = atlas_mask,
                                                  inhomogeneity = 'N4',
                                                  transformation = 'SyN')



## End(Not run)

Preprocess MRI scans for multiple patients

Description

This function preprocesses raw T1-weighted, T2-weighted and/or FLAIR MRI scans and generates a brain segmentation MRI scans using the FAST algorithm. The preprocessing steps comprise imhomogeneity correction 'N4', linear coregistration of T2-weighted and/or FLAIR to the T1-weighted, registration of all available modalities to the MNI152 template with an isotropic voxel size of 1mm^3 using the 'SyN' transformation, skull stripping, and RAVEL intensity normalization.

Usage

preprocess_patients(patients.folder, clinical.covariates)

Arguments

patients.folder

general folder containing sub-folders per patient with raw MRI images.

clinical.covariates

data.frame of covariates associated to the MRI scans. Number of rows should be equal to the number of images.

Value

paths of preprocessed MRI scans. MRI preprocessed images are stored in the patient's folder.

Author(s)

David Payares

References

Nicholas J. Tustison, Brian B. Avants, Philip A. Cook, Yuanjie Zheng, Alexander Egan, Paul A. Yushkevich, and James C. Gee. N4ITK: Improved N3 Bias Correction. IEEE Trans Med Imaging, 29:1310–1320, 2010.

B. B. Avants, C. L. Epstein, M Grossman, J. C. Gee Symmetric diffeomorphic image registration with cross-correlation: evaluating automated labeling of elderly and neurodegenerative brain. Medical Image Analysis, 12:1310–1320, 2008.

Evans, A.C., Fox, P.T., Lancaster, J., Zilles, K., Woods, R., Paus, T., Simpson, G., Pike, B., Holmes, C., Collins, D.L., Thompson, P., MacDonald, D., Iacoboni, et al. A probabilistic atlas and reference system for the human brain: International Consortium for Brain Mapping (ICBM). Philos. Trans. R. Soc. London B Biol, 356:1293-1322, 2001.

Yongyue Zhang, J. Michael Brady, Stephen Smith Hidden Markov random field model for segmentation of brain MR image. Medical Imaging 2000: Image Processing, 2000.

Jean-Philippe Fortin, Elizabeth M Sweeney, John Muschelli, Ciprian M Crainiceanu, Russell T Shinohara, Alzheimer’s Disease Neuroimaging Initiative, et al. Removing inter-subject technical variability in magnetic resonance imaging studies. NeuroImage, 132:198–212, 2016.

Examples

## Not run: 
# Get general folder
folder <- system.file("extdata", package = "neurodata")
# Get covariates
covariates <- system.file("covariates.txt", package = "neurodata")
# Read covariates information
clinical_info <- read.csv(file = covariates, sep = ';')
# Preprocess MRI scans: 'N4' inhomogeneity correction,
# 'SyN' non-linear transformation to MNI152 atlas template

# Brain extraction, Spatial informed MRI scan , a.k.a., brain segmentation
# and RAVEL intensity normalization only for T1-w images.
paths_preprocess_patients <- preprocess_patients(folder, clinical_info)
# Outputs paths of the preprocessed MRI scans per patient
# and applied preprocessing.
paths_preprocess_patients$patient02

## End(Not run)