vectorToMultichannel: Convert vector to multichannel 'antsImage'.

Description Usage Arguments Value Author(s) Examples

View source: R/multichannelPCA.R

Description

Converts a vector of size n-entries in mask times number of channels to a multi-channel image with the same dimensionality as the mask.

Usage

1

Arguments

v

input multichannel vector

mask

mask of same dimensionality as multichannelimage

Value

multichannelimage is output

Author(s)

Avants BB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
fi <- antsImageRead(getANTsRData("r16") ) %>%
  resampleImage(c(60,60),1,0)
mi <- antsImageRead(getANTsRData("r64") ) %>%
  resampleImage(c(60,60),1,0)
mytx <- antsRegistration(fixed=fi, moving=mi, typeofTransform = c('SyN') )
mcimg = antsImageRead( mytx$fwd[1] )
msk = getMask( fi )
vv=multichannelToVector(mcimg,msk)
mcimg2=vectorToMultichannel( vv, msk )
vv2=multichannelToVector(mcimg2,msk)
cor.test(vv2,vv)
stopifnot( all( mcimg2[30,30] == mcimg[30,30] ) )

neuroconductor-devel/ANTsR documentation built on April 1, 2021, 1:02 p.m.