brackets: Extract or Replace Parts of antsImage Object

[<-,antsImage,NULL,ANY,ANY-methodR Documentation

Extract or Replace Parts of antsImage Object

Description

Operators acting on antsImage objects to extract or replace parts.

Usage

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

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]

stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.