41#include "DGtal/base/Common.h"
42#include "DGtal/io/viewers/PolyscopeViewer.h"
43#include "DGtal/io/readers/VolReader.h"
44#include "DGtal/io/Color.h"
45#include "DGtal/images/ImageSelector.h"
46#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
47#include "DGtal/shapes/Shapes.h"
48#include "DGtal/helpers/StdDefs.h"
49#include "DGtal/topology/helpers/Surfaces.h"
62 std::cerr <<
"Usage: " << argv[ 0 ] <<
" <fileName.vol> <minT> <maxT>" << std::endl;
63 std::cerr <<
"\t - displays the boundary of the shape stored in vol file <fileName.vol>." << std::endl;
64 std::cerr <<
"\t - voxel v belongs to the shape iff its value I(v) follows minT <= I(v) <= maxT." << std::endl;
67int main(
int argc,
char** argv )
74 std::string inputFilename = argv[ 1 ];
75 unsigned int minThreshold = atoi( argv[ 2 ] );
76 unsigned int maxThreshold = atoi( argv[ 3 ] );
79 trace.beginBlock(
"Reading vol file into an image." );
84 minThreshold, maxThreshold);
90 trace.beginBlock(
"Construct the Khalimsky space from the image domain." );
92 bool space_ok = ks.
init(
image.domain().lowerBound(),
93 image.domain().upperBound(),
true );
96 trace.error() <<
"Error in the Khamisky space construction."<<std::endl;
104 MySurfelAdjacency surfAdj(
true );
108 trace.beginBlock(
"Extracting boundary by tracking from an initial bel." );
118 trace.beginBlock(
"Displaying surface in PolyscopeViewer." );
120 viewer <<
Color( 128, 128, 128 );
121 unsigned long nbSurfels = 0;
122 for ( KSpace::SCellSet::const_iterator it = boundary.begin(),
123 it_end = boundary.end(); it != it_end; ++it, ++nbSurfels )
125 trace.info() <<
"nb surfels = " << nbSurfels << std::endl;
67int main(
int argc,
char** argv ) {
…}
Structure representing an RGB triple with alpha component.
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.
std::set< SCell > SCellSet
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)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
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.
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())