whitestripe: Performs White Stripe of T1 or T2 Images

View source: R/whitestripe_ind.R

whitestripeR Documentation

Performs White Stripe of T1 or T2 Images

Description

Returns the mean/sd of the whitestripe and indices for them on the image

Usage

whitestripe(
  img,
  type = c("T1", "T2", "FA", "MD", "first", "last", "largest"),
  breaks = 2000,
  whitestripe.width = 0.05,
  whitestripe.width.l = whitestripe.width,
  whitestripe.width.u = whitestripe.width,
  arr.ind = FALSE,
  verbose = TRUE,
  stripped = FALSE,
  slices = NULL,
  ...
)

Arguments

img

Image (T1, T2, FA, or MD). Array or object of class nifti

type

T1, T2, FA, or MD image whitestripe

breaks

Number of breaks passed to hist

whitestripe.width

Radius of the white stripe

whitestripe.width.l

Lower Radius of the white stripe

whitestripe.width.u

Upper Radius of the white stripe

arr.ind

Whether indices should be array notation or not, passed to which

verbose

Print diagnostic information

stripped

Applying to skull-stripped image. NOTE: This does NOT do a subset of slices, as make_img_voi.

slices

slices to use for make_img_voi if only a subset to estimate the distribution.

...

Arguments to be passed to get.last.mode

Details

This function takes in an image and computes a window of the distribution called the white stripe. If you wish to pass in values you have subset, such as single from a skull-stripped image, you can pass in img and set the class to img_voi (class(img) = "img_voi") and this will not rerun make_img_voi.

Value

List of indices of whitestripe, last mode of histogram, array/nifti of 0/1 corresponding to the mask, mean of whitestripe, standard deviation of whitestripe

Examples

## Not run: 
library(WhiteStripe)
lib.loc = tempdir()
if (WhiteStripe::download_img_data(lib.loc = lib.loc)){
library(oro.nifti)
set.seed(1)
t1 = readNIfTI(system.file("T1Strip.nii.gz", package="WhiteStripe",
lib.loc = lib.loc))
t1.ind = whitestripe(t1, "T1")
set.seed(2)
t1_2 = readNIfTI(system.file("T1Strip.nii.gz", package="WhiteStripe",
lib.loc = lib.loc))
t1_2.ind = whitestripe(t1_2, "T1") 
t1.mask = whitestripe_ind_to_mask(t1, t1.ind$whitestripe.ind)
t1.mask[t1.mask == 0] = NA
orthographic(t1, t1.mask, col.y="red")
t2 = readNIfTI(system.file("T2Strip.nii.gz", package="WhiteStripe",
lib.loc = lib.loc))
t2.ind = whitestripe(t2, "T2")
t2.mask = whitestripe_ind_to_mask(t2, t2.ind$whitestripe.ind)
t2.mask[t2.mask == 0] = NA
orthographic(t2, t2.mask, col.y="red")
}

## End(Not run)

muschellij2/WhiteStripe documentation built on May 10, 2024, 1:31 a.m.