Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

levelset

Level Set of a Pixel Image


Description

Given a pixel image, find all pixels which have values less than a specified threshold value (or greater than a threshold, etc), and assemble these pixels into a window.

Usage

levelset(X, thresh, compare="<=")

Arguments

X

A pixel image (object of class "im")

.

thresh

Threshold value. A single number or value compatible with the pixel values in X

.

compare

Character string specifying one of the comparison operators "<", ">", "==", "<=", ">=", "!=".

Details

If X is a pixel image with numeric values, then levelset(X, thresh) finds the region of space where the pixel values are less than or equal to the threshold value thresh. This region is returned as a spatial window.

The argument compare specifies how the pixel values should be compared with the threshold value. Instead of requiring pixel values to be less than or equal to thresh, you can specify that they must be less than (<), greater than (>), equal to (==), greater than or equal to (>=), or not equal to (!=) the threshold value thresh.

If X has non-numeric pixel values (for example, logical or factor values) it is advisable to use only the comparisons == and !=, unless you really know what you are doing.

For more complicated logical comparisons, see solutionset.

Value

A spatial window (object of class "owin", see owin.object) containing the pixels satisfying the constraint.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

# test image
  X <- as.im(function(x,y) { x^2 - y^2 }, unit.square())

  W <- levelset(X, 0.2)
  W <- levelset(X, -0.3, ">")

  # compute area of level set
  area(levelset(X, 0.1))

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.