remove_neck: Remove Neck from Image

Description Usage Arguments Value Examples

View source: R/remove_neck.R

Description

Removes the neck from axially acquired scan so skull stripping can be done.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
remove_neck(
  file,
  template.file,
  template.mask = NULL,
  ret_mask = FALSE,
  typeofTransform = "Rigid",
  rep.value = 0,
  swapdim = TRUE,
  verbose = TRUE,
  ...
)

Arguments

file

File for neck removal - either filename or class nifti

template.file

Template to warp to original image space

template.mask

Mask of template to use as rough brain mask. If template.file is specified, but template.mask is not, then fslbin(file=template.file) is performed.

ret_mask

Return mask of slices to keep

typeofTransform

Transformation for template to image, passed to ants_regwrite.

rep.value

Value to replace neck slices with

swapdim

Should the dimensions be swapped before registration, and then reset after

verbose

Print out diagnostic messages

...

Additional arguments passed to ants_regwrite

Value

Object of class nifti or vector of indices

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if (fslr::have.fsl()){
  print(fslr::fsl_version())
  in_ci <- function() {
    nzchar(Sys.getenv("CI"))
  }
  if (in_ci()) {
    destfile = tempfile(fileext = ".nii.gz")
    dl = download.file(paste0(
      "https://github.com/muschellij2/",
      "Neurohacking/files/3454385/113-01-MPRAGE2.nii.gz"),
      destfile = destfile)
    tfile = fslr::mni_fname(brain = TRUE)
    if (file.exists(tfile)) {
      res = remove_neck(
        destfile, 
        template.file = tfile,
        template.mask = fslr::mni_fname(brain = TRUE, mask = TRUE)
      )
    }
  }
}

neuroconductor/extrantsr documentation built on Sept. 28, 2020, 11:31 a.m.