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

Window

Extract or Change the Window of a Spatial Object


Description

Given a spatial object (such as a point pattern or pixel image) in two dimensions, these functions extract or change the window in which the object is defined.

Usage

Window(X, ...)

   Window(X, ...) <- value

   ## S3 method for class 'ppp'
Window(X, ...)

   ## S3 replacement method for class 'ppp'
Window(X, ...) <- value

   ## S3 method for class 'psp'
Window(X, ...)

   ## S3 replacement method for class 'psp'
Window(X, ...) <- value

   ## S3 method for class 'im'
Window(X, ...)

   ## S3 replacement method for class 'im'
Window(X, ...) <- value

Arguments

X

A spatial object such as a point pattern, line segment pattern or pixel image.

...

Extra arguments. They are ignored by all the methods listed here.

value

Another window (object of class "owin") to be used as the window for X.

Details

The functions Window and Window<- are generic.

Window(X) extracts the spatial window in which X is defined.

Window(X) <- W changes the window in which X is defined to the new window W, and discards any data outside W. In particular:

  • If X is a point pattern (object of class "ppp") then Window(X) <- W discards any points of X which fall outside W.

  • If X is a line segment pattern (object of class "psp") then Window(X) <- W clips the segments of X to the boundaries of W.

  • If X is a pixel image (object of class "im") then Window(X) <- W has the effect that pixels lying outside W are retained but their pixel values are set to NA.

Many other classes of spatial object have a method for Window, but not Window<-. See Window.ppm.

Value

The result of Window is a window (object of class "owin").

The result of Window<- is the updated object X, of the same class as X.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

## point patterns
   Window(cells)
   X <- demopat
   Window(X)
   Window(X) <- as.rectangle(Window(X))

   ## line segment patterns
   X <- psp(runif(10), runif(10), runif(10), runif(10), window=owin())
   Window(X)
   Window(X) <- square(0.5)

   ## images
   Z <- setcov(owin())
   Window(Z)
   Window(Z) <- square(0.5)

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.