diff --git a/R/df_rmtrend_x3p.R b/R/df_rmtrend_x3p.R index e292b6e..b3a4807 100644 --- a/R/df_rmtrend_x3p.R +++ b/R/df_rmtrend_x3p.R @@ -6,14 +6,27 @@ #' @import dplyr #' @importFrom x3ptools df_to_x3p #' @importFrom stats lm predict -#' @importFrom rlang .data #' @export - +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' x3p_inner_nomiss_res +#' +#' if (interactive()) { +#' x3p_image_autosize(x3p_inner_nomiss_res) +#' } +#' df_rmtrend_x3p <- function(insidepoly_df) { n_neighbor_val_miss <- value <- x <- y <- + . <- NULL x3p_inner_nomiss_df <- insidepoly_df %>% @@ -22,11 +35,11 @@ df_rmtrend_x3p <- function(insidepoly_df) { ### Remove trend x3p_inner_nomiss_lm <- lm(value ~ x + y + I(x^2) + I(y^2) + x:y, data = x3p_inner_nomiss_df) x3p_inner_nomiss_res_df <- x3p_inner_nomiss_df %>% - mutate(value = value - predict(x3p_inner_nomiss_lm, select(.data, x, y))) + mutate(value = value - predict(x3p_inner_nomiss_lm, select(., x, y))) ### Convert df to x3p x3p_inner_nomiss_res <- x3p_inner_nomiss_res_df %>% - left_join(insidepoly_df[, c("x", "y")], .data) %>% + left_join(insidepoly_df[, c("x", "y")], ., by = join_by(x, y)) %>% df_to_x3p() return(x3p_inner_nomiss_res) diff --git a/R/vec_align_sigs_list.R b/R/vec_align_sigs_list.R index 19d92d2..5c8fd04 100644 --- a/R/vec_align_sigs_list.R +++ b/R/vec_align_sigs_list.R @@ -13,7 +13,19 @@ #' @importFrom ggplot2 ggplot aes geom_line labs xlab ggtitle #' @importFrom bulletxtrctr sig_align #' @export - +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +#' +#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +#' vec_align_sigs_list(x3p_raw_sig_vec(x3p_bin_rotate), x3p_shift_sig_vec(x3p_bin_rotate)) +#' vec_align_sigs_list <- function( sig1, sig2, diff --git a/R/x3p_MLE_angle_vec.R b/R/x3p_MLE_angle_vec.R index 33b5467..a156910 100644 --- a/R/x3p_MLE_angle_vec.R +++ b/R/x3p_MLE_angle_vec.R @@ -12,10 +12,21 @@ #' @importFrom raster raster #' @importFrom imager as.cimg hough_line nfline #' @importFrom stats loess predict -#' @importFrom rlang .data #' @export - -x3p_MLE_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 2, +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +#' +#' x3p_MLE_angle_vec(x3p_inner_impute, min_score_cut = 0.1) +#' +#' +x3p_MLE_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 0.1, ifplot = FALSE, loess_span = 0.2) { theta <- @@ -23,6 +34,7 @@ x3p_MLE_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 2, theta_mod <- theta_mod_shift <- rho <- + . <- NULL ### Change to contrast color @@ -30,7 +42,7 @@ x3p_MLE_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 2, NA_val <- -(x3p$surface.matrix %>% c() %>% summary() %>% - .data[c("Min.", "Max.")] %>% + .[c("Min.", "Max.")] %>% abs() %>% max() %>% ceiling()) diff --git a/R/x3p_image_autosize.R b/R/x3p_image_autosize.R index 5450b6f..42e92a7 100644 --- a/R/x3p_image_autosize.R +++ b/R/x3p_image_autosize.R @@ -10,7 +10,12 @@ #' @importFrom rgl rglwidget #' @importFrom htmltools tagList #' @export - +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' if (interactive()) { +#' x3p_image_autosize(x3p) +#' } +#' x3p_image_autosize <- function(x3p, ifhtml = FALSE, zoom = 0.6, ...) { x3p_image(x3p, size = dim(x3p$surface.matrix), zoom = zoom, ...) diff --git a/R/x3p_impute.R b/R/x3p_impute.R index 923ee02..e57c940 100644 --- a/R/x3p_impute.R +++ b/R/x3p_impute.R @@ -2,6 +2,7 @@ #' #' Obtained x3p object after imputing the inner polygon. #' @param x3p x3p object +#' @param x3p_mask x3p object for mask #' @param mask_col colour for the polygon #' @param concavity strictly positive value used in \code{concaveman::concaveman} #' @param ifsave whether the imputation procedure gif is going to be saved @@ -17,15 +18,30 @@ #' @importFrom magick image_read image_join image_animate image_write #' @importFrom stringr str_detect #' @importFrom wires x3p_surface_polygon -#' @importFrom rlang .data #' @export - -x3p_impute <- function(x3p, mask_col = "#FF0000", concavity = 1.5, - ifsave = FALSE, dir_name = NULL, ifplot = FALSE) { +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' +#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +#' x3p_inner_impute +#' +#' if (interactive()) { +#' x3p_image_autosize(x3p_inner_impute) +#' } +#' +x3p_impute <- function(x3p, x3p_mask, mask_col = "#FF0000", + concavity = 1.5, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) { layer <- x <- y <- value <- + . <- NULL if (ifsave) { @@ -139,21 +155,21 @@ x3p_impute <- function(x3p, mask_col = "#FF0000", concavity = 1.5, path = dir_name, full.names = TRUE ) %>% - .data[str_detect(.data, pattern = ".png")] %>% + .[str_detect(., pattern = ".png")] %>% file.remove() %>% invisible() } - x3p_inner_focal_impute <- x3p %>% + x3p_inner_focal_impute <- x3p_mask %>% x3p_delete_mask() x3p_inner_focal_impute$surface.matrix <- x3p_inner_nomiss_res_focal_raster %>% as.matrix() %>% t() - x3p <- x3p %>% + x3p_mask <- x3p_mask %>% x3p_surface_polygon(colour = mask_col, concavity = concavity) ### Extract inner part as x3p based on mask - x3p_inner <- x3p_extract(x3p, mask_vals = mask_col) %>% + x3p_inner <- x3p_extract(x3p_mask, mask_vals = mask_col) %>% x3p_average(m = 3, na.rm = TRUE) x3p_inner_focal_impute <- x3p_add_mask(x3p_inner_focal_impute, x3p_inner$mask) diff --git a/R/x3p_insidepoly_df.R b/R/x3p_insidepoly_df.R index b9681bf..0f56b91 100644 --- a/R/x3p_insidepoly_df.R +++ b/R/x3p_insidepoly_df.R @@ -11,9 +11,15 @@ #' @importFrom stats sd #' @importFrom raster raster adjacent ncell #' @importFrom wires x3p_surface_polygon -#' @importFrom rlang .data #' @export - +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' str(insidepoly_df) +#' x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) { to <- from <- @@ -21,6 +27,7 @@ x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) { x <- y <- n_neighbor_val_miss <- + . <- NULL x3p <- x3p %>% @@ -89,10 +96,11 @@ x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) { y = x3p_inner_df$y, x = as.character(x), y = as.character(y) - ) + ), + by = join_by(x, y) ) %>% full_join( - .data, + x = ., x3p_inner_df_wide_sd_not_miss %>% pivot_longer( cols = everything(), @@ -103,7 +111,8 @@ x3p_insidepoly_df <- function(x3p, mask_col = "#FF0000", concavity = 1.5) { y = x3p_inner_df$y, x = as.character(x), y = as.character(y) - ) + ), + by = join_by(x, y) ) %>% mutate( x = as.numeric(x), diff --git a/R/x3p_quantile_angle_vec.R b/R/x3p_quantile_angle_vec.R index 8353d15..99f0eb0 100644 --- a/R/x3p_quantile_angle_vec.R +++ b/R/x3p_quantile_angle_vec.R @@ -11,16 +11,28 @@ #' @importFrom raster raster #' @importFrom imager as.cimg hough_line nfline #' @importFrom stats quantile median -#' @importFrom rlang .data #' @export - -x3p_quantile_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 2, +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +#' +#' x3p_quantile_angle_vec(x3p_inner_impute, min_score_cut = 0.1) +#' +#' +x3p_quantile_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 0.1, ifplot = FALSE) { theta <- theta_mod <- theta_mod_shift <- score <- rho <- + . <- NULL ### Change to contrast color @@ -29,7 +41,7 @@ x3p_quantile_angle_vec <- function(x3p, ntheta = 720, min_score_cut = 2, -(x3p$surface.matrix %>% c() %>% summary() %>% - .data[c("Min.", "Max.")] %>% + .[c("Min.", "Max.")] %>% abs() %>% max() %>% ceiling()) diff --git a/R/x3p_raw_sig_vec.R b/R/x3p_raw_sig_vec.R index 9d63316..ce744dd 100644 --- a/R/x3p_raw_sig_vec.R +++ b/R/x3p_raw_sig_vec.R @@ -10,7 +10,20 @@ #' @importFrom ggplot2 ggplot aes geom_line #' @importFrom stats na.omit median #' @export - +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +#' +#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +#' x3p_raw_sig_vec(x3p_bin_rotate) %>% +#' str() +#' x3p_raw_sig_vec <- function(x3p, method = "median", ifplot = FALSE) { x <- value <- @@ -36,5 +49,5 @@ x3p_raw_sig_vec <- function(x3p, method = "median", ifplot = FALSE) { print() } - return(sig) + return(sig$value_summary) } diff --git a/R/x3p_shift_sig_vec.R b/R/x3p_shift_sig_vec.R index 93d0585..df654f4 100644 --- a/R/x3p_shift_sig_vec.R +++ b/R/x3p_shift_sig_vec.R @@ -13,7 +13,20 @@ #' @importFrom purrr map_dbl map set_names #' @importFrom tidyr nest unnest #' @export - +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +#' +#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +#' x3p_shift_sig_vec(x3p_bin_rotate) %>% +#' str() +#' x3p_shift_sig_vec <- function(x3p, method = "median", ifplot = FALSE, delta = -5:5) { y <- value_nobs <- @@ -38,7 +51,7 @@ x3p_shift_sig_vec <- function(x3p, method = "median", ifplot = FALSE, delta = -5 arrange(value_nobs) ### Sort unique y values - y_sort <- inner_join(x3p_df, x3p_df_nobs) %>% + y_sort <- inner_join(x3p_df, x3p_df_nobs, by = join_by(y)) %>% ### Filter to have at least 2 observations for approx later filter(value_nobs >= 2) %>% distinct(y) %>% @@ -119,7 +132,7 @@ x3p_shift_sig_vec <- function(x3p, method = "median", ifplot = FALSE, delta = -5 ) ### Shift x values - x3p_shift_delta_df <- inner_join(x3p_df, x_shift_delta_value_df, by = "y") %>% + x3p_shift_delta_df <- inner_join(x3p_df, x_shift_delta_value_df, by = join_by(y)) %>% mutate(x_shift_delta = x + x_shift_delta_value) if (ifplot) { @@ -188,5 +201,5 @@ x3p_shift_sig_vec <- function(x3p, method = "median", ifplot = FALSE, delta = -5 print() } - sig + return(sig$value_summary) } diff --git a/R/x3p_vertical.R b/R/x3p_vertical.R index ff380b9..6eb39c1 100644 --- a/R/x3p_vertical.R +++ b/R/x3p_vertical.R @@ -12,10 +12,26 @@ #' @import dplyr #' @importFrom x3ptools x3p_bin_stripes x3p_extract x3p_rotate #' @export - +#' @examples +#' x3p <- x3p_subsamples[[1]] +#' mask_col <- "#FF0000" +#' concavity <- 1.5 +#' +#' insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +#' x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +#' x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +#' concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +#' +#' x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +#' x3p_bin_rotate +#' +#' if (interactive()) { +#' x3p_image_autosize(x3p_bin_rotate) +#' } +#' x3p_vertical <- function(x3p_inner_impute, freqs = c(0, 0.3, 0.7, 1), method = "MLE", - ntheta = 720, min_score_cut = 2, + ntheta = 720, min_score_cut = 0.1, ifplot = FALSE, loess_span = 0.2) { x3p_bin <- x3p_inner_impute %>% diff --git a/man/df_rmtrend_x3p.Rd b/man/df_rmtrend_x3p.Rd index 950d766..da219da 100644 --- a/man/df_rmtrend_x3p.Rd +++ b/man/df_rmtrend_x3p.Rd @@ -15,3 +15,18 @@ x3p object of residuals after removing trend \description{ Obtained x3p object after removing missing values and the quadratic trend from the inner polygon. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) + +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +x3p_inner_nomiss_res + +if (interactive()) { + x3p_image_autosize(x3p_inner_nomiss_res) +} + +} diff --git a/man/vec_align_sigs_list.Rd b/man/vec_align_sigs_list.Rd index db0b1c0..e1cec0c 100644 --- a/man/vec_align_sigs_list.Rd +++ b/man/vec_align_sigs_list.Rd @@ -38,3 +38,17 @@ list of aligned signals named \code{ccf}, \code{lag} and \code{lands} followed t \description{ Align signals with plot. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) + +x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +vec_align_sigs_list(x3p_raw_sig_vec(x3p_bin_rotate), x3p_shift_sig_vec(x3p_bin_rotate)) + +} diff --git a/man/x3p_MLE_angle_vec.Rd b/man/x3p_MLE_angle_vec.Rd index db07fee..d3cb080 100644 --- a/man/x3p_MLE_angle_vec.Rd +++ b/man/x3p_MLE_angle_vec.Rd @@ -7,7 +7,7 @@ x3p_MLE_angle_vec( x3p, ntheta = 720, - min_score_cut = 2, + min_score_cut = 0.1, ifplot = FALSE, loess_span = 0.2 ) @@ -29,3 +29,17 @@ vector of rotation angles computed by MLE procedure \description{ Compute the rotation angle using MLE with hough transformation. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) + +x3p_MLE_angle_vec(x3p_inner_impute, min_score_cut = 0.1) + + +} diff --git a/man/x3p_image_autosize.Rd b/man/x3p_image_autosize.Rd index 29e05f3..cab9b23 100644 --- a/man/x3p_image_autosize.Rd +++ b/man/x3p_image_autosize.Rd @@ -21,3 +21,10 @@ rgl plot, list of tags when \code{ifhtml = TRUE} \description{ Plot x3p object as an image with auto-adjusted size based on \code{x3ptools::x3p_image}. } +\examples{ +x3p <- x3p_subsamples[[1]] +if (interactive()) { + x3p_image_autosize(x3p) +} + +} diff --git a/man/x3p_impute.Rd b/man/x3p_impute.Rd index 715a763..36f99a9 100644 --- a/man/x3p_impute.Rd +++ b/man/x3p_impute.Rd @@ -6,6 +6,7 @@ \usage{ x3p_impute( x3p, + x3p_mask, mask_col = "#FF0000", concavity = 1.5, ifsave = FALSE, @@ -16,6 +17,8 @@ x3p_impute( \arguments{ \item{x3p}{x3p object} +\item{x3p_mask}{x3p object for mask} + \item{mask_col}{colour for the polygon} \item{concavity}{strictly positive value used in \code{concaveman::concaveman}} @@ -32,3 +35,20 @@ x3p object after imputation \description{ Obtained x3p object after imputing the inner polygon. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) + +x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) +x3p_inner_impute + +if (interactive()) { + x3p_image_autosize(x3p_inner_impute) +} + +} diff --git a/man/x3p_insidepoly_df.Rd b/man/x3p_insidepoly_df.Rd index c884a68..4f6780e 100644 --- a/man/x3p_insidepoly_df.Rd +++ b/man/x3p_insidepoly_df.Rd @@ -19,3 +19,12 @@ data frame of inside polygon \description{ Create the summary data frame for the inner polygon of an x3p object. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +str(insidepoly_df) + +} diff --git a/man/x3p_quantile_angle_vec.Rd b/man/x3p_quantile_angle_vec.Rd index aed95c0..10105a5 100644 --- a/man/x3p_quantile_angle_vec.Rd +++ b/man/x3p_quantile_angle_vec.Rd @@ -4,7 +4,7 @@ \alias{x3p_quantile_angle_vec} \title{Compute the rotation angle using quantile} \usage{ -x3p_quantile_angle_vec(x3p, ntheta = 720, min_score_cut = 2, ifplot = FALSE) +x3p_quantile_angle_vec(x3p, ntheta = 720, min_score_cut = 0.1, ifplot = FALSE) } \arguments{ \item{x3p}{x3p object} @@ -21,3 +21,17 @@ vector of rotation angles computed by quantile procedure \description{ Compute the rotation angle using quantile with hough transformation. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) + +x3p_quantile_angle_vec(x3p_inner_impute, min_score_cut = 0.1) + + +} diff --git a/man/x3p_raw_sig_vec.Rd b/man/x3p_raw_sig_vec.Rd index cdd8523..8412ec7 100644 --- a/man/x3p_raw_sig_vec.Rd +++ b/man/x3p_raw_sig_vec.Rd @@ -19,3 +19,18 @@ vector of raw signal extracted \description{ Extract signal by computing summary statistics of values along y for each x with raw x3p object. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) + +x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +x3p_raw_sig_vec(x3p_bin_rotate) \%>\% +str() + +} diff --git a/man/x3p_shift_sig_vec.Rd b/man/x3p_shift_sig_vec.Rd index 90cd3f4..a9f34f8 100644 --- a/man/x3p_shift_sig_vec.Rd +++ b/man/x3p_shift_sig_vec.Rd @@ -21,3 +21,18 @@ vector of shifted signals \description{ Extract signal by computing summary statistics of values along y for each x with transformed x3p object by minimizing MSE. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) + +x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +x3p_shift_sig_vec(x3p_bin_rotate) \%>\% +str() + +} diff --git a/man/x3p_vertical.Rd b/man/x3p_vertical.Rd index ca3a51f..07d3486 100644 --- a/man/x3p_vertical.Rd +++ b/man/x3p_vertical.Rd @@ -9,7 +9,7 @@ x3p_vertical( freqs = c(0, 0.3, 0.7, 1), method = "MLE", ntheta = 720, - min_score_cut = 2, + min_score_cut = 0.1, ifplot = FALSE, loess_span = 0.2 ) @@ -35,3 +35,21 @@ x3p object after rotation with vertical striations \description{ Rotate imputed x3p object with striations to the vertical direction. } +\examples{ +x3p <- x3p_subsamples[[1]] +mask_col <- "#FF0000" +concavity <- 1.5 + +insidepoly_df <- x3p_insidepoly_df(x3p, mask_col = mask_col, concavity = concavity) +x3p_inner_nomiss_res <- df_rmtrend_x3p(insidepoly_df) +x3p_inner_impute <- x3p_impute(x3p_inner_nomiss_res, x3p, mask_col = mask_col, +concavity = concavity, ifsave = FALSE, dir_name = NULL, ifplot = FALSE) + +x3p_bin_rotate <- x3p_vertical(x3p_inner_impute, min_score_cut = 0.1) +x3p_bin_rotate + +if (interactive()) { + x3p_image_autosize(x3p_bin_rotate) +} + +}