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"
46 using namespace DGtal;
63 std::vector<Surfel> contour;
66 std::pair<KSpace, Slice>
getSlice (std::string
const& shape =
"ellipsoid",
double gridstep = 1.0)
70 auto params = SH3::defaultParameters();
71 params(
"polynomial", shape)(
"gridstep", gridstep);
73 auto implicit_shape = SH3::makeImplicitShape3D(params);
74 auto digitized_shape = SH3::makeDigitizedImplicitShape3D(implicit_shape, params);
75 auto binary_image = SH3::makeBinaryImage(digitized_shape, params);
84 auto tracker =
surface->container().newTracker(surfel);
85 SurfaceSlice surfaceSlice(tracker, dim1);
88 std::vector<Surfel> contour(surfaceSlice.begin(), surfaceSlice.end());
90 Slice slice{dim1, dim2, surfel, contour};
92 return { kspace, slice };
97 std::vector<Z2i::Point> points;
100 points.push_back(initialPoints.first);
101 points.push_back(initialPoints.second);
103 for (
auto sit = slice.contour.begin() + 1; sit != slice.contour.end(); ++sit)
107 points.push_back(pt);
119 std::tie(kspace, slice) =
getSlice();
123 SegmentationSurfels segmentationSurfels(slice.contour.begin(), slice.contour.end(), recognitionAlgorithmSurfels);
126 std::vector<Z2i::Point> points =
extractPoints(recognitionAlgorithmSurfels, slice);
130 Segmentation segmentation(points.begin(), points.end(), recognitionAlgorithm);
133 bool allEqual =
true;
134 auto segIt = segmentation.
begin();
135 auto segSurfelIt = segmentationSurfels.
begin();
136 while (segIt != segmentation.
end() && segSurfelIt != segmentationSurfels.
end()) {
138 allEqual = allEqual && (segIt->primitive() == segSurfelIt->primitive());
Aim: This class is a wrapper around ArithmeticalDSS that is devoted to the dynamic recognition of dig...
Point getNextProjectedPoint(SCell const &aSurfel) const
std::pair< Point, Point > getProjectedPointsFromSurfel(SCell const &aSurfel) 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,...
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...
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
CountedPtr< SH3::DigitalSurface > surface
CountedPtr< SH3::BinaryImage > binary_image
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)
TEST_CASE("Testing ArithmeticalDSSComputerOnSurfels")
std::vector< Z2i::Point > extractPoints(SegmentComputerOnSurfels const &sc, Slice const &slice)
REQUIRE(domain.isInside(aPoint))