brackets: Extract or Replace Parts of antsImage Object

Description Usage Arguments Examples

Description

Operators acting on antsImage objects to extract or replace parts.

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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
## S4 replacement method for signature 'antsImage,'NULL',ANY,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,logical,ANY,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,array,ANY,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,matrix,ANY,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,list,ANY,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,antsImage,ANY,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,'NULL',antsRegion,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,logical,antsRegion,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,array,antsRegion,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,matrix,antsRegion,ANY'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,'NULL','NULL',numeric'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,numeric,numeric,numeric'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,numeric,'NULL',numeric'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,'NULL',numeric,numeric'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,numeric,missing,array'
x[i, j, ...] <- value

## S4 replacement method for signature 'antsImage,missing,numeric,array'
x[i, j, ...] <- value

## S4 method for signature 'antsImage,'NULL',ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'antsImage,antsImage,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'ANY,antsImage,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'antsImage,logical,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'antsImage,logical,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'antsImage,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'antsImage,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'antsImage,'NULL','NULL',ANY'
x[i, j, k = NA, l = NA, ...,
  drop]

## S4 method for signature 'antsImage,'NULL','NULL',ANY'
x[i, j, k = NA, l = NA, ...,
  drop]

## S4 method for signature 'antsImage,numeric,numeric,ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,numeric,numeric,ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,numeric,'NULL',ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,numeric,'NULL',ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,'NULL',numeric,ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,'NULL',numeric,ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,missing,numeric,ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,numeric,missing,ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

## S4 method for signature 'antsImage,missing,missing,ANY'
x[i, j, k = NA, l = NA,
  ..., drop]

Arguments

x

antsImage

i

logical or i-th dimension

j

not used or j-th dimension

...

not used

value

value to assign to the subset in assignment operator

drop

method for missing data

k

not used or k-th dimension

l

not used or l-th dimension

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
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
fi <- antsImageRead(getANTsRData( "r16" ))
l = prod(dim(fi))
sub = sample(c(TRUE, FALSE), size = l, replace = TRUE)
fi[sub] = rnorm(sum(sub))
fi[,1] = array(10, dim = dim(fi[, 1]))

fi <- antsImageRead(getANTsRData( "ch2" ))
fi[2, 1, 2]
fi[2, 1, 2] = 4
fi[, 1, 2]
fi[, 1, 2] = array(10, dim = dim(fi[, 1, 2]))
fi[2, , 2]
fi[2, , 2] = array(10, dim = dim(fi[2, , 2]))
fi[2, 1, ]
# fi[2, 1, ] = array(10, dim = dim(fi[2, 1, ]))
fi[2, , ]
fi[, 1, ]
fi[, , 2]
# fi[, , 2] = array(10, dim = dim(fi[, , 2]))

l = prod(dim(fi))
sub = sample(c(TRUE, FALSE), size = l, replace = TRUE)
sub = array(sub, dim = dim(fi))
fi[sub] = rnorm(sum(sub))
fi <- antsImageRead(getANTsRData( "r16" ))
l = prod(dim(fi))
sub = sample(c(TRUE, FALSE), size = l, replace = TRUE)
sub = array(sub, dim = dim(fi))
fi[sub] = rnorm(sum(sub))
fi <- antsImageRead(getANTsRData( "r16" ))
fi[ fi > 200 ] = 200
fi <- antsImageRead(getANTsRData( "r16" ))
i = sample(seq(nrow(fi)), 5)
i = as.numeric(i)
j = i
fi[ i, j ] = 26.2
fi <- antsImageRead(getANTsRData( "r16" ))
fi[1,] = array(10, dim = dim(fi[1,]))
fi <- antsImageRead(getANTsRData( "r16" ))
fi[,1] = array(10, dim = dim(fi[,1]))
fi <- antsImageRead(getANTsRData( "r16" ))
fi[, 1]
fi[, 2:5]
fi <- antsImageRead(getANTsRData( "r16" ))
fi[ fi > 45]
fi <- antsImageRead(getANTsRData( "r16" ))
arr = c(as.array(fi) > 45)
fi[arr]
fi[ 1:10, 2:14]
fi[ 1:10*1.0, 2:14*1.0]
fi <- antsImageRead(getANTsRData( "ch2" ))
fi[, , 2] 

muschellij2/atropos documentation built on Oct. 11, 2018, 12:24 a.m.