storageDescriptor: Storage descriptors

storageDescriptorR Documentation

Storage descriptors

Description

A storage descriptor says how the values of an image sit in a stream of bytes: their type, byte order and position, any scaling applied to them, and the order of the image's axes in the stream. It deliberately says nothing about any particular file format. A format package parses a header into a descriptor, and readImageData() and writeImageData() do the rest.

Usage

storageDescriptor(
  type,
  endian = "little",
  offset = 0,
  slope = NULL,
  intercept = NULL,
  layout = NULL,
  bitOrder = "lsb"
)

Arguments

type

The stored data type, as above.

endian

The byte order of the stream: "little" or "big".

offset

The position of the first value, in bytes from the start of the stream.

slope, intercept

Scaling, as value = stored * slope + intercept. When reading, NULL means no scaling. When writing, NULL means that a scaling is chosen to use the whole range of an integer type, if the data need one.

layout

How the image's axes map onto the order of values in the stream, as described for storageLayout(). NULL means the stream holds the image in its own axis order, first axis fastest.

bitOrder

For "bit" data, whether the first value of each byte is its least or most significant bit.

Details

Types are named by size and signedness: "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "float32", "float64", "complex64" and "complex128", plus "rgb24" and "rgba32" for colour and "bit" for one bit per value. The C-style names "char", "int", "float" and "double" are accepted too, as "int8", "int32", "float32" and "float64" respectively. C leaves the signedness of char to the platform, so it is fixed as signed here; use "uint8" for unsigned bytes.

When read, integer types of up to 32 bits become R integers unless scaled, and wider integers, floating-point types and scaled values become doubles. 64-bit integers beyond 2^53 cannot be held exactly as doubles and are refused. Colour values become integers from 0 to 255, with an extra trailing dimension of three or four channels. Bits become logical values. Scaling is not applied to complex or colour data.

Value

An object of S7 class storageDescriptor.

Examples

storageDescriptor("int16", endian = "big", offset = 352)

imply documentation built on Nov. 20, 2026, 5:12 p.m.