Type: Package
Title: Pointcloud Interactive Computation
Version: 1.2.6
Description: Provides advanced algorithms for analyzing pointcloud data from terrestrial laser scanner in forestry applications. Key features include fast voxelization of large datasets; segmentation of point clouds into forest floor, understorey, canopy, and wood components. The package enables efficient processing of large-scale forest pointcloud data, offering insights into forest structure, connectivity, and fire risk assessment. Algorithms to analyze pointcloud data (.xyz input file). For more details, see Ferrara & Arrizza (2025) https://hdl.handle.net/20.500.14243/533471. For single tree segmentation details, see Ferrara et al. (2018) <doi:10.1016/j.agrformet.2018.04.008>.
License: GPL (≥ 3)
Depends: R (≥ 4.3)
Imports: collapse, conicfit, data.table, dbscan, dplyr, foreach, magrittr, sf, stats, tictoc, utils
Suggests: DT, fs, ggplot2, later, plotly, shiny, shinycssloaders, shinydashboard, shinydashboardPlus, shinyFeedback, shinyFiles, shinyjs, shinythemes, shinyWidgets, testthat (≥ 3.0.0), tools, withr
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.3.2
URL: https://github.com/rupppy/PiC
BugReports: https://github.com/rupppy/PiC/issues
NeedsCompilation: no
Packaged: 2025-10-11 17:42:56 UTC; robertoferrara
Author: Roberto Ferrara ORCID iD [aut, cre], Stefano Arrizza ORCID iD [ctb]
Maintainer: Roberto Ferrara <roberto.ferrara@cnr.it>
Repository: CRAN
Date/Publication: 2025-10-11 18:00:02 UTC

PiC: Pointcloud Interactive Computation

Description

Provides advanced algorithms for analyzing pointcloud data from terrestrial laser scanner in forestry applications. Key features include fast voxelization of large datasets; segmentation of point clouds into forest floor, understorey, canopy, and wood components. The package enables efficient processing of large-scale forest pointcloud data, offering insights into forest structure, connectivity, and fire risk assessment. Algorithms to analyze pointcloud data (.xyz input file). For more details, see Ferrara & Arrizza (2025) https://hdl.handle.net/20.500.14243/533471. For single tree segmentation details, see Ferrara et al. (2018) doi:10.1016/j.agrformet.2018.04.008.

Author(s)

Maintainer: Roberto Ferrara roberto.ferrara@cnr.it (ORCID)

Other contributors:

See Also

Useful links:


Calculate tree and canopy metrics

Description

Computes metrics for individual trees and forest canopy from segmented point clouds.

Usage

Calculate_trees_metrics(
  woodpoint,
  a,
  AGB_def,
  Forest_floor,
  plot,
  filename,
  output_path,
  canopy_voxel_size = 0.1,
  min_canopy_height = 1.5,
  coverage_method = "mean_normalized"
)

Arguments

woodpoint

Wood points (trunks and branches) with cluster attribute

a

Original point cloud

AGB_def

Non-wood (foliage) points

Forest_floor

Forest floor points

plot

Plot/output file prefix

filename

Original file prefix

output_path

Output directory

canopy_voxel_size

Voxel size for canopy analysis

min_canopy_height

Minimum height for canopy analysis

coverage_method

Coverage degree calculation method

Value

List containing tree metrics, canopy metrics, and file paths


Forest floor segmentation

Description

Segments the input .xyz pointcloud file into different forestry layers: forest floor and above ground biomass.

Usage

Floseg(a, filename="XXX", soil_dim = 0.3, th = 20, N=500, output_path = tempdir())

Arguments

a

- Input file (.xyz)

filename

- Output file prefix

soil_dim

- Voxel dimension (m) for forest floor segmentation - Default = 0.30

th

- Minimum number of point to generate a voxel. Default = 20

N

- Minimum number of voxel to generate a cluster. Default = 500

output_path

Directory in cui scrivere i file di output. Default = tempdir()

Value

2 files (.txt) output. 1. Forest floor pointcolud; 2. AGB pointcloud


Forest component segmentation

Description

Segments an input .xyz point cloud file into different forestry layers (soil, wood, foliage), computes individual tree metrics, and provides summary statistics and canopy metrics.

Usage

Forest_seg(
  a,
  filename = "XXX",
  dimVox = 2,
  th = 2,
  eps = 2,
  mpts = 9,
  h_tree = 1,
  soil_dim = 0.1,
  N = 500,
  R = 30,
  Vox_print = FALSE,
  WoodVox_print = FALSE,
  output_path = tempdir(),
  analyze_canopy = TRUE,
  canopy_voxel_size = 0.1,
  min_canopy_height = 1.5,
  coverage_method = "mean_normalized"
)

Arguments

a

Input point cloud data frame (.xyz) or file path

filename

Output file prefix

dimVox

Voxel dimension (cm) for wood segmentation (default = 2)

th

Minimum number of points to generate a voxel (default = 2)

eps

Epsilon neighborhood radius for DBSCAN (default = 2)

mpts

Minimum points required in eps neighborhood for core points (default = 9)

h_tree

Minimum trunk length in meters (default = 1)

soil_dim

Voxel dimension (m) for forest floor segmentation (default = 0.1)

N

Minimum number of voxels in a wood cluster (default = 500)

R

Cluster shape parameter threshold (default = 30)

Vox_print

Logical; if TRUE, saves point cloud voxelization (default = FALSE)

WoodVox_print

Logical; if TRUE, saves wood voxelization (default = FALSE)

output_path

Output directory (default = tempdir())

analyze_canopy

Logical; if TRUE, performs canopy analysis (default = TRUE)

canopy_voxel_size

Voxel size for canopy analysis in meters (default = 0.1)

min_canopy_height

Minimum height threshold for canopy analysis (default = 1.5)

coverage_method

Method for calculating coverage degree (default = "mean_normalized")

Value

List containing file paths and metrics for trees and canopy.


Single Tree wood leaf segmentation

Description

Wood - leaf segmentation of single tree

Usage

SegOne(a, filename = "Elab_single_tree", dimVox = 2, th = 2, 
eps = 1, mpts = 4, N = 1000, R = 30, output_path = tempdir())

Arguments

dimVox

- voxel dimension in cm - Default = 2

th

- Minimum number of points to generate a voxel - Default = 2

filename

- Output file prefix

a

- AGB voxelized input file

eps

- size (radius) of the epsilon neighborhood - Default = 1

mpts

- number of minimum points required in the eps neighborhood for core points (including the point itself) - Default = 4

N

- Minimum number of voxel in a wood cluster - Default = 1000

R

- R = Standard deviation * Proportion of Variance - Default = 30

output_path

Directory in cui scrivere i file di output. Default = tempdir()

Value

Two file (.txt) in output - Wood points and non wood points


Voxelize point cloud

Description

Transform pointcloud in voxel

Usage

Voxels(a, filename = "XXX", dimVox = 2, th = 2, output_path = tempdir())

Arguments

a

- input file

filename

- file output prefix

dimVox

- voxel dimension in cm - Default = 2

th

Minimum number of point to generate a voxel (Default = 1) Is a parameter that should be used with caution; it generates a lightened cloud with fewer points. To be evaluated in relation with the dimVox parameter, for high point densities it is efficae to remove noise (outliers)

output_path

Directory in cui scrivere i file di output. Default = tempdir()

Value

Voxelized pointcloud


Analyze forest canopy (internal)

Description

Analyze forest canopy (internal)

Usage

analyze_forest_canopy(
  AGB_def,
  Forest_floor,
  voxel_size = 0.1,
  min_height = 1.5,
  coverage_method = "mean_normalized",
  area_of_interest = NULL,
  output_path = tempdir()
)

Calculate coverage degree (internal)

Description

Calculate coverage degree (internal)

Usage

calculate_coverage_degree(voxel_data, method = "mean_normalized")

Calculate crown base heights (internal)

Description

Calculate crown base heights (internal)

Usage

calculate_crown_base_heights(tree_ids, plot_metrics, AGB_def)

Calculate DBH (internal)

Description

Calculate DBH (internal)

Usage

calculate_dbh(tree_metrics, woodpoint)

Calculate vertical profile (internal)

Description

Calculate vertical profile (internal)

Usage

calculate_vertical_profile(
  voxel_data,
  w_column,
  voxel_size,
  height_interval = 1
)

Extract forest floor (internal)

Description

Extract forest floor (internal)

Usage

extract_forest_floor(a, soil_dim, th = 20, N = 500, output_path, plot)

Filter trees by point count (internal)

Description

Filter trees by point count (internal)

Usage

filter_trees_by_point_count(plot_metrics, woodpoint)

Launch PiC Shiny App

Description

Launch the Shiny app for interactive 3D point cloud processing.

Usage

run_PiC()

Details

This function launches an interactive web application for analyzing forest point cloud data. The app requires additional packages that are not installed by default. If these packages are missing, you will be prompted to install them.

Value

No return value, called for side effects (launches Shiny app)

Examples

## Not run: 
# Launch the interactive app
run_PiC()

## End(Not run)

Segment wood (internal)

Description

Segment wood (internal)

Usage

segment_wood(
  AGB,
  dim,
  th,
  eps,
  mpts,
  h_tree,
  N,
  R,
  Vox_print,
  WoodVox_print,
  plot,
  output_path
)

Separate foliage (internal)

Description

Separate foliage (internal)

Usage

separate_foliage(AGB, woodpoint, plot, eps, mpts, output_path)