55#include "DGtal/base/Common.h"
56#include "DGtal/io/readers/VolReader.h"
58#include "DGtal/io/Display3D.h"
59#include "DGtal/io/viewers/Viewer3D.h"
60#include "DGtal/io/DrawWithDisplay3DModifier.h"
61#include "DGtal/images/ImageSelector.h"
62#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
63#include "DGtal/topology/DigitalSurface.h"
64#include "DGtal/topology/DigitalSetBoundary.h"
65#include "DGtal/graph/BreadthFirstVisitor.h"
66#include "DGtal/geometry/surfaces/COBANaivePlaneComputer.h"
67#include "DGtal/helpers/StdDefs.h"
68#include "ConfigExamples.h"
93struct SegmentedPlane {
101int main(
int argc,
char** argv )
105 trace.
info() <<
"Segments the surface at given threshold within given volume into digital planes of rational width num/den." << std::endl;
108 string inputFilename = examplesPath +
"samples/Al.100.vol" ;
109 trace.
info() <<
"input file used " << inputFilename << std::endl;
111 unsigned int threshold = 0;
112 trace.
info() <<
"the value that defines the isosurface in the image (an integer between 0 and 255)= " << threshold<< std::endl;
114 unsigned int widthNum = 1;
115 trace.
info() <<
"the numerator of the rational width (a non-null integer) =" << widthNum<< std::endl;
117 unsigned int widthDen = 1;
118 trace.
info() <<
"the denominator of the rational width (a non-null integer)= " << widthDen<< std::endl;
123 QApplication application(argc,argv);
135 bool ok = ks.
init( set3d.
domain().lowerBound(),
136 set3d.
domain().upperBound(),
true );
137 if ( ! ok ) std::cerr <<
"[KSpace.init] Failed." << std::endl;
147 std::set<Vertex> processedVertices;
148 std::vector<SegmentedPlane*> segmentedPlanes;
149 std::map<Vertex,SegmentedPlane*> v2plane;
153 unsigned int nb = digSurf.
size();
158 if ( processedVertices.find( v ) != processedVertices.end() )
161 SegmentedPlane* ptrSegment =
new SegmentedPlane;
162 segmentedPlanes.push_back( ptrSegment );
164 ptrSegment->plane.
init( axis, 500, widthNum, widthDen );
171 if ( processedVertices.find( v ) == processedVertices.end() )
175 bool isExtended = ptrSegment->plane.
extend( p );
178 processedVertices.insert( v );
179 v2plane[ v ] = ptrSegment;
189 ptrSegment->color =
Color( rand() % 256, rand() % 256, rand() % 256, 255 );
197 for ( std::map<Vertex,SegmentedPlane*>::const_iterator
198 it = v2plane.begin(), itE = v2plane.end();
202 viewer << ks.
unsigns( it->first );
204 viewer << Viewer3D<>::updateDisplay;
208 for ( std::vector<SegmentedPlane*>::iterator
209 it = segmentedPlanes.begin(), itE = segmentedPlanes.end();
212 segmentedPlanes.clear();
216 return application.exec();
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
FIXME.
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...
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
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
Surfel Vertex
Defines the type for a vertex.
ConstIterator begin() const
ConstIterator end() const
KSpace::SurfelSet SurfelSet
Aim: implements association bewteen points lying in a digital domain and values.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
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])
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
void progressBar(const double currentValue, const double maximalValue)
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
MyDigitalSurface::ConstIterator ConstIterator
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
SurfelSet::iterator SurfelSetIterator
MyDigitalSurface::Vertex Vertex
COBANaivePlaneComputer< Z3, InternalInteger > NaivePlaneComputer
MyDigitalSurface::ConstIterator ConstIterator
MyDigitalSurface::SurfelSet SurfelSet
BreadthFirstVisitor< MyDigitalSurface > Visitor
DigitalSetBoundary< KSpace, DigitalSet > MyDigitalSurfaceContainer
DGtal::int64_t InternalInteger
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::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())
ImageContainerBySTLVector< Domain, Value > Image