A simple example illustrating the filling of the interior/exterior of a given 2D contour. This program outputs these images:
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/topology/helpers/Surfaces.h"
#include "DGtal/topology/SurfelSetPredicate.h"
#include "DGtal/geometry/curves/FreemanChain.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/images/ImageContainerBySTLMap.h"
using namespace std;
{
FreemanChain<int> fc1 ("001001001001001111101111011222222223222222322233333330301033333003", 6, 14);
FreemanChain<int> fc2 ("1111000033332222", 6, 20);
Board2D aBoard;
Board2D aBoard2;
aBoard <<
K.lowerBound() <<
K.upperBound() ;
aBoard2 <<
K.lowerBound() <<
K.upperBound() ;
FreemanChain<int>::getInterPixelLinels(
K, fc1, boundarySCell,
false);
it!= boundarySCell.end(); it++){
aBoard << *it;
}
FreemanChain<int>::getInterPixelLinels(
K, fc2, boundarySCellhole,
false);
aBoard << *it;
aBoard2 << *it;
boundarySCell.insert(*it);
}
typedef ImageContainerBySTLMap< Z2i::Domain, bool> BoolImage2D;
BoolImage2D interiorCellImage( imageDomain );
Surfaces<DGtal::KhalimskySpaceND< 2, int > >::uFillInterior(
K, functors::SurfelSetPredicate<std::set<SCell>,
SCell>(boundarySCell),
interiorCellImage, 1, false);
aBoard << CustomStyle(
K.lowerCell().className(),
new CustomColors(
DGtal::Color::None, Color(200, 200, 200)) );
it!=interiorCellImage.domain().end(); it++){
if(interiorCellImage(*it)){
}
}
BoolImage2D interiorCellHoleImage( imageDomain );
BoolImage2D exteriorCellHoleImage( imageDomain );
Surfaces<DGtal::KhalimskySpaceND< 2, int > >::uFillInterior(
K, functors::SurfelSetPredicate<std::set<SCell>,
SCell>(boundarySCellhole),
interiorCellHoleImage, 1, true);
Surfaces<DGtal::KhalimskySpaceND< 2, int > >::uFillExterior(
K, functors::SurfelSetPredicate<std::set<SCell>,
SCell>(boundarySCellhole),
exteriorCellHoleImage, 1, false);
aBoard2 << CustomStyle(
K.lowerCell().className(),
it!=interiorCellHoleImage.domain().end(); it++){
if(interiorCellHoleImage(*it)){
}
}
aBoard2 << CustomStyle(
K.lowerCell().className(),
it!=exteriorCellHoleImage.domain().end(); it++){
if(exteriorCellHoleImage(*it)){
}
}
aBoard.saveEPS("example_ctopo-fillContours.eps");
aBoard.saveFIG("example_ctopo-fillContours.fig");
aBoard2.saveEPS("example_ctopo-fillContours2.eps");
aBoard2.saveFIG("example_ctopo-fillContours2.fig");
return 0;
}
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
void beginBlock(const std::string &keyword="")
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
int main(int argc, char **argv)
HyperRectDomain< Space > Domain