umr-amap / aRchi

R package aRchi. Tree architecture from terrestrial laser scanning (TLS) data
21 stars 6 forks source link

.prepareFastSubset error in skeletonize_pc #15

Open spono opened 3 months ago

spono commented 3 months ago

Hi, using skeletonize_pc with default parameters I'm getting the following error:

 (1/4) Computing layers    [==========================] 100%
 (2/4) Clustering layers   [==========================] 100%
 (3/4) Building skeleton   [==========================] 100%
 (4/4) Computing topology  [============>-------------]  50%Error in .prepareFastSubset(isub = isub, x = x, enclos = parent.frame(),  : 
  RHS of == is length 0 which is not 1 or nrow (28349). For robustness, no recycling is allowed (other than of length 1 RHS). Consider %in% instead.

it seems to be related to the data.table package (see here) but I didn't get where this might be located in your process. I stick it here and I'll check if I'm able to dig a bit more in your code in the next days.

In the meantime, here the code used:

library(aRchi)
library(TreeLS) # my own fork, updated version

file = system.file("extdata", "pine.laz", package="TreeLS")
tls = readTLS(file)

# normalize the point cloud
tls = tlsNormalize(tls, keep_ground = F)

# build an empty aRchi file and add the point cloud
aTree = aRchi::build_aRchi()
aTree = aRchi::add_pointcloud( aTree, point_cloud = tls)

# build a skeleton from the point cloud
skeTree = skeletonize_pc(
  aTree,
  D = 0.03,
  progressive = TRUE,
  cl_dist = 0.02,
  max_d = 0.05
)