Learn R Programming

ANTsR (version 0.7.2.0)

writeNormalizedPopulationData: Save normalized population data to a directory or h5 file

Description

This function simplifies the steps of saving a population (image) analysis into an efficient hdf5 file, using the h5 library or to a directory. The data frame with population demographics. The number of matrix columns will be defined by a mask that the user should also supply. Finally, a boolean vector should be passed in that matches the images to the demographics. This function cannot check if the matching between demographics and images is correct and, as such, the user should take care in creating the inputs. WARNING: the demographics file will currently be cast to a data.matrix so one should not reuse this file as the reference demographics file.

Usage

writeNormalizedPopulationData(demographics, imageMat, imageMask, imageBoolean,
  filename)

Arguments

demographics

data frame that identifies the variables of interest.

imageMat

a matrix that stores the normalized image data.

imageMask

mask with number of non-zero entries defining the matrix columns.

imageBoolean

a vector of booleans with length equal to the number of rows in the demographics data frame and number of true values equal to the number of rows in the image matrix.

filename

output filename for hdf5 file (if .h5) or directory name.

Value

successOrFailure boolean

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
ilist = getANTsRData( "population" )
mask = getMask( ilist[[ 1 ]] )
imat = imageListToMatrix( ilist, mask )
demog = data.frame( id = c("A","B","C",NA),
  age = c( 11, 7, 18, 22 ), sex = c("M","M","F","F") )
ibool = c( TRUE, TRUE, TRUE, FALSE )
if ( usePkg( "h5" ) ) writeNormalizedPopulationData( demog, imat, mask, ibool,
  tempfile(fileext=".h5") )
# }

Run the code above in your browser using DataLab