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

Par dir collapse #1199

Merged
merged 35 commits into from Jan 20, 2017
Merged

Par dir collapse #1199

merged 35 commits into from Jan 20, 2017

Conversation

copyme
Copy link
Member

@copyme copyme commented Jul 25, 2016

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

  • Unit-test of your feature with Catch.
  • Doxygen documentation of the code completed (classes, methods, types, members...)
  • Documentation module page added or updated.
  • New entry in the ChangeLog.md added.
  • No warning raised in Debug cmake mode (otherwise, Travis C.I. will fail).
  • All continuous integration tests pass (Travis & appveyor)

@copyme
Copy link
Member Author

copyme commented Sep 28, 2016

OK, I think everything is here.

@copyme
Copy link
Member Author

copyme commented Dec 2, 2016

Hey guys do you plan to add this to 0.9.3?

@dcoeurjo
Copy link
Member

dcoeurjo commented Dec 3, 2016

We should :) sorry for being late for the PR review.

Copy link
Member

@dcoeurjo dcoeurjo left a 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.
Copy link
Member

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 ?

Copy link
Member Author

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,
Copy link
Member

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 ?

Copy link
Member Author

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,
Copy link
Member

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 😃) ?

Copy link
Member Author

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;
Copy link
Member

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

Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

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

add description.

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

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

++description

Copy link
Member Author

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 );
Copy link
Member

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 ?

Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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

Copy link
Member Author

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.
Copy link
Member

Choose a reason for hiding this comment

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

paris -> pairs

Copy link
Member Author

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 ();
Copy link
Member

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 ;)

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.

Copy link
Member Author

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.

Copy link
Member

@JacquesOlivierLachaud JacquesOlivierLachaud left a 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 ();

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 ();
}

Choose a reason for hiding this comment

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

Same here.

Copy link
Member Author

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++ )

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).

Copy link
Member Author

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;

Choose a reason for hiding this comment

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

Type Dimension instead ?

Copy link
Member Author

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++ )

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.

Copy link
Member Author

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:

Choose a reason for hiding this comment

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

The steps below ...

Copy link
Member Author

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

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 ?

Copy link
Member Author

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

Choose a reason for hiding this comment

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

the thinness ...

Copy link
Member Author

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.

Choose a reason for hiding this comment

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

paris => pairs

Copy link
Member Author

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$.

Choose a reason for hiding this comment

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

guaranteed

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@JacquesOlivierLachaud
Copy link
Member

Hello Kacper. Did you commit the last changes ?
I don't see them on github (or I do not use well the new review system).

@copyme
Copy link
Member Author

copyme commented Dec 23, 2016

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.

@copyme
Copy link
Member Author

copyme commented Dec 23, 2016

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.

@copyme
Copy link
Member Author

copyme commented Dec 24, 2016

OK @JacquesOlivierLachaud it is ready for review.

Copy link
Member

@dcoeurjo dcoeurjo left a 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?

@JacquesOlivierLachaud
Copy link
Member

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.
@copyme
Copy link
Member Author

copyme commented Jan 19, 2017

@JacquesOlivierLachaud @dcoeurjo Done.

@JacquesOlivierLachaud
Copy link
Member

Wait for travis/appveyor and I merge. Good work !

@dcoeurjo
Copy link
Member

+1

@copyme
Copy link
Member Author

copyme commented Jan 19, 2017

One test failed because my repository has not been synched with master for a while. Should I merge with master?

@dcoeurjo
Copy link
Member

No should be fine anyway. Merging.
thanks a lot !

@dcoeurjo dcoeurjo merged commit cdb4073 into DGtal-team:master Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants