ij2spatstat: Convert 'ijroi' and 'ijzip' objects to spatstat spatial...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ij2spatstat.R

Description

Converts ijroi and ijzip objects to a list of spatstat.geom spatial patterns.

Usage

1
2
3
4
5
6
7
8
9
ij2spatstat(
  X,
  window = NULL,
  pattern.type = NULL,
  unitname = NULL,
  scale = 1,
  return.type = FALSE,
  convert.only = NULL
)

Arguments

X

ijroi or ijzip object to be converted.

window

the window for returned spatial patterns. Can be an owin object defining a common window for all returned patterns, a character string 'range' leading to a common window based range of all returned patterns, or NULL (default) leading to separate windows for each pattern.

pattern.type

a character string specifying the desired pattern type to be returned ("ppp", "psp" or "owin"). Works only if X is an 'ijroi' object. Ignored otherwise. Defaults to an appropriate pattern type depending on the ROI type (see 'Details').

unitname

Name of the unit of length for the resulting window(s) (see owin).

scale

A numeric value defining the scale of photograph in pixels / unitname. Defaults to 1.

return.type

should the type of ROI object(s) be returned in addition to spatstat.geom spatial patterns? Defaults to FALSE.

convert.only

a character vector specifying the strType of ROI objects to be converted (see plot.ijroi for possible pattern types). Pattern types not mentioned will not be converted. Works only if X is an 'ijzip' object. Ignored otherwise.

Details

The function converts ijroi and ijzip objects to spatstat.geom spatial patterns for further calculations with the objects. By default, areal types ("rect", "oval", "ELLIPSE", "polygon") are converted to owin objects. Line types ("line" (including "ARROW"), "freeline", "polyline", "angle", "freehand" (excluding "ELLIPSE")) are converted to psp objects and "point" types to ppp objects.

Value

Returns a list of spatstat.geom patterns of approperiate type (see 'Details'). If return.type = TRUE returns a list with two levels specifying the spatstat.geom pattern and the ROI type.

Author(s)

Mikko Vihtakari

See Also

read.ijroi read.ijzip

Examples

1
2
3
file <- file.path(system.file(package = "RImageJROI"), "extdata", "ijroi", "ijzip.zip")
x <- read.ijzip(file)
ij2spatstat(x)

Example output

$multi_points
Marked planar point pattern: 16 points
Multitype, with levels = 
   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
window: rectangle = [134, 645] x [178, 405] units

$oval
window: polygonal boundary
enclosing rectangle: [158.00044, 248.99956] x [98.00124, 163] units

$line
marked planar line segment pattern: 1 line segment
multitype, with levels = line
window: rectangle = [281, 615] x [35, 119] units

$segmented_line
marked planar line segment pattern: 5 line segments
multitype, with levels = segmented_line
window: rectangle = [77, 681] x [469, 521] units

$rect
window: rectangle = [661, 722] x [60, 115] units

$angle
marked planar line segment pattern: 2 line segments
multitype, with levels = angle
window: rectangle = [47, 174] x [39, 123] units

$`0232-0088`
Marked planar point pattern: 4 points
Multitype, with levels = 1, 2, 3, 4 
window: rectangle = [64, 111] x [205, 259] units

RImageJROI documentation built on March 24, 2021, 1:09 a.m.