CloudCompare / CloudCompare

CloudCompare main repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLI improvements

HeadLessHUN opened this issue · comments

hello Daniel

I have two ideas in my mind currently, and i wanted to ask you if you approve that i could take a look at them or you have some suggestions about them.

1st:
-SS OCTREE -GRID {gridSize}
you could set a grid size in meter. and then it will gets the bounding box of the processed cloud and estimate an OCTREE number for it.

why do i need that?
in my opinion SPATIAL sampling is way slower then OCTREE, i don't really know if it is just a placebo or there is a real reason behind it.

2nd:
it is a little bit more complicated.
-SELECT_ENTITIES {regex}

what it would do:
it will loop through loaded entites, save them to a temp vector (in the commandLineParser class) to keep every single one of them.
and it replace the commandLineParser::clouds() with the filtered result. so it will be applicable to all of the commands. without rewriting everything.

examples:
-SELECT_ENTITIES ".subsampled" //it would select all the clouds which contains .subsampled
-SELECT_ENTITIES ".*" //it would select all the entites

So no problem for the first one. Grid-based subsampling is much faster because it's much simpler. The issue is that it tends to give a very regular pattern (due to the fact that it will take one point per cubical cell of the octree).

For the 'Select Entities' idea, have you a need to deselect the entities afterward? Because in this case I would add the two options (-SELECT_ENTITIES / -UNSELECT_ALL).

Otherwise, it may be simpler to add a 'FILTER_ENTITIES' that removes the other entities. So that you only one command and it's easier to manage?

I tend to like the more regular grid usually. and it is faster, so that is a win. I'll take a lott at it because it does not seem to be a big problem.

For the other one:
I'm more likely go for filter entities, but i want to keep every elements still loaded. So let say you can do tasks like this:

-O ...
-O ...
-O ...
-MERGE_CLOUDS
-SS -OCTREE
-O
-O
-O
-FILTER_ENTITIES "^(?!.*subsampled).*$" //not subsampled_before
-MERGE_CLOUDS
-SS OCTREE
-FILTER_ENTITIES ".*" //give back all the loaded clouds, so the two merged clouds
-MERGE_CLOUDS
-SS OCTREE 
-SAVE_CLOUDS 

The reason for this kind of thing is memory issues, and i don't really ewant to reread files, because usually i'm not that far off with memory limits.

possible solutions:

  • Of course the most memory saving would be to just flush every clouds and load them back again //slow but memory safe
  • load everything merge, subsample //it requires loads of ram, but fastest
  • or the middle ground which can be seen above

So yes i'd keep it in a single commnd. //filter, select, it does not matter for me.
but i want to keep every cloud loaded till CC closed or deleted by other command. So at every point i could select every cloud(entity) which is currently loaded. So that is why i was thinking about a new vector for keeping everything intact, and replace the cmd.clouds() to the filtered vector of clouds. And every call of FILTER/select would replace/rebuild this vector.

Ok for the -SELECT_ENTITIES command then, but to make it work with more general use cases, I guess it would still be valuable to add a -UNSELECT_ALL command next to it. Or maybe simply a sub-option -SELECT_ENTITIES -ALL.

well that is what regex is for. That is a general solution (and probably the easiest to implement), but ok I'll make some suboptions for this.
-ALL, -NONE, -LAST {number}, -FIRST {number}, -REGEX {"any valid regex passed to a regex match"}
maybe a -NOT option to invert the selection, and if not is implemented then there is no need for: -NONE (-NOT -ALL) ,LAST (-NOT -FIRST {number} ), and it is probably sometimes easier to use regex inverting, because sometimes at least for me negate inside regex is a little bit challenging.

Thanks for the quick build :) i'll integrate these to my next deliverable creation :) And probably it gonne make things faster.