window_img: nifti image windower

Description Usage Arguments Value See Also Examples

View source: R/window_img.R

Description

Windows an image to min and max values and also changes cal_max and cal_min parameters

Usage

1
2
3
4
5
6
window_img(
  x,
  window = c(0, 100),
  replace = c("window", "missing", "zero"),
  ...
)

Arguments

x

is either a character name for the image or an object of class nifti

window

numeric of length 2 that gives min and max for window

replace

either "window" if the any values outside of c(min, max) are set to the min or max or "missing" for these to be set to NA

...

not used

Value

Object of class nifti

See Also

readnii

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  set.seed(5)
  dims = rep(10, 3)
  arr = array(rnorm(prod(dims)), dim = dims)
  nim = oro.nifti::nifti(arr)
  window_img(nim, window = c(1, 5))
  window_img(nim, window = c(1, 5), replace = "missing")
  tfile = tempimg(nim)
  window_img(tfile)
  window_img(as.factor(tfile))
  arr = window_img(img_data(nim))
  rnim = RNifti::readNifti(tfile)
  window_img(rnim, window = c(1, 5))
  range(window_img(rnim, window = c(1, 5)))
  window_img(rnim, window = c(1, 5), replace = "missing")
  range(window_img(rnim, window = c(1, 5), replace = "missing"))
   

neuroconductor-devel-releases/neurobase documentation built on May 6, 2020, 4:25 p.m.