check_nifti-methods: Check if nifti image or read in a nifti image

Description Usage Arguments Value Author(s) See Also Examples

Description

Simple check to see if input is character or of class nifti

Usage

 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = TRUE,
  ...
)

## S4 method for signature 'nifti'
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = TRUE,
  ...
)

## S4 method for signature 'character'
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = TRUE,
  ...
)

## S4 method for signature 'factor'
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = TRUE,
  ...
)

## S4 method for signature 'list'
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = TRUE,
  ...
)

## S4 method for signature 'array'
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = FALSE,
  ...
)

## S4 method for signature 'anlz'
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = TRUE,
  ...
)

## S4 method for signature 'ANY'
check_nifti(
  x,
  reorient = FALSE,
  allow.array = FALSE,
  fast = FALSE,
  need_header = TRUE,
  ...
)

Arguments

x

character path of image or an object of class nifti, or array

reorient

(logical) passed to readnii if the image is to be re-oriented

allow.array

(logical) Are array types allowed (TRUE) or should there be an error if the object is not character or class nifti.

fast

if TRUE, then fast_readnii will be used versus readnii if the files need to be read in.

need_header

if TRUE, then an image type with header information will be returned. If not, then an array is fine. Used really only in conjunction with allow.array

...

additional arguments to pass to readnii if relevant

Value

nifti object or array if allow.array=TRUE and x is an array

Author(s)

John Muschelli muschellij2@gmail.com

See Also

readnii

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
x = nifti()
check_nifti(x)
set.seed(5)
dims = rep(10, 4)
arr = array(rpois(prod(dims), lambda = 2), dim = dims)
nim = oro.nifti::nifti(arr)
check_nifti(nim)
check_nifti(as.anlz(nim))
testthat::expect_error(check_nifti(arr, allow.array = FALSE))
tfile = tempimg(nim)
check_nifti(c(tfile, tfile))
check_nifti(list(tfile, tfile))
check_nifti(factor(c(tfile, tfile)))
check_nifti(RNifti::readNifti(tfile))

neuroconductor-releases/neurobase documentation built on Nov. 12, 2020, 7:47 p.m.