34#include "DGtal/base/Common.h"
35#include "DGtal/helpers/StdDefs.h"
36#include "DGtal/helpers/Shortcuts.h"
37#include "DGtal/topology/DigitalSurface2DSlice.h"
38#include "ConfigTest.h"
39#include "DGtalCatch.h"
41#include "DGtal/geometry/curves/ArithmeticalDSSComputer.h"
42#include "DGtal/geometry/surfaces/ArithmeticalDSSComputerOnSurfels.h"
43#include "DGtal/geometry/curves/SaturatedSegmentation.h"
63 std::vector<Surfel> contour;
66std::pair<KSpace, Slice>
getSlice (std::string
const& shape =
"ellipsoid",
double gridstep = 1.0)
71 params(
"polynomial", shape)(
"gridstep", gridstep);
82 Dimension dim1 = *q1, dim2 = kspace.sOrthDir(surfel);
83 auto tracker = surface->container().newTracker(surfel);
84 SurfaceSlice surfaceSlice(tracker, dim1);
87 std::vector<Surfel> contour(surfaceSlice.begin(), surfaceSlice.end());
89 Slice slice{dim1, dim2, surfel, contour};
91 return { kspace, slice };
96 std::vector<Z2i::Point> points;
99 points.push_back(initialPoints.first);
100 points.push_back(initialPoints.second);
104 for (
auto sit = slice.contour.begin() + 1; sit != slice.contour.end(); ++sit)
110 if (projectedPoints.first == points[currentIdx]) {
111 points.push_back(projectedPoints.second);
112 }
else if (projectedPoints.first == points[currentIdx + 1]) {
113 points.push_back(projectedPoints.second);
114 }
else if (projectedPoints.second == points[currentIdx]) {
115 points.push_back(projectedPoints.first);
116 }
else if (projectedPoints.second == points[currentIdx + 1]) {
117 points.push_back(projectedPoints.first);
124 if (projectedPoints.first == points[currentIdx]) {
125 points.push_back(projectedPoints.second);
126 }
else if (projectedPoints.second == points[currentIdx]) {
127 points.push_back(projectedPoints.first);
133 currentIdx = (int)points.size() - 1;
145 std::tie(kspace, slice) =
getSlice();
149 SegmentationSurfels segmentationSurfels(slice.contour.begin(), slice.contour.end(), recognitionAlgorithmSurfels);
152 std::vector<Z2i::Point> points =
extractPoints(recognitionAlgorithmSurfels, slice);
156 Segmentation segmentation(points.begin(), points.end(), recognitionAlgorithm);
159 bool allEqual =
true;
160 auto segIt = segmentation.
begin();
161 auto segSurfelIt = segmentationSurfels.
begin();
162 while (segIt != segmentation.
end() && segSurfelIt != segmentationSurfels.
end()) {
163 allEqual = allEqual && (segIt->primitive() == segSurfelIt->primitive());
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
std::pair< Point, Point > projectSurfel(SCell const &aSCell) const
Aim: Represents a 2-dimensional slice in a DigitalSurface. In a sense, it is a 4-connected contour,...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
SignedKhalimskyCell< dim, Integer > SCell
typename PreCellularGridSpace::DirIterator DirIterator
Aim: Computes the saturated segmentation, that is the whole set of maximal segments within a range gi...
SaturatedSegmentation::SegmentComputerIterator end() const
SaturatedSegmentation::SegmentComputerIterator begin() const
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
static CountedPtr< DigitizedImplicitShape3D > makeDigitizedImplicitShape3D(CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
static CountedPtr< DigitalSurface > makeDigitalSurface(CountedPtr< TPointPredicate > bimage, const KSpace &K, const Parameters ¶ms=parametersDigitalSurface())
static Parameters defaultParameters()
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
static CountedPtr< ImplicitShape3D > makeImplicitShape3D(const Parameters ¶ms=parametersImplicitShape3D())
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
KhalimskySpaceND< 3, Integer > KSpace
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
std::pair< KSpace, Slice > getSlice(std::string const &shape="ellipsoid", double gridstep=1.0)
std::vector< Z2i::Point > extractPoints(SegmentComputerOnSurfels const &sc, Slice const &slice)
TEST_CASE("Testing ArithmeticalDSSComputerOnSurfels")
REQUIRE(domain.isInside(aPoint))