readNormalizedPopulationData: Read normalized population from h5 file or directory

Description Usage Arguments Value Author(s) Examples

View source: R/writeNormalizedPopulationData.R

Description

This function reads a file created by writeNormalizedPopulationData.

Usage

1

Arguments

filename

input filename for hdf5 file.

Value

list containing demographics, imageMat, imageMask and imageBoolean

Author(s)

Avants BB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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)

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