-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
VoxelComplex: CriticalKernels framework #1147
VoxelComplex: CriticalKernels framework #1147
Conversation
Excellent idea to implement the works of Bertrand and Couprie. I do not have much time at the moment to look at your PR, but I will definitely do it later. By the way, Object::isSimple should also be tabulated (in fact, there is an example that builds the LUT). |
@JacquesOlivierLachaud What do you think about distributing in the source code those pre-computed LUT plain files? Just mentioning boost::serialization for the binary_file option, which is faster to read than a plain file. But probably riskier in terms of portability. Another option is to generate the binary file at build time from the distributed plain file... Edited: I will test the options when the LUT generation finishes in my computer, maybe it is fast enough to read the table in plain text... |
786ee6c
to
afd7bd8
Compare
d2d5abf
to
8babf8a
Compare
61c15c7
to
7b4c502
Compare
Appveyor test looks as a failure because some timeout. I will try to solve all the checklist soon. |
TODO: Change tests to use LUT. |
Hey, I will come back to this pretty soon to polish it. I am not sure if it will ok for dealing with large images, but I will give it a try. |
👌 |
bb7b1dd
to
a41054c
Compare
@rolanddenis I started this before some changes lead by you with khalimsky spaces. I adapted my code to compile against the changes, but not sure if I am taking full advantage of those improvements. Any hint is appreciated! 😅 The code I think should be ready for a preliminary review. The documentation of this PR is pretty much enough for its usage, please see the associated branch in DGtalTools for a screenshot (it needs this PR to work). The script in DGtalTools criticalKernelsThinning3D. The code is quite flexible, accepting a THe idea of isthmus is based on Couprie and Bertrand work, and it is 3D only, but it seems that has been ported to 2D as well here: 2D parallel thinning algorithms based on isthmus-preservation, but I have not pursued any work in this direction. Compared with the homotopicThinning, this code is able to get more details (the finger are captured). Also it is able to use the persistence parameter as a pretty consistent trimmer of short/noise branches. Any feedback is welcome, I will be glad to push this in the next few days if our time permits. Cheers! |
026346c
to
709f166
Compare
hi @phcerdan can this PR be reviewed? |
Yes, it can be! |
Sorry @phcerdan, I just notice your question about the changes in Khalimsky space ... To be short, the main difference between In the class Maybe Finally, while fast checking the code, I didn't see any wrong usage of |
const typename TComplex::Clique & clique) | ||
{ | ||
static std::random_device rd; | ||
static std::mt19937 gen(rd()); // TODO tothink provide seed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I do sometimes in this case is to propose providing a whole random generator instead of the seed only, something like that :
template < typename TComplex >
std::pair<typename TComplex::Cell, typename TComplex::Data>
DGtal::functions::selectRandom(
const typename TComplex::Clique & clique)
{
static std::mt19937 gen( std::random_device{}() );
return selectRandom(clique, gen);
}
template < typename TComplex, typename TRandomGenerator >
std::pair<typename TComplex::Cell, typename TComplex::Data>
DGtal::functions::selectRandom(
const typename TComplex::Clique & clique,
TRandomGenerator & gen
)
{
auto size = clique.nbCells(3);
std::uniform_int_distribution<> dis(0, size - 1);
auto it = clique.begin(3);
std::advance(it, dis(gen));
return *it;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, changing it.
static std::random_device rd; | ||
static std::mt19937 gen(rd()); // TODO tothink provide seed? | ||
static std::mt19937 gen( std::random_device{}() ); | ||
return selectRandom(clique, gen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I forget to specify the template in my suggestion :
return selectRandom<TComplex>(clique, gen);
8f9bffc
to
bb2fd1a
Compare
bb2fd1a
to
7c5056c
Compare
Could you please keep me updated with this PR (Release pending) ? Thanks |
@dcoeurjo I think is ready to be merged. |
👌 thanks |
@section dgtal_vcomplex_sec2 Thinning in voxel complexes | ||
|
||
@cite Couprie201622 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please add further comment on the thinning algorithms ?
hi @phcerdan |
Hi @dcoeurjo, sorry for the delay on this. I will do it first thing in the morning, one more day please! |
@dcoeurjo docs updated! Thanks for the patience and the review. I think it is ready. |
Errors in travis seem unrelated. Time out and doxygen not found. |
thanks a lot! |
allgood;) |
🎉 |
PR Description
Implementation of Critical Kernel framework based on M.Couprie and G.Bertrand articles:
CLI script for testing in any image (future PR in DGtalTools)
Implementation Details
VoxelComplex inherits from CubicalComplex, but no override or hide any method.
It has an Object member storing the voxels(spels) of an input image. This allows the use of the isSimple method from Object, and also the ObjectBoostGraphInterface.
CriticalCliques:
A clique is a set of Voxels.
K_0, K_1, K_2, and K_3 return a pair<bool, Clique> where Clique=CubicalComplex, and the bool is true if the Clique is critical (as described in papers).
K_3 applies to Voxels, and it uses the isSimple method of Object.
K_2 applies to surfels, K_1 to linels, and K_0 to pointels.
In VoxelComplexFunctions a couple of thinning methods are implemented in a functional style, taking a VoxelComplex, a Select function, and a Skel function.
Select function: Select a voxel from a clique (set of voxels)
Skel function: Predicate to check if input voxel is part of the skeleton that we are interested to preserve.
WIP Todo list:
Checklist
cmake
mode (otherwise, Travis C.I. will fail).