Volume Cartographer 2.27.0
FittedCurve.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <cassert>
6#include <cstddef>
7#include <vector>
8
11
13{
20{
21private:
23 std::size_t npoints_{0};
25 int zIndex_{0};
27 std::vector<double> ts_;
29 std::vector<Voxel> points_;
32
33public:
36 FittedCurve() = default;
37
46 FittedCurve(const std::vector<Voxel>& vs, int zIndex);
50 std::size_t size() const { return npoints_; }
51
53 const std::vector<Voxel>& points() const { return points_; }
54
56 const decltype(spline_)& spline() const { return spline_; }
57
59 Pixel eval(double t) const { return spline_(t); }
60
63 std::vector<Voxel> evenlySpacePoints() { return resample(1.0); }
64
69 std::vector<Voxel> resample(double resamplePerc = 1.0);
70
72 std::vector<Voxel> sample(std::size_t numPoints) const;
73
75 Voxel operator()(int index) const;
76
81 std::vector<double> curvature(int hstep = 1) const;
82
84 double arclength() const;
85};
86} // namespace volcart::segmentation
Fits a curve to a set of points for resampling.
Definition: FittedCurve.hpp:20
Voxel operator()(int index) const
Returns the voxel located at index.
std::vector< Voxel > resample(double resamplePerc=1.0)
Resample the curve at a t-interval of resamplePerc.
const std::vector< Voxel > & points() const
Return the current list of resampled points.
Definition: FittedCurve.hpp:53
std::vector< double > curvature(int hstep=1) const
Calculate the local curvature along the spline.
std::size_t size() const
Return the current number of resampled points in the spline.
Definition: FittedCurve.hpp:50
std::vector< Voxel > sample(std::size_t numPoints) const
Resample the curve to have numPoints of evenly spaced points.
const decltype(spline_) & spline() const
Return the spline created from the input points.
Definition: FittedCurve.hpp:56
std::vector< Voxel > evenlySpacePoints()
Evenly resample the curve with the same number of points as the input set.
Definition: FittedCurve.hpp:63
double arclength() const
Calculate the arc length of the curve
FittedCurve(const std::vector< Voxel > &vs, int zIndex)
Construct curve from set of points and z-Index.
CubicSpline< double > spline_
Definition: FittedCurve.hpp:31
Pixel eval(double t) const
Resample the curve at a given t-value in [0.0, 1.0].
Definition: FittedCurve.hpp:59
Simple spline wrapper around Eigen::Spline.
Definition: Spline.hpp:23
Segmentation algorithms and utilities library