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
Par dir collapse #1199
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
74470f7
Initial version
cee00f0
First version which compiles after clean ups.
copyme 91e82c8
Some clean ups
copyme 617e2ad
Refactorization. Small bug fix.
copyme 8b05c3e
Refactorization.
copyme ef1d3dd
Assertions, types, cleanups
copyme ec7b695
small fix for priority
copyme 49a5d3b
Fixes for bugs introduced in the previous commits.
copyme d62b494
check for a concept
copyme 759e03e
fix for "control may reach end of non-void function"
copyme 284b1b9
example which shows how to use ParDirCollapse
copyme d161cb4
removed useless include
copyme 382707b
same as before
copyme c2258c3
test for ParDirCollapse and example enabled in CMake
copyme 51db3e9
formatting
copyme 3dc03e9
Merge branch 'master' of https://github.com/DGtal-team/DGtal into Par…
copyme e8ac525
Merge branch 'master' of https://github.com/DGtal-team/DGtal into Par…
copyme 271d643
fixes for types shadowing.
copyme d55aacc
Merge branch 'master' of https://github.com/DGtal-team/DGtal into Par…
copyme 4652482
fix for unused variables
copyme cc6912a
missing authors
copyme c559d83
merge
3c6fb6e
Documentation for ParDirCollapse
d295475
sync of tags for doc
b504056
fixes for captions of images
copyme 92c3c7d
revert and add new entry
a4632f2
Merge branch 'master' of https://github.com/DGtal-team/DGtal
fdb8b7c
Merge branch 'master' into ParDirCollapse
ed4f588
Entry in the changelog and fix for a typo
f6f672c
typos and missing references
copyme 6feb84a
Descriptions, fixes for types and few others minor changes.
copyme f5a1b17
Type are now correctly resolved.
copyme 0aa2f66
tautology fixed.
copyme 11bd0bf
Update moduleCubicalComplex.dox
copyme 4fe3e78
Update moduleCubicalComplex.dox
copyme File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/** | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
**/ | ||
|
||
/** | ||
* @file cubicalComplexThinning.cpp | ||
* @ingroup Examples | ||
* @author Kacper Pluta (\c kacper.pluta@esiee.fr ) | ||
* Laboratoire d'Informatique Gaspard-Monge - LIGM, France | ||
* | ||
* @date 2016/01/16 | ||
* | ||
* An example file named cubicalComplexThinning. | ||
* | ||
* This file is part of the DGtal library. | ||
*/ | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
#include "ConfigExamples.h" | ||
#include "DGtal/helpers/StdDefs.h" | ||
// Cellular grid | ||
#include "DGtal/topology/CubicalComplex.h" | ||
//! [include] | ||
#include "DGtal/topology/ParDirCollapse.h" | ||
//! [include] | ||
// Shape construction | ||
#include "DGtal/shapes/GaussDigitizer.h" | ||
#include "DGtal/shapes/Shapes.h" | ||
#include "DGtal/shapes/EuclideanShapesDecorator.h" | ||
#include "DGtal/shapes/parametric/Flower2D.h" | ||
// Drawing | ||
#include "DGtal/io/boards/Board2D.h" | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
using namespace std; | ||
using namespace DGtal; | ||
using namespace Z2i; | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
template <typename CC, typename KSpace> | ||
void getComplex ( CC & complex, KSpace & K ) | ||
{ | ||
typedef Flower2D< Space > MyEuclideanShape; | ||
MyEuclideanShape shape( RealPoint( 0.0, 0.0 ), 16, 5, 5, M_PI_2/2. ); | ||
|
||
typedef GaussDigitizer< Space, MyEuclideanShape > MyGaussDigitizer; | ||
MyGaussDigitizer digShape; | ||
digShape.attach( shape ); | ||
digShape.init ( shape.getLowerBound(), shape.getUpperBound(), 1.0 ); | ||
Domain domainShape = digShape.getDomain(); | ||
DigitalSet aSet( domainShape ); | ||
Shapes<Domain>::digitalShaper( aSet, digShape ); | ||
|
||
K.init ( domainShape.lowerBound(), domainShape.upperBound(), true ); | ||
complex.clear(); | ||
complex.construct ( aSet ); | ||
} | ||
|
||
template <typename CC> | ||
void drawComplex ( Board2D & board, CC & complex ) | ||
{ | ||
board.clear(); | ||
typedef typename CC::CellMapConstIterator CellMapConstIterator; | ||
for ( Dimension d = 0; d <= 2; ++d ) | ||
for ( CellMapConstIterator it = complex.begin( d ), itE = complex.end( d ); | ||
it != itE; ++it ) | ||
{ | ||
if ( d == 0 ) | ||
board << CustomStyle( it->first.className(), | ||
new CustomColors( Color( 0, 0, 0 ), | ||
Color( 0, 0, 0 ) ) ); | ||
else if ( d == 1 ) | ||
board << CustomStyle( it->first.className(), | ||
new CustomColors( Color( 200, 0, 0 ), | ||
Color( 100, 255, 100 ) ) ); | ||
else | ||
board << CustomStyle( it->first.className(), | ||
new CustomColors( Color( 0, 0, 200 ), | ||
Color( 100, 255, 100 ) ) ); | ||
board << it->first; | ||
} | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// // | ||
|
||
|
||
int main( int, char** ) | ||
{ | ||
typedef map<Cell, CubicalCellData> Map; | ||
typedef CubicalComplex< KSpace, Map > CC; | ||
Board2D board; | ||
KSpace K; | ||
CC complex ( K ); | ||
//! [create] | ||
ParDirCollapse < CC > thinning ( K ); | ||
//! [create] | ||
trace.beginBlock ( "ParDirCollapse -- 2 iterations." ); | ||
getComplex< CC, KSpace > ( complex, K ); | ||
drawComplex<CC> ( board, complex ); | ||
board.saveEPS ( "ComplexBeforeThinning.eps" ); | ||
//! [init] | ||
thinning.attach ( &complex ); | ||
//! [init] | ||
|
||
//! [thinn] | ||
thinning.eval ( 2 ); | ||
//! [thinn] | ||
drawComplex<CC> ( board, complex ); | ||
board.saveEPS ( "ParDirCollapse_2.eps" ); | ||
trace.endBlock(); | ||
|
||
trace.beginBlock ( "ParDirCollapse -- collapseSurface." ); | ||
getComplex< CC, KSpace > ( complex, K ); | ||
thinning.attach ( &complex ); | ||
//! [thinnSurface] | ||
thinning.collapseSurface (); | ||
//! [thinnSurface] | ||
drawComplex<CC> ( board, complex ); | ||
board.saveEPS ( "ParDirCollapse_collapseSurface.eps" ); | ||
trace.endBlock(); | ||
|
||
trace.beginBlock ( "ParDirCollapse -- collapseIsthmus." ); | ||
getComplex< CC, KSpace > ( complex, K ); | ||
thinning.attach ( &complex ); | ||
//! [thinnIsthmus] | ||
thinning.collapseIsthmus (); | ||
//! [thinnIsthmus] | ||
drawComplex<CC> ( board, complex ); | ||
board.saveEPS ( "ParDirCollapse_collapseIsthmus.eps" ); | ||
trace.endBlock(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.