Add or replace lines in the header of a nrrd file
AddOrReplaceNrrdHeaderField(infile, outfile, newfields, Force = FALSE, Detached = FALSE, action = c("addreplace", "addonly", "replaceonly"))
infile | Path to input file |
---|---|
outfile | Path to output file |
newfields | Named character vector of fields to replace (see details) |
Force | Overwrite existing file (default FALSE) |
Detached | Write a detached header insted of a nrrd (default FALSE) |
action | addreplace (Default) addonly or replaceonly |
TRUE or FALSE depending on success
Input is a named vector of new fields. Use unnamed fields for comments. Quote field names with spaces (conventionally with back ticks). Note that this function will error out for invalid field names. See http://teem.sourceforge.net/nrrd/format.html for nrrd field details
Note that newfields
should specify the complete replacement line as
a string (not the individual values for fields containing multiple
elements) without the leading field name (see examples).
read.nrrd.header
# NOT RUN { AddOrReplaceNrrdHeaderField(lhmaskfile,outfile=file.path(tmpdir,"LHMask.nrrd"), c("# My interesting comment",`space origin`="(2,2,2)"),Force=TRUE) # }