Set an upper and lower bound for the data. Values above upper will be set to the upper value. Values below lower will be set to the lower value.

Value

minmaxThreshParam

params

uppernumeric (default = Inf) highest acceptable value. Values above this will be set to the same as upper.
lowernumeric (default = -Inf) lowest acceptable value. Values below this will be set to the same as lower.
valueslogical (SpatRaster only) If FALSE values outside the clamping range become NA, if TRUE, they get the extreme values

See also

process_param

Other threshold parameters: threshold_binarize

Examples

e <- GiottoData::loadSubObjectMini("exprObj")
# also works with matrix classes
max_e <- processData(e, thresholdParam("minmax", upper = 6))
force(max_e)
#> An object of class exprObj : "custom"
#> spat_unit : "aggregate"
#> feat_type : "rna"
#> provenance: z0 z1 
#> 
#> contains:
#> 337 x 462 sparse Matrix of class "dgCMatrix"
#>                                                                           
#> Mlc1   . . . .        . . 5.291601 . .        5.821597 . .        . ......
#> Gprc5b . 6 . 6.000000 . . 6.000000 . 6.000000 6.000000 . 5.082989 . ......
#> Gfap   6 . 6 5.886051 . . 6.000000 . 5.701006 5.821597 . .        . ......
#> 
#>  ........suppressing 449 columns and 331 rows 
#>                                           
#> Adgrf4    . . . . . . . . . . . . . ......
#> Epha2     . . . . . . . . . . . . . ......
#> Blank-139 . . . . . . . . . . . . . ......
#> 
#>  First four colnames:
#>  240649020551054330404932383065726870513
#>  274176126496863898679934791272921588227
#>  323754550002953984063006506310071917306
#>  87260224659312905497866017323180367450 

gimg <- GiottoData::loadSubObjectMini("giottoLargeImage")
# also works with SpatRasters
mm_img <- processData(gimg,
    thresholdParam("minmax", lower = 30, upper = 100)
)
plot(mm_img)