oasis_preproc: OASIS Image Preprocessing

Description Usage Arguments Value Examples

View source: R/oasis_preproc.R

Description

This function does the required preprocessing for OASIS for the FLAIR, T2, T1, and PD volumes using FSL through fslr. The preprocessing steps are (1) inhomogeneity correct using fsl_biascorrect and (2) rigid registration using flirt to the T1 space.

Usage

1
2
oasis_preproc(flair, t1, t2, pd = NULL, brain_mask = NULL, verbose = TRUE,
  cores = 1)

Arguments

flair

FLAIR volume of class nifti

t1

T1 volume of class nifti

t2

T2 volume of class nifti

pd

PD volume of class nifti

brain_mask

binary mask volume of class nifti

verbose

a logical value for printing diagnostic output

cores

numeric indicating the number of cores to be used (no more than 4 is useful for this software implementation)

Value

Returns a list of objects of class nifti, namely the inhomogeneity corrected FLAIR, T1, T2, and PD registered to the space of the T1 volume.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(neurobase)
dl_file = function(url) {
   tfile = tempfile(fileext = ".nii.gz")
   req <- httr::GET(url,
   httr::write_disk(path = tfile))
   httr::stop_for_status(req)
   tfile
}
in_ci <- function() {
 nzchar(Sys.getenv("CI"))
}
on_cran = function() {
 identical(Sys.getenv("NOT_CRAN"), "false")
} 
if (in_ci() || on_cran()) {
  if (fslr::have.fsl() && require(httr)) {
    mods = c("FLAIR", "T1W", "T2W", "consensus_gt", "brainmask")
    base_url = file.path(
      "https://raw.githubusercontent.com/muschellij2/open_ms_data", 
      "master/cross_sectional/coregistered/patient01/")
    files = paste0(base_url, mods, ".nii.gz")
    files = sapply(files, dl_file)
    names(files) = mods

    flair <- readnii(files["FLAIR"])
    t1 <- readnii(files["T1W"])
    t2 <- readnii(files["T2W"])
    brain_mask <- readnii(files["brainmask"])
    gold_standard = readnii(files["consensus_gt"])
    oasis_preprocessed_data <- oasis_preproc(flair, t1, t2, 
      brain_mask = brain_mask)
  } 
}

Example output

Loading required package: oro.nifti
oro.nifti 0.7.2

oasis documentation built on May 2, 2019, 2:31 a.m.

Related to oasis_preproc in oasis...