Skip to content

Commit

Permalink
cleans
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowosad committed Nov 11, 2023
1 parent 784e5b1 commit 21ba300
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
LinkingTo:
cpp11
SystemRequirements: C++17
URL: https://jakubnowosad.com/supercells/
BugReports: https://github.com/Nowosad/supercells/issues
Suggests:
Expand Down
20 changes: 9 additions & 11 deletions R/supercells.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,28 @@
#'
#' @examples
#' library(supercells)
#' library(terra)
#' library(sf)
#' # One variable
#'
#' vol = rast(system.file("raster/volcano.tif", package = "supercells"))
#' vol = terra::rast(system.file("raster/volcano.tif", package = "supercells"))
#' vol_slic1 = supercells(vol, k = 50, compactness = 1)
#' plot(vol)
#' plot(st_geometry(vol_slic1), add = TRUE, lwd = 0.2)
#' terra::plot(vol)
#' plot(sf::st_geometry(vol_slic1), add = TRUE, lwd = 0.2)
#'
#' # RGB variables
#' # ortho = rast(system.file("raster/ortho.tif", package = "supercells"))
#' # ortho = terra::rast(system.file("raster/ortho.tif", package = "supercells"))
#' # ortho_slic1 = supercells(ortho, k = 1000, compactness = 10, transform = "to_LAB")
#' # plot(ortho)
#' # plot(st_geometry(ortho_slic1), add = TRUE)
#' # terra::plot(ortho)
#' # plot(sf::st_geometry(ortho_slic1), add = TRUE)
#' #
#' # ### RGB variables - colored output
#' #
#' # rgb_to_hex = function(x){
#' # apply(t(x), 2, function(x) rgb(x[1], x[2], x[3], maxColorValue = 255))
#' # }
#' # avg_colors = rgb_to_hex(st_drop_geometry(ortho_slic1[4:6]))
#' # avg_colors = rgb_to_hex(sf::st_drop_geometry(ortho_slic1[4:6]))
#' #
#' # plot(ortho)
#' # plot(st_geometry(ortho_slic1), add = TRUE, col = avg_colors)
#' # terra::plot(ortho)
#' # plot(sf::st_geometry(ortho_slic1), add = TRUE, col = avg_colors)
supercells = function(x, k, compactness, dist_fun = "euclidean", avg_fun = "mean", clean = TRUE,
iter = 10, transform = NULL, step, minarea, metadata = TRUE, chunks = FALSE, future = FALSE, verbose = 0){
if (!inherits(x, "SpatRaster")){
Expand Down
20 changes: 9 additions & 11 deletions man/supercells.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CXX_STD = CXX11

2 changes: 1 addition & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CXX_STD = CXX11

0 comments on commit 21ba300

Please sign in to comment.