This function reads a file created by writeNormalizedPopulationData.

readNormalizedPopulationData(filename)

Arguments

filename

input filename for hdf5 file.

Value

list containing demographics, imageMat, imageMask and imageBoolean

Author

Avants BB

Examples

tfn <- system.file("extdata", "normpop.h5", package = "ANTsR")
if (file.exists(tfn)) {
  dlist <- readNormalizedPopulationData(tfn)
}
if (FALSE) { # \dontrun{
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)
}
} # }