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
Par dir collapse #1199
Par dir collapse #1199
Conversation
OK, I think everything is here. |
Hey guys do you plan to add this to 0.9.3? |
We should :) sorry for being late for the PR review. |
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.
thanks again for the PR.
@JacquesOlivierLachaud can you please have a look to it too ? thx
@@ -86,6 +86,9 @@ | |||
- *Topology Package* | |||
- Add pre-calculated look up tables to speed up Object::isSimple calculations. | |||
(Pablo Hernandez-Cerdan, [#1155](https://github.com/DGtal-team/DGtal/pull/1155)) | |||
- Implementation of ParDirCollapse with CollapseSurface and CollapseIsthmus. |
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.
Could you please move this to the 0.9.3 release section ?
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.
done
@@ -910,3 +910,15 @@ @article{kerautret_meaningful_2012 | |||
pages = {2379--2392} | |||
} | |||
|
|||
|
|||
@inproceedings{Chaussard:IWCIA:09, |
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.
Is there a "journal" version of this publication ?
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.
Up to my knowledge there is no journal version.
/** | ||
* Description of class 'ParDirCollapse' <p> | ||
* \brief Aim: Implements thinning algorithm in cubical complexes. | ||
* Paper: Chaussard, J. and Couprie, M., Surface Thinning in 3D Cubical Complexes, |
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.
could you please add a short description (well, a bit longer than just the ref 😃) ?
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.
Added
/// Any model of concepts::CCellularGridSpaceND, i.e. a type that models a Khalimsky space. | ||
typedef typename CC::KSpace KSpace; | ||
/// Type of Nd integer vector | ||
typedef PointVector< KSpace::dimension, int > Vector; |
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.
I think this type can be derived from inner types of CubicalComplex
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.
no need to define from PointVector
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.
done
ParDirCollapse ( const KSpace & k ); | ||
|
||
/** | ||
* @param pComplex -- Cubical complex |
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.
add description.
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.
done
unsigned int eval ( unsigned int iterations ); | ||
|
||
/** | ||
* Extension of basic algorithm which preserve KSpace::dimension - 1 faces which are not included |
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.
++description
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.
The basic algorithm is named right now.
* @param F -- cell of a dimension one lower than G. | ||
* @param G -- cell of a dimension one higher than F. | ||
*/ | ||
int getOrientation ( const Cell& F, const Cell& G ); |
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.
shouldn't this method be const
?
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.
can you please check others?
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.
Sure. Fixed for another methods too.
@section dgtal_ccomplex_sec8 Thinning in cubical complexes | ||
|
||
Thinning of digital objects in 2D and 3D with the guarantee that a final skeleton is thin can be achieved directly | ||
only in \f$\mathbb{Z}^2\f$ for so-called well-composed images. Nevertheless, the problem can be solved for 3D objects |
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.
ref to define well-composed
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.
done
|
||
The first scheme, so-called ParDirCollapse---parallel directional collapse---based on the idea such that free pairs | ||
of faces are collapsed with respect to a fixed order of directions and order of face dimensions. In other words, in | ||
each iteration we first collapse free paris of a given direction starting with pairs of the highest dimension. |
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.
paris -> pairs
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.
done
{ | ||
getComplex< CC, KSpace > ( complex, K ); | ||
thinning.attach ( &complex ); | ||
thinning.collapseSurface (); |
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.
well.. this is not really a unit test without any REQUIRE ;)
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.
You may check for instance the euler number before and after collapse(s) operations.
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.
Done. Thanks for the suggestion.
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.
I have checked the files, but not their execution (I will see tomorrow). There are minor comments to fix before merging.
{ | ||
getComplex< CC, KSpace > ( complex, K ); | ||
thinning.attach ( &complex ); | ||
thinning.collapseSurface (); |
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.
You may check for instance the euler number before and after collapse(s) operations.
getComplex< CC, KSpace > ( complex, K ); | ||
thinning.attach ( &complex ); | ||
thinning.collapseIsthmus (); | ||
} |
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.
Same here.
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.
Done. Thanks for the suggestion.
DGtal::ParDirCollapse< CC >::isIsthmus ( CellMapConstIterator F ) | ||
{ | ||
Cells faces = K.uLowerIncident ( F->first ); | ||
for ( unsigned int i = 0; i < faces.size(); i++ ) |
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.
I think there is a type Size in CubicalComplex (instead of unsigned int).
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.
fixed
DGtal::ParDirCollapse< CC >::isNotIncludedInUpperDim ( CellMapConstIterator F ) | ||
{ | ||
Cells faces = K.uUpperIncident ( F->first ); | ||
unsigned int dim = K.uDim ( F->first ) + 1; |
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.
Type Dimension instead ?
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.
done
DGtal::ParDirCollapse< CC >::getOrientation( const Cell& F, const Cell& G ) | ||
{ | ||
Vector V = K.uKCoords ( F ) - K.uKCoords ( G ); | ||
for ( unsigned int i = 0; i < K.dimension; i++ ) |
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.
Type Dimension instead of unsigned int.
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.
done
number of iteration is not reach. Note in the case of ParDirCollapse thinness of the result depends on the number | ||
of iterations. | ||
|
||
The below steps present how to use ParDirCollapse in DGtal: |
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.
The steps below ...
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.
fixed
The first scheme, so-called ParDirCollapse---parallel directional collapse---based on the idea such that free pairs | ||
of faces are collapsed with respect to a fixed order of directions and order of face dimensions. In other words, in | ||
each iteration we first collapse free paris of a given direction starting with pairs of the highest dimension. | ||
When there is no more free pairs to remove for a given direction then another direction is considered until specified |
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.
until the specified number of iterations is reached ?
or
unless the specified number of iterations is not reached ?
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.
fixed
of faces are collapsed with respect to a fixed order of directions and order of face dimensions. In other words, in | ||
each iteration we first collapse free paris of a given direction starting with pairs of the highest dimension. | ||
When there is no more free pairs to remove for a given direction then another direction is considered until specified | ||
number of iteration is not reach. Note in the case of ParDirCollapse thinness of the result depends on the number |
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.
the thinness ...
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.
fixed
|
||
The first scheme, so-called ParDirCollapse---parallel directional collapse---based on the idea such that free pairs | ||
of faces are collapsed with respect to a fixed order of directions and order of face dimensions. In other words, in | ||
each iteration we first collapse free paris of a given direction starting with pairs of the highest dimension. |
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.
paris => pairs
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.
done
iteration of ParDirCollapse, we mark as non-collapsible those faces which are of dimension dim\f$(X) - 1\f$ and not | ||
included in faces of higher dimension. Moreover, all sub-faces of dimension \f$dim(X) - 2\f$ of those faces | ||
have to be not free -- are included in other faces of dimension \f$dim(X) - 1\f$. The final output is | ||
guarantee to be thin i.e. there is no faces of \f$dim(X)\f$. |
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.
guaranteed
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.
done
d9c346e
to
ed4f588
Compare
Hello Kacper. Did you commit the last changes ? |
Hey @JacquesOlivierLachaud not yet. I have some problems here with building and have not had time to check this. I will try to finish tonight. |
I pushed but I could not compile on my machine. Some other files gave some strange errors. In meanwhile I've had OS upgrade so I guess this is related. Well, lets see if it will pass tests. |
OK @JacquesOlivierLachaud it is ready for review. |
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.
Fine for me.. thanks.
@JacquesOlivierLachaud, is it fine for you?
Seems perfect to me. I just suggest to add a link to this example in the documentation of the module CubicalComplex, (file topology/doc/moduleCubicalComplex.doc), for instance in the line: The following programs are related to this documentation: cubical-complex-collapse.cpp, cubical-complex-illustrations.cpp, testCubicalComplex.cpp, here. |
Added related file.
missing space
Wait for travis/appveyor and I merge. Good work ! |
+1 |
One test failed because my repository has not been synched with master for a while. Should I merge with master? |
No should be fine anyway. Merging. |
Thanks a lot for contributing to DGtal, before submitting your PR, please fill up the description and make sure that all checkboxes are checked. Please remove these lines in your PR.
PR Description
Same as #1111
Checklist
cmake
mode (otherwise, Travis C.I. will fail).