DGtal 2.1.1
Loading...
Searching...
No Matches
parallelIIShortcuts.cpp File Reference
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/helpers/Shortcuts.h"
#include "DGtal/helpers/ShortcutsGeometry.h"
#include "DGtal/io/viewers/PolyscopeViewer.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
Include dependency graph for parallelIIShortcuts.cpp:

Go to the source code of this file.

Typedefs

typedef Shortcuts< Z3i::KSpaceSH3
 
typedef ShortcutsGeometry< Z3i::KSpaceSHG3
 

Functions

int main ()
 

Detailed Description

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

Author
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@c.nosp@m.nrs.f.nosp@m.r) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), INSA-Lyon, France
Date
2026/06/08

This file is part of the DGtal library.

Definition in file parallelIIShortcuts.cpp.

Typedef Documentation

◆ SH3

typedef Shortcuts<Z3i::KSpace> SH3

Definition at line 52 of file parallelIIShortcuts.cpp.

◆ SHG3

Definition at line 53 of file parallelIIShortcuts.cpp.

Function Documentation

◆ main()

int main ( void  )

[Parallel-instantiation]

[Parallel-instantiation]

[Parallel-run]

[Parallel-run]

Definition at line 56 of file parallelIIShortcuts.cpp.

57{
58
61 params( "polynomial", "goursat" )( "gridstep", 0.125 );
62 auto implicit_shape = SH3::makeImplicitShape3D ( params );
63 auto digitized_shape = SH3::makeDigitizedImplicitShape3D( implicit_shape, params );
64 auto K = SH3::getKSpace( params );
65 auto surface = SH3::makeDigitalSurface( digitized_shape, K, params );
66 auto surfels = SH3::getSurfelRange( surface, params );
68
70 trace.info()<< "Input vol domain: "<< digitized_shape->getDomain() << std::endl;
71 //Sequential
72 trace.beginBlock("Single thread");
73 auto curv = SHG3::getIIMeanCurvatures( digitized_shape, surfels, params );
75
76 //Parallel
77 trace.beginBlock("4 threads on default axis");
78 auto curv_par4 = SHG3::getIIMeanCurvatures( digitized_shape, surfels,
79 params( "ii-thread-number", 4 ));
81
82 //Parallel
83 trace.beginBlock("8 threads on axis 0");
84 auto curv_par8_0 = SHG3::getIIMeanCurvatures( digitized_shape, surfels,
85 params( "ii-thread-number", 8 )
86 ( "ii-split-axis", 0 ) );
88
89 //Parallel
90 trace.beginBlock("8 threads on axis 1");
91 auto curv_par8_1 = SHG3::getIIMeanCurvatures( digitized_shape, surfels,
92 params( "ii-thread-number", 8 )
93 ( "ii-split-axis", 1 ) );
95
96 //Parallel
97 trace.beginBlock("8 threads on axis 2");
98 auto curv_par8_2 = SHG3::getIIMeanCurvatures( digitized_shape, surfels,
99 params( "ii-thread-number", 8 )
100 ( "ii-split-axis", 2 ) );
101 trace.endBlock();
102
103 //Parallel
104 trace.beginBlock("16 threads on axis 2");
105 auto curv_par16 = SHG3::getIIMeanCurvatures( digitized_shape, surfels,
106 params( "ii-thread-number", 16 )
107 ( "ii-split-axis", 2 ) );
108 trace.endBlock();
110
111#ifdef DGTAL_WITH_POLYSCOPE_VIEWER
112 PolyscopeViewer viewer;
113
114 std::string objectName = "Surfels";
115 viewer.draw(surfels, objectName); // Draws the object independently
116 viewer.addQuantity(objectName, "Mean curvature", curv_par8_0);
117
119 AxisDomainSplitter<Z3i::Domain>::SplitDomainsInfo splits = splitter(digitized_shape->getDomain(), 8);
120 HueShadeColorMap<unsigned int> cmap(0,(unsigned int)splits.size());
121 for(auto i=0; i< splits.size(); ++i)
122 {
123 viewer << cmap(i);
124 viewer << splits[i].domain;
125 }
126 viewer.show();
127#endif
128
129 return 0;
130}
std::string draw(const Point &p, const std::string &uname="Point_{i}")
void addQuantity(const std::string &oName, const std::string &qName, const Type &value, QuantityScale scale=QuantityScale::UNKNOWN)
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void show() override
Starts the event loop and display of elements.
static Scalars getIIMeanCurvatures(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
static Parameters defaultParameters()
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition Shortcuts.h:329
static CountedPtr< DigitizedImplicitShape3D > makeDigitizedImplicitShape3D(CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
Definition Shortcuts.h:520
static SurfelRange getSurfelRange(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1808
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition Shortcuts.h:1470
static Parameters defaultParameters()
Definition Shortcuts.h:200
static CountedPtr< ImplicitShape3D > makeImplicitShape3D(const Parameters &params=parametersImplicitShape3D())
Definition Shortcuts.h:279
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
CountedPtr< SH3::DigitalSurface > surface
Trace trace
Splits a domain along one of the domain grid axis.
std::vector< SplitInfo< Domain > > SplitDomainsInfo
KSpace K
AxisDomainSplitter< Domain > splitter

References DGtal::Display3D< Space, KSpace >::addQuantity(), DGtal::Trace::beginBlock(), DGtal::Shortcuts< TKSpace >::defaultParameters(), DGtal::ShortcutsGeometry< TKSpace >::defaultParameters(), DGtal::Display3D< Space, KSpace >::draw(), DGtal::Trace::endBlock(), DGtal::ShortcutsGeometry< TKSpace >::getIIMeanCurvatures(), DGtal::Shortcuts< TKSpace >::getKSpace(), DGtal::Shortcuts< TKSpace >::getSurfelRange(), DGtal::Trace::info(), K, DGtal::Shortcuts< TKSpace >::makeDigitalSurface(), DGtal::Shortcuts< TKSpace >::makeDigitizedImplicitShape3D(), DGtal::Shortcuts< TKSpace >::makeImplicitShape3D(), DGtal::PolyscopeViewer< Space, KSpace >::show(), splitter, surface, and DGtal::trace.