Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to crop interest zone and filter min dbh trees #22

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GabijaBern
Copy link
Collaborator

A couple of small changes:

  1. Formatted the code using the clang-format in the repo. However, I see quite a few changes, would be happy to be questioned if I did indeed formatted it the right way.
  2. Added optional parameter which is interest zone bottom left corner which works with grid_width argument. If user chooses to crop the results using the grid_width parameter, they can choose a point from which this section should be cropped. Default option is taking the middle section, but with interest zone left bottom corner one can crop anywhere.
  3. Added option to filter min_radius trees from the results, which is useful if one wants trees only with dbh > 10cm.

@GabijaBern
Copy link
Collaborator Author

@thomas-lowe could I get a review?

@@ -23,16 +24,24 @@ bool readLas(const std::string &file_name,
{
#if RAYLIB_WITH_LAS
std::cout << "readLas: filename: " << file_name << std::endl;
std::ifstream file(file_name);

if (file)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unnecessary, there is already a check and message below to cerr that says "failed to open stream".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fail() method call below does not provide information if the file does not exists, I think that the error is quite generic and is not very helpful while working with docker. One has to mount the volumes correctly and it took me time to understand and realise that file did not exist in the image as the volume was not mounted correctly. I am happy to refactor the code and add proper error handling?

raycloudtools/rayextract/rayextract.cpp Show resolved Hide resolved
raycloudtools/rayextract/rayextract.cpp Outdated Show resolved Hide resolved
raycloudtools/rayextract/rayextract.cpp Outdated Show resolved Hide resolved
raylib/rayparse.h Outdated Show resolved Hide resolved
raylib/extraction/raytrees.cpp Outdated Show resolved Hide resolved
@@ -46,11 +46,16 @@ int rayImport(int argc, char *argv[])
bool ray_format =
ray::parseCommandLine(argc, argv, { &cloud_file, &ray_text, &ray_vec }, { &max_intensity_option, &remove });
if (!standard_format && !position_format && !ray_format)
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why rayimport.cpp has clang changes, as I don't see any other change to this file.
I assume clang changes are only to files you have changed in some other functional way.

I'd prefer these files weren't reformatted like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have restored the previous style. I believe that either .clang-format file needs to be removed or the whole repo formatted 🤔

@@ -55,12 +57,14 @@ void usage(int exit_code = 1)
std::cout << " --crop_length 1.0 - (-p) crops small branches to this distance from end" << std::endl;
std::cout << " --distance_limit 1 - (-d) maximum distance between neighbour points in a tree" << std::endl;
std::cout << " --height_min 2 - (-h) minimum height counted as a tree" << std::endl;
std::cout << " --min_radius 0.01 - (-r) minimum tree radius to consider" << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This serves a very similar purpose to height_min, do you really need to crop specifically on radius rather than height?

One reason we have treetools (https://github.com/csiro-robotics/treetools) is to keep rayextract commandline params to a minimum. Could you achieve the same effect by running treesplit output_trees.txt radius 0.01 ?

If so then I would prefer we didn't add the extra parameter here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it is quite handy functionality allowing easy trees filtering. Normally, especially when estimating the biomass, trees with dbh<10cm are ignored and this flag gives direct, non convoluted way of filtering such trees.

raylib/extraction/raytrees.h Outdated Show resolved Hide resolved
raycloudtools/rayextract/rayextract.cpp Outdated Show resolved Hide resolved
@GabijaBern GabijaBern force-pushed the new_command_line_params branch 20 times, most recently from 86779b2 to 5817ce5 Compare November 13, 2024 13:59
@thomas-lowe
Copy link
Collaborator

Just those two changes above

@GabijaBern
Copy link
Collaborator Author

Could you point me to what exactly you are referring to?

@thomas-lowe
Copy link
Collaborator

Hi Gabi,
I decided it was easier for me to take your ideas and implement them a bit differently on my pull request here: #24 (I added you as triage collaborator but I don't think I can assign you to the pull request until you accept). Hopefully you can access and look at the PR anyway.

Let me know if you have any issues with this adjusted implementation. I have to be very careful to get the interface right as there are a lot of users. I have tested it on some basic examples using the overlap grid and the grid_width/grid_origin options.

@GabijaBern GabijaBern marked this pull request as draft November 20, 2024 09:44
@GabijaBern GabijaBern force-pushed the new_command_line_params branch 3 times, most recently from 88ad782 to aa001fb Compare November 20, 2024 14:04
@GabijaBern GabijaBern force-pushed the new_command_line_params branch 19 times, most recently from 5b42960 to 1500719 Compare November 21, 2024 14:11
@GabijaBern GabijaBern force-pushed the new_command_line_params branch from 1500719 to 10fcc4a Compare November 21, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants