R/RcppExports.R

Defines functions ccl_paths ccl_labels ccl_profile ccl_edges ccl_cycles ccl_outlines ccl_borders

Documented in ccl_borders ccl_cycles ccl_edges ccl_labels ccl_outlines ccl_paths

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @title 8-way connectedness border states.
#'
#' @description 8-way neighborhood connected component border
#' (edge/vertice) states.
#'
#' @param m A two dimensional numeric matrix.
#'
#' @return Numeric matrix of the same dimensions as mat with
#' values indicating 8-way connected border states.
#'
#' @details A cell is considered to have 8 distinct borders indexed
#' in counter clockwise order with values of 2^c(0:7) beginning
#' with the North edge and ending with the Northeast vertex. A cell
#' fully enclosed by similar neighbors has no borders ( a 0 value )
#' whereas when fully enclosed by dissimilar neighbors is fully
#' bordered ( a 255 value ).
#'
#' @name ccl_borders
#' @export
ccl_borders <- function(m) {
    .Call('_ccloutline_ccl_borders', PACKAGE = 'ccloutline', m)
}

#' @title Connected component border cartesian paths.
#'
#' @description Connected component grid graph cartesian coordinate
#' paths for each eulerian cycle (outline) for each component.
#'
#' @param mat A two dimensional numeric matrix.
#' @param min_first Begin at the minimal column major indexed vertex.
#'
#' @return Nested list of lists of matrices for all outlines of each
#' input label's connected components.
#'
#' Each [[label]] index consists of at least 1 path and if the
#' component has holes there is an additional path for each hole.
#'
#' @details There is a performance hit with `min_first`.
#'
#' @name ccl_outlines
#' @seealso ccl_borders, ccl_labels, ccl_vertices, ccl_cycles, ccl_paths
#' @export
ccl_outlines <- function(m, min_first = TRUE) {
    .Call('_ccloutline_ccl_outlines', PACKAGE = 'ccloutline', m, min_first)
}

#' @title Connected component border vertice paths.
#'
#' @description Connected component grid graph vertice paths for
#' each eulerian cycle for each component.
#'
#' @param m A two dimensional numeric matrix.
#' @param reverse Begin at the minimal column major indexed vertex.
#'
#' @return Nested list of lists of arrays for all outlines of each
#' component such that \code{ccl_cycles(mat)[[label]][[id]]} yields
#' an array in the form of
#' \code{[ v_1, v_2, v_3, ... , v_1]}.
#'
#' Each [[label]] index consists of at least 1 path and if the
#' component has holes there is an additional path for each hole.
#'
#' @details There is a slight performance hit with `reverse` as this
#' forces a scan of the vertices for the minimal remaining valued
#' vertice and reorders the final results.
#'
#' @name ccl_cycles
#' @export
ccl_cycles <- function(m, reverse = FALSE) {
    .Call('_ccloutline_ccl_cycles', PACKAGE = 'ccloutline', m, reverse)
}

#' @title Connected component border grid graph edges.
#'
#' @description Connected component directed edge vertex
#' connections.
#'
#' @param m A two dimensional numeric matrix.
#'
#' @return List of arrays for all directed edges for each connected
#' component such that \code{ccl_edges(mat)[[label]]} yields an
#' array in the form of
#' $[ from_1, to_1, from_2, to_2, ... , from_n, to_n]$.
#'
#' The first two sets of the returned array correspond to the
#' starting index (in column major order) of the component
#' within \code{m}.
#'
#' @name ccl_edges
#' @export
ccl_edges <- function(m) {
    .Call('_ccloutline_ccl_edges', PACKAGE = 'ccloutline', m)
}

ccl_profile <- function(input, reverse = FALSE) {
    .Call('_ccloutline_ccl_profile', PACKAGE = 'ccloutline', input, reverse)
}

#' @title 8-way connected component labelling.
#'
#' @description 8-way neighborhood connected component labelling of
#' all given values.
#'
#' @param m A two dimensional numeric matrix.
#'
#' @return Numeric matrix of the same dimensions as mat with
#'   values indicating component identification label where values
#'   increase in column major order.
#'
#' @name ccl_labels
#' @export
ccl_labels <- function(m) {
    .Call('_ccloutline_ccl_labels', PACKAGE = 'ccloutline', m)
}

#' @title Connected component border cartesian paths.
#'
#' @description Connected component grid graph cartesian coordinate
#' paths for each eulerian cycle (outline) for each component.
#'
#' @param m A two dimensional numeric matrix.
#' @param reverse Begin at the minimal column major indexed vertex.
#'
#' @return Nested list of lists of arrays for all outlines of each
#' component such that \code{ccl_paths(mat)[[label]][[id]]}
#' yields an array in the form of
#' \code{[ v_1, y_1, x_1, v_2, y_2, x_2, ... , v_1, y_1, x_1]}.
#'
#' Each [[label]] index consists of at least 1 path and if the
#' component has holes there is an addition  path for each hole.
#'
#' @details There is a performance hit with `reverse`.
#'
#' @name ccl_paths
#' @seealso ccl_cycles
#' @export
ccl_paths <- function(m, reverse = FALSE) {
    .Call('_ccloutline_ccl_paths', PACKAGE = 'ccloutline', m, reverse)
}
Thell/ccloutline documentation built on July 10, 2020, 2:46 a.m.