data_encoder: Array Data Encoder

Description Usage Arguments Value Examples

View source: R/data_encoder.R

Description

Encodes values for a GIFTI image

Usage

1
2
3
4
5
6
data_encoder(
  values,
  encoding = c("ASCII", "Base64Binary", "GZipBase64Binary"),
  datatype = NULL,
  endian = c("little", "big", "LittleEndian", "BigEndian")
)

Arguments

values

values to be encoded

encoding

encoding of GIFTI values

datatype

Passed to convert_binary_datatype

endian

Endian to pass in readBin

Value

Single character vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
if (have_gifti_test_data(outdir = NULL)) {
   gii_files = download_gifti_data(outdir = NULL)
   L = gifti_list(gii_files[1])
   orig = L$DataArray$Data[[1]]
   encoding = attributes(L$DataArray)$Encoding
   datatype = attributes(L$DataArray)$DataType
   endian = attributes(L$DataArray)$Endian
   vals =  data_decoder(orig, encoding = encoding,
   datatype = datatype, endian = endian)
   enc = data_encoder(vals, encoding = encoding,
   datatype = datatype, endian = endian)
   enc == orig
}

Example output



gifti documentation built on Nov. 12, 2020, 1:07 a.m.