32#include "DGtal/base/Common.h"
34#include "DGtal/helpers/StdDefs.h"
35#include "DGtal/topology/KhalimskySpaceND.h"
36#include "DGtal/topology/helpers/Surfaces.h"
38#include "DGtal/io/viewers/PolyscopeViewer.h"
39#include "DGtal/io/readers/VolReader.h"
40#include "DGtal/images/ImageSelector.h"
41#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
42#include "DGtal/io/Color.h"
43#include "DGtal/io/colormaps/GradientColorMap.h"
45#include "ConfigExamples.h"
52int main(
int argc,
char** argv )
54 trace.beginBlock (
"Example ctopo-2-3d" );
58 std::string inputFilename = examplesPath +
"samples/cat10.vol";
65 bool space_ok = ks.
init(
image.domain().lowerBound(),
image.domain().upperBound(),
true );
69 trace.error() <<
"Error in the Khamisky space construction."<<std::endl;
73 std::vector<Z3i::SCell> vectBdrySCell;
74 std::vector<Z3i::SCell> vectBdrySCell2;
75 std::set<Z3i::SCell> vectBdrySCellALL;
81 trace.info() <<
"Tracking Boundary.."<<std::endl;
84 ks,SAdj, set3d, aCell );
88 ks, *(ks.
sDirs( aCell )), SAdj,
93 ks, *(++(ks.
sDirs( aCell ))), SAdj,
98 typedef PolyscopeViewer <Z3i::Space,Z3i::KSpace>
MyViewer;
101 trace.info() <<
"Displaying the surfels.."<<std::endl;
102 for( std::set<Z3i::SCell>::iterator it=vectBdrySCellALL.begin();
103 it!= vectBdrySCellALL.end(); it++){
106 trace.info()<<
"done"<<std::endl;
117 for( std::vector<Z3i::SCell>::iterator it=vectBdrySCell2.begin();
118 it!= vectBdrySCell2.end(); it++){
119 Color col= cmap_grad(d);
131 for( std::vector<Z3i::SCell>::iterator it=vectBdrySCell.begin();
132 it!= vectBdrySCell.end(); it++){
133 Color col= cmap_grad2(d);
52int main(
int argc,
char** argv ) {
…}
Structure representing an RGB triple with alpha component.
void green(const unsigned char aGreenValue)
void red(const unsigned char aRedValue)
void blue(const unsigned char aBlueValue)
void drawColor(const DGtal::Color &color)
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void addColor(const Color &color)
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.
DirIterator sDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans.
void show() override
Starts the event loop and display of elements.
static void trackBoundary(SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
static void track2DSliceBoundary(std::vector< SCell > &aSCellContour2D, const KSpace &K, const Dimension &trackDir, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
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.
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())
PolyscopeViewer< Space, KSpace > MyViewer