| packedImage | R Documentation |
R has no single-precision floating-point type, so a large image held as
double may cost twice the memory it needs, and potentially roughly twice
the time. Raw MRI is commonly 16-bit integer.
packedImage(
values,
storageType,
dims,
slope = 1,
intercept = 0,
spatial = NULL,
voxelSize = NULL,
worldTransform = NULL,
spaceUnit = NULL,
timeUnit = NULL,
template = NULL
)
isPackedImage(x)
asPacked(x, type = "float32", slope = NULL, intercept = NULL, ...)
storageType(x)
values |
A raw vector holding the packed values. |
dims, spatial, voxelSize, worldTransform, spaceUnit, timeUnit |
Image
geometry, as for |
slope, intercept |
Scaling applied to stored values. Chosen automatically when not given. |
template |
An image to take unspecified geometry from. |
x |
An image or array. |
type, storageType |
One of |
... |
Further arguments to |
Recognising this, a packed image stores its values using a narrow data type,
with optional affine scaling, so that an integer type can carry a range
it could not otherwise hold: value = stored * slope + intercept. When a
scaling is needed it is chosen automatically to map the data across the
whole of the type's range.
The values live in a raw vector, so they are garbage-collected, serialise, and survive a save and load like any other R object.
An object of S7 class packedImage representing an image using a
narrow, packed data representation, with properties corresponding to the
arguments listed above.
Missing values can only be carried by float32; packing data
containing NA to an integer type is refused rather than silently losing
it. Note that NA and NaN are not distinguished once packed, since the
payload that separates them does not survive the narrowing.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.