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

(Reverse) Distance Transformation on Periodic Spaces #1206

Merged
merged 55 commits into from
Nov 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
b2ec223
Adding periodicity specification in VoronoiMap.
rolanddenis Aug 31, 2016
3e94aca
Cleaning code.
rolanddenis Aug 31, 2016
b8ae147
Adding draft test for periodic dimensions and fixing issue.
rolanddenis Aug 31, 2016
d5a6752
Updating DistanceTransformation and adding some tests.
rolanddenis Aug 31, 2016
c685597
Testing VoronoiMap on all periodicity possibilities.
rolanddenis Sep 1, 2016
e3595d9
Fixing bug in VoronoiMap along periodic dimensions other than 0.
rolanddenis Sep 1, 2016
961abfa
Documenting and adding periodicity specification accessors.
rolanddenis Sep 1, 2016
b377afd
Checking voronoi map validity for all periodicities and metrics.
rolanddenis Sep 1, 2016
1e90559
Adding periodicity test in testDistanceTransformation.
rolanddenis Sep 1, 2016
f9cd8af
minor typos/edits
dcoeurjo Sep 6, 2016
703ec36
disabling default constructor
dcoeurjo Sep 6, 2016
e703f6f
extra braces
dcoeurjo Sep 6, 2016
e3097cd
Merge pull request #3 from dcoeurjo/perio
rolanddenis Sep 7, 2016
ac6b1eb
minor edit
dcoeurjo Sep 7, 2016
ceee9e6
Documenting...
rolanddenis Sep 7, 2016
67cb234
Merge branch 'periodicVoronoiMap' of github.com:rolanddenis/DGtal int…
rolanddenis Sep 7, 2016
9e00867
Merge remote-tracking branch 'dcoeurjo/perio' into periodicVoronoiMap
rolanddenis Sep 7, 2016
23de7eb
Using isPeriodic for testing periodicity in VoronoiMap.ih
rolanddenis Sep 7, 2016
f697b89
Using default copy operator and destructor in VoronoiMap.
rolanddenis Sep 9, 2016
4870f21
Adding periodicity specification in PowerMap.
rolanddenis Sep 12, 2016
a33ab18
Checking CImage concept in PowerMap and VoronoiMap.
rolanddenis Sep 12, 2016
053f485
Fixing compilation issue.
rolanddenis Sep 12, 2016
951e119
Fixing periodicity behavior of PowerMap.
rolanddenis Sep 14, 2016
864a594
starting the doc
dcoeurjo Sep 30, 2016
0a49407
Merge branch 'periodicPowerMap' into periodicVoronoiMap
rolanddenis Sep 30, 2016
705e2ab
Fixing doc.
rolanddenis Oct 3, 2016
4cde117
doc editing
dcoeurjo Oct 17, 2016
0a10c14
working on example
dcoeurjo Oct 17, 2016
a88478c
example
dcoeurjo Oct 18, 2016
52f956b
example ok
dcoeurjo Oct 18, 2016
39cce7f
doc
dcoeurjo Oct 18, 2016
0441000
images
dcoeurjo Oct 18, 2016
e221cec
doc update
dcoeurjo Oct 18, 2016
7f11ae8
Documenting PowerMap and adding pre-condition when projecting points.
rolanddenis Oct 19, 2016
0010710
Adding point projection in VoronoiMap.
rolanddenis Oct 19, 2016
da8890f
Fixing assertion failure in PowerMap.
rolanddenis Oct 19, 2016
5c0601e
Completing testPowerMap with periodicity, 3D and 4D.
rolanddenis Oct 19, 2016
c7ffc64
Fixing bug in PowerMap.
rolanddenis Oct 19, 2016
e6e4eec
Fixing tabs.
rolanddenis Oct 19, 2016
d6e732f
Fix test for the HDF5 Travis failure.
rolanddenis Oct 20, 2016
f538378
Another fix test.
rolanddenis Oct 20, 2016
86501b7
Revert the fix tests for the HDF5 Travis failure.
rolanddenis Oct 20, 2016
a11f80e
Adding periodicity tests for ReducedMedialAxis.
rolanddenis Oct 20, 2016
5579b60
Cleaning ReducedMedialAxis.
rolanddenis Oct 20, 2016
5a7ab74
Merge branch 'master' into periodicVoronoiMap
rolanddenis Oct 21, 2016
4c59b7c
Updating ChangeLog.md for PR #1206
rolanddenis Oct 21, 2016
55d4e9f
Adding @rolandenis in the doc
dcoeurjo Nov 1, 2016
e147930
Disabling HDF5 on mac in travis
dcoeurjo Nov 1, 2016
7a6374c
Disabling HDF5 on mac in travis
dcoeurjo Nov 1, 2016
9c6fe59
Update .travis.yml
dcoeurjo Nov 1, 2016
64807ad
Modifying color map in order to have similar colors.
rolanddenis Nov 1, 2016
c15d7fb
Updating toricdomainvolumetric example with partial periodicity.
rolanddenis Nov 1, 2016
9df81b7
Updating VoronoiMap tutorial's images with similar color map.
rolanddenis Nov 2, 2016
e70a47b
Fixing zero-length arrows in toricdomainvolumetric
rolanddenis Nov 3, 2016
e58cce8
Updating tuto with partial periodic specification.
rolanddenis Nov 3, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ before_install:
before_script:
- if [ $TRAVIS_OS_NAME == linux ]; then echo "All done."; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update; brew install boost doxygen homebrew/science/hdf5 graphviz graphicsmagick gmp libqglviewer fftw; echo "done";fi
# Workaround due to HDF5 issues on mac (issue #1213)
- if [ $TRAVIS_OS_NAME == osx ]; then BTYPE="$BTYPE -DWITH_HDF5=false" ; echo "Disabling HDF5 on MacOS"; fi


############
Expand Down
8 changes: 8 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# DGtal 0.9.3

## New Features / Critical Changes

- *Geometry Package*
- VoronoiMap, PowerMap, (Reverse)DistanceTransformation and ReducedMedialAxis
now work on toric domains (with per-dimension periodicity specification).
(David Coeurjolly, Roland Denis,
[#1206](https://github.com/DGtal-team/DGtal/pull/1206))

## Bug Fixes

- *Configuration/General*
Expand Down
1 change: 1 addition & 0 deletions examples/geometry/volumes/distance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SET(DGTAL_EXAMPLES_SRC
toricdomainvolumetric
distancetransform2D
exampleFMM2D
voronoimap2D
Expand Down
221 changes: 221 additions & 0 deletions examples/geometry/volumes/distance/toricdomainvolumetric.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
/**
* 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 geometry/volumes/distance/toricdomainvolumetric.cpp
* @ingroup Examples
* @author David Coeurjolly (\c [email protected] )
* Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
*
* @date 2016/10/17
*
* An example file named toricdomainvolumetric. The aim of this example
* is to demonstrate the volumetric analysis functions on toric
* domains.
*
* This file is part of the DGtal library.
*/

///////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <iomanip>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/colormaps/GrayscaleColorMap.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
#include "DGtal/io/colormaps/TickedColorMap.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/images/ImageSelector.h"
#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
int main()
{

//! [DTDef]
using namespace std;
using namespace DGtal;
using namespace Z2i;

Point a ( 0, 0 );
Point b ( 32, 16);

//Input image with unsigned char values
typedef ImageSelector<Domain, unsigned int>::Type Image;
Image image ( Domain(a, b ));

//We fill the image with the 128 value
for ( Image::Iterator it = image.begin(), itend = image.end();it != itend; ++it)
(*it)=128;

//We add 3 seeds with 0 values.
image.setValue(Point(16,2), 0);
image.setValue(Point(2,11), 0);
image.setValue(Point(30,15), 0);
//! [DTDef]

trace.beginBlock ( "Example toricdomainvolumetric" );
//Input shape output
typedef GrayscaleColorMap<Image::Value> Gray;
Board2D board;
board.setUnit ( LibBoard::Board::UCentimeter );
Display2DFactory::drawImage<Gray>(board, image, (unsigned int)0, (unsigned int)129);
board.saveSVG("toric-inputShape.svg");

//! [DTPredicate]
//Point Predicate from random seed image
typedef functors::SimpleThresholdForegroundPredicate<Image> PointPredicate;
PointPredicate predicate(image,0);
//! [DTPredicate]

//! [DTComputeToric]
typedef DistanceTransformation<Space, PointPredicate, L2Metric> DTL2;
typedef DistanceTransformation<Space, PointPredicate, L2Metric> DTL2Toric;

//Regular 2D domain
DTL2 dtL2(image.domain(), predicate, l2Metric);
//Full toric 2D domain
DTL2Toric dtL2Toric(image.domain(), predicate, l2Metric, {{true, true}} );
//! [DTComputeToric]

//! [DTComputePartialToric]
typedef DistanceTransformation<Space, PointPredicate, L2Metric> DTL2ToricX;
typedef DistanceTransformation<Space, PointPredicate, L2Metric> DTL2ToricY;

// 2D domain that is periodic along the first dimension.
DTL2ToricX dtL2ToricX( image.domain(), predicate, l2Metric, {{true, false}} );
// 2D domain that is periodic along the second dimension.
DTL2ToricY dtL2ToricY( image.domain(), predicate, l2Metric, {{false, true}} );
//! [DTComputePartialToric]

//We compute the maximum DT value on the L2 map
const DTL2::Value maxv2 = * (std::max_element(dtL2.constRange().begin(), dtL2.constRange().end()));
const DTL2Toric::Value maxvtoric = * (std::max_element(dtL2Toric.constRange().begin(), dtL2Toric.constRange().end()));
const DTL2ToricX::Value maxvtoricX = * (std::max_element(dtL2ToricX.constRange().begin(), dtL2ToricX.constRange().end()));
const DTL2ToricY::Value maxvtoricY = * (std::max_element(dtL2ToricY.constRange().begin(), dtL2ToricY.constRange().end()));

// Color map based on the maximal value for all maps (in order to compare results with similar colors).
const auto maxvall = std::max( { maxv2, maxvtoric, maxvtoricX, maxvtoricY } );

//! [DTColormaps]
//Colormap used for the SVG output
typedef HueShadeColorMap<DTL2::Value, 1> HueTwice;
//! [DTColormaps]

trace.warning() << "DT maxValue= " << maxv2 << endl;
board.clear();
Display2DFactory::drawImage<HueTwice>(board, dtL2, 0.0, maxvall + 1);
board.saveSVG ( "toric-example-DT-L2.svg" );

trace.warning() << "Full toric maxValue= " << maxvtoric << endl;
board.clear();
Display2DFactory::drawImage<HueTwice>(board, dtL2Toric, 0.0, maxvall + 1);
board.saveSVG ( "toric-example-DT-L2-toric.svg" );

trace.warning() << "1th dimension periodic maxValue= " << maxvtoricX << endl;
board.clear();
Display2DFactory::drawImage<HueTwice>(board, dtL2ToricX, 0.0, maxvall + 1);
board.saveSVG ( "toric-example-DT-L2-toricX.svg" );

trace.warning() << "2nd dimension periodic maxValue= " << maxvtoricY << endl;
board.clear();
Display2DFactory::drawImage<HueTwice>(board, dtL2ToricY, 0.0, maxvall + 1);
board.saveSVG ( "toric-example-DT-L2-toricY.svg" );

//Explicit export with ticked colormap
//We compute the maximum DT value on the L2 map
TickedColorMap<double, GradientColorMap<double> > ticked(0.0,maxv2, Color::White);
ticked.addRegularTicks(3, 0.5);
ticked.finalize();
ticked.colormap()->addColor( Color::Red );
ticked.colormap()->addColor( Color::Black );
board.clear();
for ( auto it = dtL2.domain().begin(), itend = dtL2.domain().end();it != itend; ++it)
{
board<< CustomStyle((*it).className(),new CustomColors(ticked(dtL2(*it)),ticked(dtL2(*it))));
board << *it;
}
board.saveSVG("toric-example-DT-L2-ticked.svg");

board.clear();
for ( auto it = dtL2Toric.domain().begin(), itend = dtL2Toric.domain().end();it != itend; ++it)
{
board<< CustomStyle((*it).className(),new CustomColors(ticked(dtL2Toric(*it)),ticked(dtL2Toric(*it))));
board << *it;
}
board.saveSVG("toric-example-DT-L2-ticked-toric.svg");

board.clear();
for ( auto it = dtL2ToricX.domain().begin(), itend = dtL2ToricX.domain().end();it != itend; ++it)
{
board<< CustomStyle((*it).className(),new CustomColors(ticked(dtL2ToricX(*it)),ticked(dtL2ToricX(*it))));
board << *it;
}
board.saveSVG("toric-example-DT-L2-ticked-toricX.svg");

board.clear();
for ( auto it = dtL2ToricY.domain().begin(), itend = dtL2ToricY.domain().end();it != itend; ++it)
{
board<< CustomStyle((*it).className(),new CustomColors(ticked(dtL2ToricY(*it)),ticked(dtL2ToricY(*it))));
board << *it;
}
board.saveSVG("toric-example-DT-L2-ticked-toricY.svg");

//Voronoi vector output
board.clear();
board << dtL2.domain();
for ( auto it = dtL2.domain().begin(), itend = dtL2.domain().end();it != itend; ++it)
if ( dtL2.getVoronoiVector(*it) != *it )
Display2DFactory::draw(board,dtL2.getVoronoiVector(*it) - (*it), (*it));
board.saveSVG("toric-example-Voro-L2.svg");

board.clear();
board << dtL2Toric.domain();
for ( auto it = dtL2Toric.domain().begin(), itend = dtL2Toric.domain().end();it != itend; ++it)
if ( dtL2Toric.getVoronoiVector(*it) != *it )
Display2DFactory::draw(board, dtL2Toric.getVoronoiVector(*it) - (*it), (*it));
board.saveSVG("toric-example-Voro-L2-toric.svg");

board.clear();
board << dtL2Toric.domain();
for ( auto it = dtL2Toric.domain().begin(), itend = dtL2Toric.domain().end();it != itend; ++it)
if ( dtL2Toric.getVoronoiVector(*it) != *it )
Display2DFactory::draw(board, dtL2Toric.projectPoint(dtL2Toric.getVoronoiVector(*it)) - (*it), (*it));
board.saveSVG("toric-example-Voro-L2-toric-projected.svg");

board.clear();
board << dtL2ToricX.domain();
for ( auto it = dtL2ToricX.domain().begin(), itend = dtL2ToricX.domain().end();it != itend; ++it)
if ( dtL2ToricX.getVoronoiVector(*it) != *it )
Display2DFactory::draw(board, dtL2ToricX.getVoronoiVector(*it) - (*it), (*it));
board.saveSVG("toric-example-Voro-L2-toricX.svg");

board.clear();
board << dtL2ToricY.domain();
for ( auto it = dtL2ToricY.domain().begin(), itend = dtL2ToricY.domain().end();it != itend; ++it)
if ( dtL2ToricY.getVoronoiVector(*it) != *it )
Display2DFactory::draw(board, dtL2ToricY.getVoronoiVector(*it) - (*it), (*it));
board.saveSVG("toric-example-Voro-L2-toricY.svg");

trace.endBlock();
return 0;
}
// //
///////////////////////////////////////////////////////////////////////////////
14 changes: 14 additions & 0 deletions src/DGtal/doc/global.bib
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,20 @@ @book{OsherFedkiw2003
year = {2003}
}

@inproceedings{Coeurjo2008,
TITLE = {{Distance Transformation, Reverse Distance Transformation and Discrete Medial Axis on Toric Spaces}},
AUTHOR = {Coeurjolly, David},
URL = {https://hal.archives-ouvertes.fr/hal-00350154},
BOOKTITLE = {{International Conference on Pattern Recognition}},
ADDRESS = {Tampa, United States},
PAGES = {3541},
YEAR = {2008},
MONTH = Dec,
PDF = {https://hal.archives-ouvertes.fr/hal-00350154/file/Toric_ICPR08.pdf},
HAL_ID = {hal-00350154},
HAL_VERSION = {v1},
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End/Geometry/volumes


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading