as.im(spatstat)
as.im()所属R语言包:spatstat
Convert to Pixel Image
转换为像素图像
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Converts various kinds of data to a pixel image
的各种数据转换的像素的图像
用法----------Usage----------
as.im(X, ...)
## S3 method for class 'im'
as.im(X, W=NULL, ...,
eps=NULL, dimyx=NULL, xy=NULL,
na.replace=NULL)
## S3 method for class 'owin'
as.im(X, W=NULL, ...,
eps=NULL, dimyx=NULL, xy=NULL,
na.replace=NULL, value=1)
## S3 method for class 'matrix'
as.im(X, W=NULL, ...)
## S3 method for class 'tess'
as.im(X, W=NULL, ...,
eps=NULL, dimyx=NULL, xy=NULL,
na.replace=NULL)
## S3 method for class 'function'
as.im(X, W=NULL, ...,
eps=NULL, dimyx=NULL, xy=NULL,
na.replace=NULL)
## S3 method for class 'distfun'
as.im(X, W=NULL, ...,
eps=NULL, dimyx=NULL, xy=NULL,
na.replace=NULL)
## S3 method for class 'leverage.ppm'
as.im(X, ...)
## Default S3 method:
as.im(X, W=NULL, ...,
eps=NULL, dimyx=NULL, xy=NULL,
na.replace=NULL)
参数----------Arguments----------
参数:X
Data to be converted to a pixel image.
要被转换的数据到一个像素的图像。
参数:W
Window object which determines the spatial domain and pixel array geometry.
窗口对象,这就决定了空间域和像素阵列的几何形状。
参数:...
Additional arguments passed to X when X is a function.
额外参数传递X的X是一个函数。
参数:eps,dimyx,xy
Optional parameters passed to as.mask which determine the pixel array geometry. See as.mask.
可选参数传递给as.mask确定的像素阵列的几何形状。见as.mask。
参数:na.replace
Optional value to replace NA entries in the output image.
可选值,以取代NA在输出图像中的条目。
参数:value
Optional. The value to be assigned to pixels inside the window, if X is a window.
可选。在窗口内的像素的值被分配到,如果X是一个窗口。
Details
详细信息----------Details----------
This function converts the data X into a pixel image object of class "im" (see im.object). The function as.im is generic, with methods for the classes listed above.
此功能可以把数据X到一个像素的图像类的对象"im"(见im.object)。函数as.im是通用的,上面列出的类的方法。
Currently X may be any of the following:
目前X可以是以下的任何:
a pixel image object, of class "im".
像素图像的对象,的类"im"。
a window object, of class "owin" (see owin.object). The result is an image with all pixel entries equal to value inside the window X, and NA outside.
一个窗口对象,类"owin"(见owin.object)。结果是等于value在窗口内X,和NA外的图像的所有像素的条目。
a matrix.
一个矩阵。
a tessellation (object of class "tess"). The result is a factor-valued image, with one factor level corresponding to each tile of the tessellation. Pixels are classified according to the tile of the tessellation into which they fall.
镶嵌(类的对象"tess")。其结果是一个因子值的图像,用一个因子水平对应于每个瓦片的镶嵌。根据瓦下降到他们的Tessellation(曲面细分)的像素被分类。
a single number (or a single logical, complex, factor or character value). The result is an image with all pixel entries equal to this constant value inside the window W (and NA outside, unless the argument na.replace is given). Argument W is required.
一个单一的数字(或一个单一的逻辑的,复杂的,因子或字符值)。其结果是等于这个常数的值在窗口内的图像的所有像素的条目W(和NA外面,除非参数na.replace被给出)。参数W是必需的。
a function of the form function(x, y, ...) which is to be evaluated to yield the image pixel values. In this case, the additional argument W must be present. This window will be converted to a binary image mask. Then the function X will be evaluated in the form X(x, y, ...) where x and y are vectors containing the x and y coordinates of all the pixels in the image mask, and ... are any extra arguments given. This function must return a vector or factor of the same length as the input vectors, giving the pixel values.
的函数的形式function(x, y, ...)要被评估,得到的图像的像素值。在这种情况下,额外的参数W必须存在。该窗口将被转换为二进制图像掩模。的功能X将评估的形式X(x, y, ...)其中x和y是向量的x和y的所有坐标像素的图像屏蔽,和...任何额外的参数。此函数必须返回一个向量或因子作为输入向量,给出的像素值相同的长度。
an object of class "distfun" representing a distance function (created by the command distfun).
"distfun"代表一个距离函数(命令创建类的一个对象distfun)。
a list with entries x, y, z in the format expected by the standard R functions image.default and contour.default. That is, z is a matrix of pixel values, x and y are vectors of x and y coordinates respectively, and z[i,j] is the pixel value for the location (x[i],y[j]).
条目的列表x, y, z在格式标准R功能image.default和contour.default。也就是说,z是一个矩阵的像素值,x和y是向量x和y坐标分别,和z[i,j]是的像素值的位置(x[i],y[j])。
a point pattern (object of class "ppp"). See the separate documentation for as.im.ppp.
点模式(类的对象"ppp")。请参阅单独的文档as.im.ppp。
The spatial domain (enclosing rectangle) of the pixel image is determined by the argument W. If W is absent, the spatial domain is determined by X. When X is a function, a matrix, or a single numerical value, W is required.
的像素的图像的空间域(包围矩形)确定的参数W。 W如果是不存在的,空间域是由X。当X是一个函数,一个矩阵,或一个单一的数值,W是必需的。
The pixel array dimensions of the final resulting image are determined by (in priority order)
最终生成的图像是由像素阵列尺寸(优先顺序)
the argument eps, dimyx or xy if present;
的说法eps,dimyx或xy(如果存在);
the pixel dimensions of the window W, if it is present and if it is a binary mask;
的窗口中的像素尺寸W,如果它是存在的,并且如果它是一个二进制掩码;
the pixel dimensions of X if it is an image, a binary mask, or a list(x,y,z);
的像素尺寸X,如果它是一个形象,一个二进制面膜,或list(x,y,z);
the default pixel dimensions, controlled by spatstat.options.
默认的像素尺寸,控制spatstat.options。
Note that if eps, dimyx or xy is given, this will override the pixel dimensions of X if it has them. Thus, as.im can be used to change an image's pixel dimensions.
需要注意的是,如果eps,dimyx或xy是,这将覆盖的像素尺寸X如果有他们。因此,as.im可以用来改变图像的像素尺寸。
If the argument na.replace is given, then all NA entries in the image will be replaced by this value. The resulting image is then defined everwhere on the full rectangular domain, instead of a smaller window. Here na.replace should be a single value, of the same type as the other entries in the image.
如果参数na.replace,然后所有的NA项目在图像将被替换该值。然后,将所得的图像定义everwhere完整的矩形域,而不是一个较小的窗口上。这里na.replace应该是一个单值,相同的类型的图像中的其他条目。
If X is a pixel image that was created by an older version of spatstat, the command X <- as.im(X) will repair the internal format of X so that it conforms to the current version of spatstat.
如果X是一个像素的图像,是由旧版本的spatstat,命令X <- as.im(X)将修复,使其符合到当前版本的内部格式X spatstat。
值----------Value----------
An image object of class "im".
图像对象的类"im"。
(作者)----------Author(s)----------
Adrian Baddeley
<a href="mailto:Adrian.Baddeley@csiro.au">Adrian.Baddeley@csiro.au</a>
<a href="http://www.maths.uwa.edu.au/~adrian/">http://www.maths.uwa.edu.au/~adrian/</a>
and Rolf Turner
<a href="mailto:r.turner@auckland.ac.nz">r.turner@auckland.ac.nz</a>
参见----------See Also----------
Separate documentation for as.im.ppp
独立的文档as.im.ppp
实例----------Examples----------
data(demopat)
# window object[窗口对象]
W <- demopat$window
plot(W)
Z <- as.im(W)
image(Z)
# function[功能]
Z <- as.im(function(x,y) {x^2 + y^2}, unit.square())
image(Z)
# function with extra arguments[功能与额外的参数]
f <- function(x, y, x0, y0) {
sqrt((x - x0)^2 + (y-y0)^2)
}
Z <- as.im(f, unit.square(), x0=0.5, y0=0.5)
image(Z)
# Revisit the Sixties[重温上世纪六十年代]
data(letterR)
Z <- as.im(f, letterR, x0=2.5, y0=2)
image(Z)
# usual convention in S[通常的惯例在S]
stuff <- list(x=1:10, y=1:10, z=matrix(1:100, nrow=10))
Z <- as.im(stuff)
# convert to finer grid[转换到更精细的网格]
Z <- as.im(Z, dimyx=256)
# pixellate the Dirichlet tessellation[像素化的Dirichlet Tessellation(曲面细分)]
Di <- dirichlet(runifpoint(10))
plot(as.im(Di))
plot(Di, add=TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|