smooth_sam: Smooth a Spectral Angle Mapper output

Description Usage Arguments Value See Also Examples

View source: R/smooth_sam.R

Description

The function makes a smooth version of the object returned by tile_sam or mosaic_compose. The function smooths out only the cluster slot, slicing it to a user-given range of slices.

Usage

1
smooth_sam(x, nclusters, window = 5, nslices = 1)

Arguments

x

Object of class SAM.

nclusters

How many clusters did the spectral library had? This parameter refer back to the length of the clusterlist slot of the SpectralReference object used when calling tile_sam or mosaic_sam. It should be an integer.

window

The function smooths out the SAM objectc "x" using a moving window. You should decide which size (in pixels) this window should be.

nslices

Integer. Starting from 1, up to which slice of the cube holded in the clusters slot of the SAM objectc "x" do you want the smooth_sam function to work? It will influence the output. See return.

Value

An S4 object of class Smooth. It has only one slot (smooth) that holds an array in which each slice is the smooth version of the corresponding slice of a SAM object.

The returned object has methods to plot, summarize, and extract profiles by calling the generics plot, summary, and get_profile. You might have to provide extra arguments. You can refer to the see also section to look for the object specific methods.

See Also

plot_tile summary_sam get_profile_tile get_profile_sinfo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
a <- matrix(c(1,1,1,1,3,3,
              2,2,2,1,2,3,
              3,1,1,2,3,1,
              3,3,2,2,1,1,
              1,1,1,3,3,2,
              3,3,3,2,2,3), nrow = 6, byrow = TRUE)
a <- array(c(a,a), dim = c(6,6,2))
test_sam <- new(Class = "SAM",
               raw_sam = a,
               substances = a,
               clusters = a)

smooth_sam(test_sam, nclusters = 3, window = 3)

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