Documentation for SLiM function mapImage
, which is a method of the SLiM
class SpatialMap
.
Note that the R function is a stub, it does not do anything in R (except bring
up this documentation). It will only do
anything useful when used inside a slim_block
function further
nested in a slim_script
function call, where it will be translated into valid SLiM code as part of a
full SLiM script.
mapImage(width, height, centers, color)
An object of type null or integer. Must be of length 1 (a
singleton). The default value is NULL
. See details for description.
An object of type null or integer. Must be of length 1 (a
singleton). The default value is NULL
. See details for description.
An object of type logical. Must be of length 1 (a singleton). The
default value is F
. See details for description.
An object of type logical. Must be of length 1 (a singleton). The
default value is T
. See details for description.
An object of type Image object. Return will be of length 1 (a singleton)
Documentation for this function can be found in the official SLiM manual: page 715.
Returns an Image object sampled from the spatial map. The image will be width pixels wide and height pixels tall; the intrinsic size of the spatial map itself will be used if one of these parameters is NULL. The image will be oriented in the same way as it is displayed in SLiMgui (which conceptually entails a transformation from matrix coordinates, which store values by column, to standard image coordinates, which store values by row; see the Eidos manual's documentation of Image for details). This method may only be called for 2D spatial maps at present. The sampling of the spatial map can be done in one of two ways, as controlled by the centers parameter. If centers is T, a (width+1) × (height+1) grid of lines that delineates width × height rectangular pixels will be overlaid on top of the spatial map, and values will be sampled from the spatial map at the center of each of these pixels. If centers is F (the default), a width × height grid of lines will be overlaid on top of the spatial map, and values will be sampled from the spatial map at the vertices of the grid. If interpolation is not enabled for the spatial map, these two options will both recover the original matrix of values used to define the spatial map (assuming, here and below, that width and height are NULL). If interpolation is enabled for the spatial map, however, centers == F will recover the original values, but will not capture the "typical" value of each pixel in the image; centers == T, on the other hand, will not recover the original values, but will capture the "typical" value of each pixel in the image (i.e., the value at the center of each pixel, as produced by interpolation). The figures in section 16.11 may be helpful for visualizing the difference between these options; the overlaid grids span the full extent of the spatial map, just as shown in that section. If color is T (the default), the valueRange and colors parameters supplied to defineSpatialMap() will be used to translate map values to RGB color values as described in the documentation of that method, providing the same appearance as in SLiMgui; of course those parameters must have been supplied, otherwise an error will result. If color is F, on the other hand, a grayscale image will be produced that directly reflects the map values without color translation. In this case, this method needs to translate map values, which can have any float value, into grayscale pixel values that are integers in [0, 255]. To do so, the map values are multiplied by 255.0, clamped to [0.0, 255.0], and then rounded to the nearest integer. This translation scheme essentially assumes that map values are in [0, 1]; for spatial maps that were defined using the floatK channel of a grayscale PNG image, this should recover the original image's pixel values. (If a different translation scheme is desired, color=T with the desired valueRange and colors should be used.)
This is documentation for a function in the SLiM software, and has been reproduced from the official manual, which can be found here: http://benhaller.com/slim/SLiM_Manual.pdf. This documentation is Copyright © 2016-2020 Philipp Messer. All rights reserved. More information about SLiM can be found on the official website: https://messerlab.org/slim/
Other SpatialMap:
SpatialMap
,
add()
,
blend()
,
changeColors()
,
changeValues()
,
divide()
,
exp()
,
gridValues()
,
interpolate()
,
mapColor()
,
mapValue()
,
multiply()
,
power()
,
range()
,
rescale()
,
sampleImprovedNearbyPoint()
,
sampleNearbyPoint()
,
smooth()
,
subtract()