Jean-Romain / lidRplugins

Extra functions and algorithms for lidR package
43 stars 15 forks source link

latest version of {lidR@devel} breaks tree detection/segmentation algorithms in {lidRplugins} #8

Closed mikoontz closed 4 years ago

mikoontz commented 4 years ago

The tree segmentation/detection algorithms in {lidRplugins} no longer work when you install {lidR} v3.0.0 (i.e., the devel branch of {lidR})

I suspect this has to do with a recent commit in {lidR@devel} adding in more global variables for asserting the context in which the algorithms are called. I'll keep digging and see if I can patch it sufficiently to make a PR.

Hat tip to @youngdjn for first spotting this.

remotes::install_github("Jean-Romain/lidR@devel")
remotes::install_github("Jean-Romain/lidRplugins")

library(lidR)
library(lidRplugins)

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las = readLAS(LASfile)

ttops = tree_detection(las, lmfx(ws = 3))

>Error: Invalid function provided as algorithm.

The same error occurs when running the examples in the help files for hamraz2016(), lmfauto(), multichm(), LayerStacking(), and ptrees().

Jean-Romain commented 4 years ago

Right I changed and simplified stuff but I forget to change than in lidRplugins. It should work now.

mikoontz commented 4 years ago

It does! Awesome, thanks so much. I'll close the issue.

mikoontz commented 4 years ago

Sorry to reopen-- I noticed that ptrees() still has the old versions of the class(f) <- assignment and so the same error noted above lingers.

Is that easier for you to patch, or would you like a PR?

https://github.com/Jean-Romain/lidRplugins/blob/96bcd4399860068fb207cb13a89c1261eb251f50/R/algo-ptree.R#L89

sarahsmithtripp commented 4 years ago

Sorry to reopen (again) but it seems like the compatibility with the updated find_trees function isn't working:

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las = readLAS(LASfile)

ttops = find_trees(las, ptrees(k))
#> Error: Invalid function provided as algorithm'

any thoughts?

Jean-Romain commented 4 years ago

Fixed thank you