View source: R/writeNormalizedPopulationData.R
readNormalizedPopulationData | R Documentation |
This function reads a file created by writeNormalizedPopulationData
.
readNormalizedPopulationData(filename)
filename |
input filename for hdf5 file. |
list containing demographics, imageMat, imageMask and imageBoolean
Avants BB
tfn <- system.file("extdata", "normpop.h5", package = "ANTsR")
if (file.exists(tfn)) {
dlist <- readNormalizedPopulationData(tfn)
}
## Not run:
ilist <- getANTsRData("population")
mask <- getMask(ilist[[1]])
imat <- imageListToMatrix(ilist, mask)
demog <- data.frame(age = c(11, 7, 18, 22), sex = c("M", "M", "F", "F"))
ibool <- c(TRUE, TRUE, TRUE, FALSE)
tfn <- tempfile(fileext = ".h5")
if (usePkg("hdf5r")) writeNormalizedPopulationData(demog, imat, mask, ibool, tfn)
if (usePkg("hdf5r")) {
dlist <- readNormalizedPopulationData(tfn)
all.equal(dlist$demographics, demog)
all.equal(dlist$imageMat, imat)
all.equal(as.array(dlist$imageMask), as.array(mask))
all.equal(dlist$imageBool, ibool)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.