55#include "DGtal/base/Common.h"
56#include "DGtal/io/readers/VolReader.h"
58#include "DGtal/io/viewers/PolyscopeViewer.h"
59#include "DGtal/images/ImageSelector.h"
60#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
61#include "DGtal/topology/DigitalSurface.h"
62#include "DGtal/topology/DigitalSetBoundary.h"
63#include "DGtal/graph/BreadthFirstVisitor.h"
64#include "DGtal/geometry/surfaces/COBANaivePlaneComputer.h"
65#include "DGtal/helpers/StdDefs.h"
66#include "ConfigExamples.h"
99int main(
int argc,
char** argv )
103 trace.info() <<
"Segments the surface at given threshold within given volume into digital planes of rational width num/den." << std::endl;
106 string inputFilename = examplesPath +
"samples/Al.100.vol" ;
107 trace.info() <<
"input file used " << inputFilename << std::endl;
109 unsigned int threshold = 0;
110 trace.info() <<
"the value that defines the isosurface in the image (an integer between 0 and 255)= " << threshold<< std::endl;
112 unsigned int widthNum = 1;
113 trace.info() <<
"the numerator of the rational width (a non-null integer) =" << widthNum<< std::endl;
115 unsigned int widthDen = 1;
116 trace.info() <<
"the denominator of the rational width (a non-null integer)= " << widthDen<< std::endl;
128 trace.beginBlock(
"Set up digital surface." );
132 bool ok = ks.
init( set3d.
domain().lowerBound(),
133 set3d.
domain().upperBound(),
true );
134 if ( ! ok ) std::cerr <<
"[KSpace.init] Failed." << std::endl;
143 trace.beginBlock(
"Segment into planes." );
144 std::set<Vertex> processedVertices;
145 std::vector<SegmentedPlane*> segmentedPlanes;
146 std::map<Vertex,SegmentedPlane*> v2plane;
150 unsigned int nb = digSurf.
size();
153 if ( ( (++j) % 50 == 0 ) || ( j == nb ) )
trace.progressBar( j, nb );
155 if ( processedVertices.find( v ) != processedVertices.end() )
159 segmentedPlanes.push_back( ptrSegment );
161 ptrSegment->
plane.
init( axis, 500, widthNum, widthDen );
168 if ( processedVertices.find( v ) == processedVertices.end() )
175 processedVertices.insert( v );
176 v2plane[ v ] = ptrSegment;
186 ptrSegment->
color =
Color( rand() % 256, rand() % 256, rand() % 256, 255 );
193 for ( std::map<Vertex,SegmentedPlane*>::const_iterator
194 it = v2plane.begin(), itE = v2plane.end();
197 viewer << it->second->color;
198 viewer << ks.
unsigns( it->first );
203 for ( std::vector<SegmentedPlane*>::iterator
204 it = segmentedPlanes.begin(), itE = segmentedPlanes.end();
207 segmentedPlanes.clear();
99int main(
int argc,
char** argv ) {
…}
Aim: This class is useful to perform a breadth-first exploration of a graph given a starting point or...
const Node & current() const
std::pair< Vertex, Data > Node
Aim: A class that contains the COBA algorithm (Emilie Charrier, Lilian Buzer, DGCI2008) for recognizi...
void init(Dimension axis, InternalInteger diameter, InternalInteger widthNumerator=NumberTraits< InternalInteger >::ONE, InternalInteger widthDenominator=NumberTraits< InternalInteger >::ONE)
bool extend(const Point &p)
Structure representing an RGB triple with alpha component.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of a given...
const Domain & domain() const
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
DigitalSurfaceContainer::SurfelConstIterator ConstIterator
ConstIterator begin() const
ConstIterator end() const
KSpace::SurfelSet SurfelSet
Aim: implements association bewteen points lying in a digital domain and values.
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Dimension sOrthDir(const SCell &s) const
Given a signed surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is c...
Cell unsigns(const SCell &p) const
Creates an unsigned cell from a signed one.
Point sCoords(const SCell &c) const
Return its digital coordinates.
SCell sDirectIncident(const SCell &p, Dimension k) const
Return the direct incident cell of [p] along [k] (the incident cell along [k])
void show() override
Starts the event loop and display of elements.
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
SurfelSet::iterator SurfelSetIterator
COBANaivePlaneComputer< Z3, InternalInteger > NaivePlaneComputer
MyDigitalSurface::SurfelSet SurfelSet
BreadthFirstVisitor< MyDigitalSurface > Visitor
DigitalSetBoundary< KSpace, DigitalSet > MyDigitalSurfaceContainer
DGtal::int64_t InternalInteger
DigitalSetBoundary< KSpace, DigitalSet > MyDigitalSurfaceContainer
Z3i this namespace gathers the standard of types for 3D imagery.
KhalimskySpaceND< 3, Integer > KSpace
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
DGtal is the top-level namespace which contains all DGtal functions and types.
std::int64_t int64_t
signed 94-bit integer.
DGtal::uint32_t Dimension
ImageContainerBySTLVector< Domain, Value > Type
static void append(Set &aSet, const ForegroundPredicate &isForeground, typename Image::Domain::ConstIterator itBegin, typename Image::Domain::ConstIterator itEnd)
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())