Volume Cartographer 2.27.0
ChainSegmentationAlgorithm.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <cstddef>
6
11
13{
21{
22public:
24 using Pointer = std::shared_ptr<ChainSegmentationAlgorithm>;
25
27 virtual ~ChainSegmentationAlgorithm() = default;
28
30 using Chain = std::vector<cv::Vec3d>;
36 enum class Status { Success, Failure, ReturnedEarly };
37
41 {
42 vol_ = std::move(vol);
43 bb_ = vol_->bounds();
44 }
45
52 void setBounds(Bounds b) { bb_ = std::move(b); }
53
55 void setChain(Chain c) { startingChain_ = std::move(c); }
64 void setNumberOfSteps(std::size_t n) { numSteps_ = n; }
65
71 void setStepSize(double s) { stepSize_ = s; }
76 virtual auto compute() -> PointSet = 0;
77
79 auto getStatus() const -> Status { return status_; }
84 [[nodiscard]] auto getPointSet() const -> const PointSet&
85 {
86 return result_;
87 }
88
90 auto getPointSet() -> PointSet& { return result_; }
94 auto progressIterations() const -> std::size_t override
95 {
96 return numSteps_;
97 }
98
99protected:
109 std::size_t numSteps_{0};
111 double stepSize_{1.0};
115 Status status_{Status::Success};
116};
117} // namespace volcart::segmentation
std::shared_ptr< Volume > Pointer
Definition: Volume.hpp:42
Base class for segmentation algorithms that propagate a collected chain of points.
virtual auto compute() -> PointSet=0
Compute the segmentation.
void setChain(Chain c)
Set the input chain of seed points.
auto getStatus() const -> Status
Get the status of the previous computation.
void setVolume(Volume::Pointer vol)
Set the input Volume.
auto progressIterations() const -> std::size_t override
Returns the maximum progress value.
auto getPointSet() -> PointSet &
Get the segmented pointset.
auto getPointSet() const -> const PointSet &
Get the segmented pointset.
void setNumberOfSteps(std::size_t n)
Set the number of propagation steps.
void setBounds(Bounds b)
Set the bounding box for computation.
void setStepSize(double s)
Set the propagation step size.
std::shared_ptr< ChainSegmentationAlgorithm > Pointer
Segmentation algorithms and utilities library
Mixin type for classes which report their progress.
Definition: Mixins.hpp:13