Learn R Programming

⚠️There's a newer version (3.5-0) of this package.Take me there.

spatstat.geom (version 3.4-1)

Geometrical Functionality of the 'spatstat' Family

Description

Defines spatial data types and supports geometrical operations on them. Data types include point patterns, windows (domains), pixel images, line segment patterns, tessellations and hyperframes. Capabilities include creation and manipulation of data (using command line or graphical interaction), plotting, geometrical operations (rotation, shift, rescale, affine transformation), convex hull, discretisation and pixellation, Dirichlet tessellation, Delaunay triangulation, pairwise distances, nearest-neighbour distances, distance transform, morphological operations (erosion, dilation, closing, opening), quadrat counting, geometrical measurement, geometrical covariance, colour maps, calculus on spatial domains, Gaussian blur, level sets of images, transects of images, intersections between objects, minimum distance matching. (Excludes spatial data on a network, which are supported by the package 'spatstat.linnet'.)

Copy Link

Version

Install

install.packages('spatstat.geom')

Monthly Downloads

64,669

Version

3.4-1

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

May 20th, 2025

Functions in spatstat.geom (3.4-1)

Extract.owin

Extract Subset of Window
Extract.layered

Extract or Replace Subset of a Layered Object
Extract.ppp

Extract or Replace Subset of Point Pattern
Extract.hyperframe

Extract or Replace Subset of Hyperframe
Extract.psp

Extract Subset of Line Segment Pattern
Extract.anylist

Extract or Replace Subset of a List of Things
Extract.im

Extract Subset of Image
Extract.ppx

Extract Subset of Multidimensional Point Pattern
anylist

List of Objects
MinkowskiSum

Minkowski Sum of Windows
Extract.quad

Subset of Quadrature Scheme
Extract.solist

Extract or Replace Subset of a List of Spatial Objects
affine.tess

Apply Geometrical Transformation To Tessellation
Frame

Extract or Change the Containing Rectangle of a Spatial Object
Window.tess

Extract Window of Spatial Object
Math.imlist

S3 Group Generic methods for List of Images
Math.im

S3 Group Generic methods for images
add.texture

Fill Plot With Texture
Replace.im

Reset Values in Subset of Image
Extract.tess

Extract or Replace Subset of Tessellation
affine.ppp

Apply Affine Transformation To Point Pattern
anyNA.im

Check Whether Image Contains NA Values
affine.owin

Apply Affine Transformation To Window
Extract.splitppp

Extract or Replace Sub-Patterns
Extract.listof

Extract or Replace Subset of a List of Things
Window

Extract or Change the Window of a Spatial Object
affine.im

Apply Affine Transformation To Pixel Image
area.owin

Area of a Window
angles.psp

Orientation Angles of Line Segments
areaGain

Difference of Disc Areas
areaLoss

Difference of Disc Areas
as.data.frame.hyperframe

Coerce Hyperframe to Data Frame
affine.psp

Apply Affine Transformation To Line Segment Pattern
as.boxx

Convert Data to Multi-Dimensional Box
as.colourmap

Convert to Colour Map
append.psp

Combine Two Line Segment Patterns
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
affine

Apply Affine Transformation
as.function.owin

Convert Window to Indicator Function
as.function.im

Convert Pixel Image to Function of Coordinates
as.box3

Convert Data to Three-Dimensional Box
as.hyperframe.ppx

Extract coordinates and marks of multidimensional point pattern
as.data.frame.owin

Convert Window to Data Frame
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
as.im

Convert to Pixel Image
as.matrix.owin

Convert Pixel Image to Matrix
as.rectangle

Window Frame
as.ppp

Convert Data To Class ppp
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
as.data.frame.tess

Convert Tessellation to Data Frame
as.matrix.im

Convert Pixel Image to Matrix or Array
as.owin

Convert Data To Class owin
as.polygonal

Convert a Window to a Polygonal Window
bounding.box.xy

Convex Hull of Points
bdist.points

Distance to Boundary of Window
as.hyperframe

Convert Data to Hyperframe
as.solist

Convert List of Two-Dimensional Spatial Objects
as.function.tess

Convert a Tessellation to a Function
bdist.tiles

Distance to Boundary of Window
as.mask

Pixel Image Approximation of a Window
as.data.frame.im

Convert Pixel Image to Data Frame
as.layered

Convert Data To Layered Object
boundingbox

Bounding Box of a Window, Image, or Point Pattern
as.psp

Convert Data To Class psp
box3

Three-Dimensional Box
clickdist

Interactively Measure Distance
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
boundingcircle

Smallest Enclosing Circle
bdist.pixels

Distance to Boundary of Window
as.tess

Convert Data To Tessellation
colourmap

Colour Lookup Tables
cbind.hyperframe

Combine Hyperframes by Rows or by Columns
clickpoly

Interactively Define a Polygon
clickbox

Interactively Define a Rectangle
beachcolours

Create Colour Scheme for a Range of Numbers
colourtools

Convert and Compare Colours in Different Formats
connected.tess

Connected Components of Tiles of a Tessellation
commonGrid

Determine A Common Spatial Domain And Pixel Resolution
border

Border Region of a Window
by.im

Apply Function to Image Broken Down by Factor
by.ppp

Apply a Function to a Point Pattern Broken Down by Factor
colouroutputs

Extract or Assign Colour Values in a Colour Map
clip.infline

Intersect Infinite Straight Lines with a Window
connected.ppp

Connected Components of a Point Pattern
clickppp

Interactively Add Points
complement.owin

Take Complement of a Window
boxx

Multi-Dimensional Box
connected

Connected components
concatxy

Concatenate x,y Coordinate Vectors
convexhull

Convex Hull
contour.im

Contour plot of pixel image
contour.imlist

Array of Contour Plots
bufftess

Buffer Distance Tessellation
centroid.owin

Centroid of a window
crossdist.psp

Pairwise distances between two different line segment patterns
crossing.psp

Crossing Points of Two Line Segment Patterns
coords

Extract or Change Coordinates of a Spatial or Spatiotemporal Point Pattern
convexify

Weil's Convexifying Operation
convexhull.xy

Convex Hull of Points
closepairs

Close Pairs of Points
closetriples

Close Triples of Points
closing

Morphological Closing
dilation

Morphological Dilation
diameter

Diameter of an Object
convexmetric

Distance Metric Defined by Convex Set
deltametric

Delta Metric
default.symbolmap

Default Symbol Map for Plotting a Spatial Pattern
covering

Cover Region with Discs
dilated.areas

Areas of Morphological Dilations
default.dummy

Generate a Default Pattern of Dummy Points
default.symbolmap.ppp

Default Symbol Map for Point Pattern
closepairs.pp3

Close Pairs of Points in 3 Dimensions
corners

Corners of a rectangle
default.image.colours

Default Colours for Images in Spatstat
diameter.owin

Diameter of a Window
crossdist.default

Pairwise distances between two different sets of points
distmap.ppp

Distance Map of Point Pattern
compatible

Test Whether Objects Are Compatible
dirichletVertices

Vertices and Edges of Dirichlet Tessellation
crossdist

Pairwise distances
discpartarea

Area of Part of Disc
dirichletAreas

Compute Areas of Tiles in Dirichlet Tessellation
cut.im

Convert Pixel Image from Numeric to Factor
edit.ppp

Invoke Text Editor on Spatial Data
ellipse

Elliptical Window.
fardist

Farthest Distance to Boundary of Window
compatible.im

Test Whether Pixel Images Are Compatible
discretise

Safely Convert Point Pattern Window to Binary Mask
edit.hyperframe

Invoke Text Editor on Hyperframe
distmap

Distance Map
edges2vees

List Dihedral Triples in a Graph
distmap.owin

Distance Map of Window
dirichlet

Dirichlet Tessellation of Point Pattern
crossdist.ppx

Pairwise Distances Between Two Different Multi-Dimensional Point Patterns
crossdist.pp3

Pairwise distances between two different three-dimensional point patterns
flipxy

Exchange X and Y Coordinates
gridweights

Compute Quadrature Weights Based on Grid Counts
convolve.im

Convolution of Pixel Images
fourierbasis

Fourier Basis Functions
diameter.boxx

Geometrical Calculations for Multi-Dimensional Box
erosion

Morphological Erosion by a Disc
endpoints.psp

Endpoints of Line Segment Pattern
distmap.psp

Distance Map of Line Segment Pattern
discs

Union of Discs
edges

Extract Boundary Edges of a Window.
cut.ppp

Classify Points in a Point Pattern
diameter.box3

Geometrical Calculations for Three-Dimensional Box
has.close

Check Whether Points Have Close Neighbours
eval.im

Evaluate Expression Involving Pixel Images
harmonise.owin

Make Windows Compatible
crossdist.ppp

Pairwise distances between two different point patterns
distfun

Distance Map as a Function
framedist.pixels

Distance to Bounding Frame
harmonise.im

Make Pixel Images Compatible
im.apply

Apply Function Pixelwise to List of Images
im.object

Class of Images
grow.boxx

Add margins to box in any dimension
extrapolate.psp

Extrapolate Line Segments to Obtain Infinite Lines
hyperframe

Hyper Data Frame
infline

Infinite Straight Lines
domain

Extract the Domain of any Spatial Object
delaunayDistance

Distance on Delaunay Triangulation
delaunay

Delaunay Triangulation of Point Pattern
intersect.boxx

Intersection Of Boxes Of Arbitrary Dimension
incircle

Find Largest Circle Inside Window
intersect.owin

Intersection, Union or Set Subtraction of Windows
is.linim

Test Whether an Object is a Pixel Image on a Linear Network
is.owin

Test Whether An Object Is A Window
is.im

Test Whether An Object Is A Pixel Image
inside.boxx

Test Whether Points Are Inside A Multidimensional Box
is.ppp

Test Whether An Object Is A Point Pattern
layout.boxes

Generate a Row or Column Arrangement of Rectangles.
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
marks.tess

Marks of a Tessellation
lengths_psp

Lengths of Line Segments
interp.colourmap

Interpolate smoothly between specified colours
interp.im

Interpolate a Pixel Image
mergeLevels

Merge Levels of a Factor
hist.im

Histogram of Pixel Values in an Image
integral.tessfun

Integrate a Function Which is Constant on Each Tile of a Tessellation
marks

Marks of a Point Pattern
is.linnet

Test Whether An Object Is A Linear Network
is.rectangle

Determine Type of Window
is.lpp

Test Whether An Object Is A Point Pattern on a Linear Network
nearestsegment

Find Line Segment Nearest to Each Point
nearestValue

Image of Nearest Defined Pixel Value
nnfun

Nearest Neighbour Index Map as a Function
nnmap

K-th Nearest Point Map
nnwhich.pp3

Nearest neighbours in three dimensions
pHcolourmap

Colour Map for pH Values
owin2mask

Convert Window to Binary Mask under Constraints
opening

Morphological Opening
overlap.owin

Compute Area of Overlap
nnwhich.ppx

Nearest Neighbours in Any Dimensions
nndist

Nearest neighbour distances
padimage

Pad the Border of a Pixel Image
nndist.pp3

Nearest neighbour distances in three dimensions
persp.im

Perspective Plot of Pixel Image
perspPoints

Draw Points or Lines on a Surface Viewed in Perspective
persp.ppp

Perspective Plot of Marked Point Pattern
pixellate.psp

Convert Line Segment Pattern to Pixel Image
pixellate.owin

Convert Window to Pixel Image
pixellate

Convert Spatial Object to Pixel Image
plot.hyperframe

Plot Entries in a Hyperframe
plot.anylist

Plot a List of Things
pixelcentres

Extract Pixel Centres as Point Pattern
plot.colourmap

Plot a Colour Map
pixellate.ppp

Convert Point Pattern to Pixel Image
plot.imlist

Plot a List of Images
plot.layered

Layered Plot
plot.splitppp

Plot a List of Point Patterns
plot.solist

Plot a List of Spatial Objects
plot.quadratcount

Plot Quadrat Counts
plot.yardstick

Plot a Yardstick or Scale Bar
plot.texturemap

Plot a Texture Map
pointsOnLines

Place Points Evenly Along Specified Lines
plot.symbolmap

Plot a Graphics Symbol Map
plot.tess

Plot a Tessellation
ppx

Multidimensional Space-Time Point Pattern
pppmatching

Create a Point Matching
pppmatching.object

Class of Point Matchings
quad.object

Class of Quadrature Schemes
quadratcount

Quadrat counting for a point pattern
quantilefun.im

Quantile Function for Images
quantile.im

Sample Quantiles of Pixel Image
rescale.im

Convert Pixel Image to Another Unit of Length
rQuasi

Generate Quasirandom Point Pattern in Given Window
reflect

Reflect In Origin
regularpolygon

Create A Regular Polygon
rgbim

Create Colour-Valued Pixel Image
rjitter

Random Perturbation of a Point Pattern
ripras

Estimate window from points alone
rexplode

Explode a Point Pattern by Displacing Duplicated Points
rotate

Rotate
rlinegrid

Generate grid of parallel lines with random displacement
round.ppp

Apply Numerical Rounding to Spatial Coordinates
rotate.psp

Rotate a Line Segment Pattern
shift.im

Apply Vector Translation To Pixel Image
shift.owin

Apply Vector Translation To Window
scaletointerval

Rescale Data to Lie Between Specified Limits
scanpp

Read Point Pattern From Data File
rotate.infline

Rotate or Shift Infinite Lines
scalardilate

Apply Scalar Dilation
rotate.im

Rotate a Pixel Image
solapply

Apply a Function Over a List and Obtain a List of Objects
rounding.ppp

Detect Numerical Rounding
shift

Apply Vector Translation
rsyst

Simulate systematic random point pattern
simplepanel

Simple Point-and-Click Interface Panels
sidelengths.owin

Side Lengths of Enclosing Rectangle of a Window
shift.psp

Apply Vector Translation To Line Segment Pattern
spatstat.geom-deprecated

Deprecated spatstat.geom functions
spatstat.geom-internal

Internal spatstat.geom functions
subset.hyperframe

Subset of Hyperframe Satisfying A Condition
setcov

Set Covariance of a Window
stratrand

Stratified random point pattern
spokes

Spokes pattern of dummy points
square

Square Window
summary.owin

Summary of a Spatial Window
summary.ppp

Summary of a Point Pattern Dataset
split.ppx

Divide Multidimensional Point Pattern into Sub-patterns
split.ppp

Divide Point Pattern into Sub-patterns
summary.solist

Summary of a List of Spatial Objects
summary.splitppp

Summary of a Split Point Pattern
summary.distfun

Summarizing a Function of Spatial Location
summary.anylist

Summary of a List of Things
tileindex

Determine Which Tile Contains Each Given Point
tilenames

Names of Tiles in a Tessellation
superimpose

Superimpose Several Geometric Patterns
symbolmap

Graphics Symbol Map
unmark

Remove Marks
unstack.ppp

Separate Multiple Columns of Marks
zapsmall.im

Rounding of Pixel Values
yardstick

Text, Arrow or Scale Bar in a Diagram
vertices

Vertices of a Window
timeTaken

Extract the Total Computation Time
timed

Record the Computation Time
venn.tess

Tessellation Delimited by Several Sets
disc

Circular Window
dirichletWeights

Compute Quadrature Weights Based on Dirichlet Tessellation
edges2triangles

List Triangles in a Graph
erosionAny

Morphological Erosion of Windows
grow.rectangle

Add margins to rectangle
eroded.areas

Areas of Morphological Erosions
hist.funxy

Histogram of Values of a Spatial Function
harmonise

Make Objects Compatible
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
intensity.ppx

Intensity of a Multidimensional Space-Time Point Pattern
intensity.ppp

Empirical Intensity of Point Pattern
gridcentres

Rectangular grid of points
funxy

Spatial Function Class
hextess

Hexagonal Grid or Tessellation
headtail

First or Last Part of a Spatial Pattern
inside.owin

Test Whether Points Are Inside A Window
is.connected

Determine Whether an Object is Connected
integral.im

Integral of a Pixel Image
is.connected.ppp

Determine Whether a Point Pattern is Connected
is.boxx

Recognise a Multi-Dimensional Box
intensity

Intensity of a Dataset or a Model
invoke.symbolmap

Plot Data Using Graphics Symbol Map
is.marked.ppp

Test Whether A Point Pattern is Marked
intensity.quadratcount

Intensity Estimates Using Quadrat Counts
harmoniseLevels

Harmonise the levels of several factors, or factor-valued pixel images.
intensity.psp

Empirical Intensity of Line Segment Pattern
imcov

Spatial Covariance of a Pixel Image
identify.ppp

Identify Points in a Point Pattern
im

Create a Pixel Image Object
identify.psp

Identify Segments in a Line Segment Pattern
is.multitype

Test whether Object is Multitype
is.convex

Test Whether a Window is Convex
intersect.tess

Intersection of Two Tessellations
invoke.metric

Perform Geometric Task using a Specified Metric
is.multitype.ppp

Test Whether A Point Pattern is Multitype
is.empty

Test Whether An Object Is Empty
methods.layered

Methods for Layered Objects
layered

Create List of Plotting Layers
methods.pp3

Methods for three-dimensional point patterns
is.marked

Test Whether Marks Are Present
layerplotargs

Extract or Replace the Plot Arguments of a Layered Object
lut

Lookup Tables
levelset

Level Set of a Pixel Image
multiplicity.ppp

Count Multiplicity of Duplicate Points
methods.funxy

Methods for Spatial Functions
methods.distfun

Geometrical Operations for Distance Functions
marks.psp

Marks of a Line Segment Pattern
matchingdist

Distance for a Point Pattern Matching
midpoints.psp

Midpoints of Line Segment Pattern
methods.boxx

Methods for Multi-Dimensional Box
nobjects

Count Number of Geometrical Objects in a Spatial Dataset
methods.box3

Methods for Three-Dimensional Box
metric.object

Distance Metric
nncross

Nearest Neighbours Between Two Patterns
mean.im

Mean and Median of Pixel Values in an Image
maxnndist

Compute Minimum or Maximum Nearest-Neighbour Distance
npoints

Number of Points in a Point Pattern
nnwhich

Nearest neighbour
nnmark

Mark of Nearest Neighbour
pairdist

Pairwise distances
nearest.raster.point

Find Pixel Nearest to a Given Point
nndist.psp

Nearest neighbour distances between line segments
owin

Create a Window
pairdist.ppx

Pairwise Distances in Any Dimensions
nsegments

Number of Line Segments in a Line Segment Pattern
pairdist.ppp

Pairwise distances
nvertices

Count Number of Vertices
nestsplit

Nested Split
owin.object

Class owin
nndist.ppx

Nearest Neighbour Distances in Any Dimensions
pairdist.pp3

Pairwise distances in Three Dimensions
pairdist.psp

Pairwise distances between line segments
nncross.ppx

Nearest Neighbours Between Two Patterns in Any Dimensions
methods.ppx

Methods for Multidimensional Space-Time Point Patterns
is.subset.owin

Determine Whether One Window is Contained In Another
pairdist.default

Pairwise distances
nncross.pp3

Nearest Neighbours Between Two Patterns in 3D
periodify

Make Periodic Copies of a Spatial Pattern
methods.unitname

Methods for Units
plot.im

Plot a Pixel Image
plot.psp

plot a Spatial Line Segment Pattern
plot.quad

Plot a Spatial Quadrature Scheme
plot.textstring

Plot a Text String
polartess

Tessellation Using Polar Coordinates
print.im

Print Brief Details of an Image
pp3

Three Dimensional Point Pattern
print.psp

Print Brief Details of a Line Segment Pattern Dataset
rectdistmap

Distance Map Using Rectangular Distance Metric
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rescale

Convert dataset to another unit of length
quadscheme.logi

Generate a Logistic Regression Quadrature Scheme from a Point Pattern
raster.x

Cartesian Coordinates for a Pixel Raster
quadrats

Divide Region into Quadrats
quantess

Quantile Tessellation
requireversion

Require a Specific Version of a Package
rescue.rectangle

Convert Window Back To Rectangle
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
relevel.im

Reorder Levels of a Factor-Valued Image or Pattern
runifrect

Generate N Uniform Random Points in a Rectangle
run.simplepanel

Run Point-and-Click Interface
rotate.owin

Rotate a Window
rotate.ppp

Rotate a Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
spatdim

Spatial Dimension of a Dataset
sessionLibs

Print Names and Version Numbers of Libraries Loaded
selfcut.psp

Cut Line Segments Where They Intersect
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
subset.ppp

Subset of Point Pattern Satisfying A Condition
spatstat.options

Internal Options in Spatstat Package
subset.psp

Subset of Line Segment Satisfying A Condition
spatstat.geom-package

The spatstat.geom Package
summary.quad

Summarizing a Quadrature Scheme
summary.psp

Summary of a Line Segment Pattern Dataset
tess

Create a Tessellation
tweak.colourmap

Change Colour Values in a Colour Map
test.crossing.psp

Check Whether Segments Cross
trim.rectangle

Cut margins from rectangle
triangulate.owin

Decompose Window into Triangles
transmat

Convert Pixel Array Between Different Conventions
uniquemap.ppp

Map Duplicate Entries to Unique Entries
unitname

Name for Unit of Length
with.hyperframe

Evaluate an Expression in Each Row of a Hyperframe
whichhalfplane

Test Which Side of Infinite Line a Point Falls On
perimeter

Perimeter Length of Window
pixelquad

Quadrature Scheme Based on Pixel Grid
plot.ppp

plot a Spatial Point Pattern
plot.pppmatching

Plot a Point Matching
plot.onearrow

Plot an Arrow
plot.listof

Plot a List of Things
plot.pp3

Plot a Three-Dimensional Point Pattern
plot.owin

Plot a Spatial Window
ppp.object

Class of Point Patterns
pppdist

Distance Between Two Point Patterns
psp.object

Class of Line Segment Patterns
psp2mask

Convert Line Segment Pattern to Binary Pixel Mask
ppp

Create a Point Pattern
print.ppp

Print Brief Details of a Point Pattern Dataset
progressreport

Print Progress Reports
print.owin

Print Brief Details of a Spatial Window
print.quad

Print a Quadrature Scheme
project2segment

Move Point To Nearest Line
quasirandom

Quasirandom Patterns
rescale.ppp

Convert Point Pattern to Another Unit of Length
project2set

Find Nearest Point in a Region
psp

Create a Line Segment Pattern
rescale.owin

Convert Window to Another Unit of Length
restrict.colourmap

Restrict a Colour Map to a Subset of Values
rev.colourmap

Reverse the Colours in a Colour Map
simplify.owin

Approximate a Polygon by a Simpler Polygon
shift.ppx

Apply Vector Translation To Box Or Point Pattern In Arbitrary Dimension
shift.ppp

Apply Vector Translation To Point Pattern
solist

List of Two-Dimensional Spatial Objects
split.hyperframe

Divide Hyperframe Into Subsets and Reassemble
split.im

Divide Image Into Sub-images
summary.im

Summarizing a Pixel Image
summary.listof

Summary of a List of Things
tile.areas

Compute Areas of Tiles in a Tessellation
textureplot

Plot Image or Tessellation Using Texture Fill
update.symbolmap

Update a Graphics Symbol Map.
unstack.solist

Unstack Each Spatial Object in a List of Objects
tiles

Extract List of Tiles in a Tessellation
tiles.empty

Check For Empty Tiles in a Tessellation
volume

Volume of an Object
unique.ppp

Extract Unique Points from a Spatial Point Pattern
union.quad

Union of Data and Dummy Points
texturemap

Texture Map
where.max

Find Location of Maximum in a Pixel Image
text.ppp

Add Text Labels to Spatial Pattern