toClip: Visual clipper

Description Usage Arguments Value See Also Examples

View source: R/clipper.R

Description

Visual aid to find the right center and radius for the clipper function. It does not clip, but return an usable (plotable) object.

Since the samples are placed under the uFTIR Microscope by hand, the cropping area to pass to clipper is not always the same and (usually) it has to be adjusted. To have a visual aid, you can use this function. It returns an S4 object of class clipmask which can be over-plotted on top of a SAM or Smooth object by calling polygon and using the xycoords slot of the returned object. Using that process you can test manually different center points and radius for the clipping circle.

Usage

1
toClip(rad = 1, segments = 5, centre = c(0, 0))

Arguments

rad

The circle radius.

segments

How many segments should the resulting polygon have? (because it is not a circle, 20 is ok).

centre

The coordinates of the polygon centre (x,y).

Value

An object of class clipmask.

See Also

clipper

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
toClip(1, 5, c(0,0))

x <- tile_read(base::system.file("extdata/tile.bsp", package = "uFTIR"))
x <- tile_base_corr(x)
x <- wavealign(x, primpke)
x <- tile_sam(x)
x <- smooth_sam(x, as.integer(length(primpke@clusternames)), window = 3, 1)

clip <- toClip(8,20,c(10,10))
polygon(clip@xycoords)

x <- clipper(x, clip@centre, clip@rad, 1)

uFTIR documentation built on Oct. 25, 2021, 9:08 a.m.