whitestripe: Performs White Stripe of T1 or T2 Images

Description Usage Arguments Details Value Examples

View source: R/whitestripe_ind.R

Description

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

Usage

1
2
3
4
5
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

 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
## 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)

Example output

Warning messages:
1: In download.file(url, urlfile, quiet = TRUE) :
  URL http://muschellij2.github.io/WhiteStripe/T1Strip.nii.gz: cannot open destfile '/T1Strip.nii.gz', reason 'Permission denied'
2: In download.file(url, urlfile, quiet = TRUE) :
  download had nonzero exit status
3: In download.file(url, urlfile, quiet = TRUE) :
  URL http://muschellij2.github.io/WhiteStripe/T2Strip.nii.gz: cannot open destfile '/T2Strip.nii.gz', reason 'Permission denied'
4: In download.file(url, urlfile, quiet = TRUE) :
  download had nonzero exit status

WhiteStripe documentation built on April 19, 2018, 1:04 a.m.