File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
volScanBoundary.cpp File Reference
#include <iostream>
#include <queue>
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/io/Color.h"
#include "DGtal/images/ImageSelector.h"
#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/topology/helpers/Surfaces.h"
#include "DGtal/io/viewers/PolyscopeViewer.h"
Include dependency graph for volScanBoundary.cpp:

Go to the source code of this file.

Functions

void usage (int, char **argv)
int main (int argc, char **argv)

Detailed Description

Author
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
Date
2012/02/06

An example file named volScanBoundary.

This file is part of the DGtal library.

Definition in file volScanBoundary.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

[volScanBoundary-readVol]

[volScanBoundary-readVol]

[volScanBoundary-KSpace]

[volScanBoundary-KSpace]

[volScanBoundary-ExtractingSurface]

[volScanBoundary-ExtractingSurface]

[volScanBoundary-DisplayingSurface]

[volScanBoundary-DisplayingSurface]

Definition at line 65 of file volScanBoundary.cpp.

66{
67 if ( argc < 4 )
68 {
69 usage( argc, argv );
70 return 1;
71 }
72 std::string inputFilename = argv[ 1 ];
73 unsigned int minThreshold = atoi( argv[ 2 ] );
74 unsigned int maxThreshold = atoi( argv[ 3 ] );
75
77 trace.beginBlock( "Reading vol file into an image." );
80 DigitalSet set3d (image.domain());
82 minThreshold, maxThreshold);
83 trace.endBlock();
85
86
88 trace.beginBlock( "Construct the Khalimsky space from the image domain." );
89 KSpace ks;
90 bool space_ok = ks.init( image.domain().lowerBound(),
91 image.domain().upperBound(), true );
92 if (!space_ok)
93 {
94 trace.error() << "Error in the Khamisky space construction."<<std::endl;
95 return 2;
96 }
97 trace.endBlock();
99
101 trace.beginBlock( "Extracting boundary by scanning the space. " );
102 KSpace::SCellSet boundary;
103 Surfaces<KSpace>::sMakeBoundary( boundary, ks, set3d,
104 image.domain().lowerBound(),
105 image.domain().upperBound() );
106 trace.endBlock();
108
110 trace.beginBlock( "Displaying surface in PolyscopeViewer." );
111 PolyscopeViewer<> viewer( ks );
112 KSpace::SCell dummy_scell;
113 viewer.currentStyle.mode |= DisplayStyle::SIMPLIFIED;
114 viewer << Color( 128, 128, 128 );
115 unsigned long nbSurfels = 0;
116 for ( KSpace::SCellSet::const_iterator it = boundary.begin(),
117 it_end = boundary.end(); it != it_end; ++it, ++nbSurfels )
118 viewer << *it;
119 trace.info() << "nb surfels = " << nbSurfels << std::endl;
120 trace.endBlock();
121 viewer.show();
122 return 0;
124}
Structure representing an RGB triple with alpha component.
Definition Color.h:77
Aim: implements association bewteen points lying in a digital domain and values.
Definition Image.h:70
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SignedKhalimskyCell< dim, Integer > SCell
static void sMakeBoundary(SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)
KhalimskySpaceND< 3, Integer > KSpace
Definition StdDefs.h:146
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Definition StdDefs.h:173
Trace trace
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())
Image image(domain)

References DGtal::SetFromImage< TSet >::append(), DGtal::Display3D< Space, KSpace >::currentStyle, image(), DGtal::VolReader< TImageContainer, TFunctor >::importVol(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::DisplayStyle::mode, DGtal::PolyscopeViewer< Space, KSpace >::show(), DGtal::DisplayStyle::SIMPLIFIED, DGtal::Surfaces< TKSpace >::sMakeBoundary(), DGtal::trace, and usage().

◆ usage()

void usage ( int ,
char ** argv )

Definition at line 58 of file volScanBoundary.cpp.

59{
60 std::cerr << "Usage: " << argv[ 0 ] << " <fileName.vol> <minT> <maxT>" << std::endl;
61 std::cerr << "\t - displays the boundary of the shape stored in vol file <fileName.vol>." << std::endl;
62 std::cerr << "\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
63}