voxel_colormap | R Documentation |
Color maps for volume or surface data
create_colormap(
gtype = c("surface", "volume"),
dtype = c("continuous", "discrete"),
key,
color,
value,
alpha = FALSE,
con = NULL,
auto_rescale = FALSE,
...
)
save_colormap(cmap, con)
freeserfer_colormap(con)
load_colormap(con)
gtype |
geometry type, choices are |
dtype |
data type, |
key |
non-negative integer vector corresponding to color values; its length must exceed 1; see 'Details' |
color |
characters, corresponding to color strings for each key |
value |
actual value for each key |
alpha |
whether to respect transparency |
con |
a file path to write results to or to read from. The
file path can be passed as |
auto_rescale |
automatically scale the color according to image values; only valid for continuous color maps |
... |
used by continuous color maps, passed to
|
cmap |
color map object |
Internal 'JavaScript' shader implementation uses integer color key
s to
connect color palettes and corresponding values. The keys must be
non-negative.
Zero key is a special color key reserved by system. Please avoid using it for valid values.
A list of color map information
# Creates a symmetric continuous colormap with 3 keys
# The color range is -10 to 10
# The colors are 'blue','white','red' for these keys
pal <- create_colormap(
gtype = "volume", dtype = "continuous",
key = c(1,2,3), value = c(-10,0,10),
color = c('blue','white','red'))
print( pal )
# ---------------- Get colormap key from a value ------------
# returns key index starting from
pal$get_key( -10 )
# nearest value
pal$get_key( 2 )
# set threshold, key is now 0 (no color)
pal$get_key( 2, max_delta = 1 )
# ---------------- Save and load ----------------
f <- tempfile( fileext = '.json' )
save_colormap( pal, f )
cat(readLines(f), sep = '\n')
load_colormap(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.