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.

vectorToMultichannel(v, mask)

Arguments

v

input multichannel vector

mask

mask of same dimensionality as multichannelimage

Value

multichannelimage is output

Author

Avants BB

Examples


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)
#> 
#> 	Pearson's product-moment correlation
#> 
#> data:  vv2 and vv
#> t = 2094398729, df = 1948, p-value < 2.2e-16
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  1 1
#> sample estimates:
#> cor 
#>   1 
#> 
stopifnot(all(mcimg2[30, 30] == mcimg[30, 30]))