Volume Cartographer 2.27.0
|
Holds a collection of ordered points. More...
#include <vc/core/types/OrderedPointSet.hpp>
Public Types | |
using | BaseClass = PointSet< T > |
using | Pointer = std::shared_ptr< OrderedPointSet< T > > |
![]() | |
using | Point = T |
using | value_type = Point |
using | Container = std::vector< Point > |
using | Iterator = typename Container::iterator |
using | ConstIterator = typename Container::const_iterator |
using | Pointer = std::shared_ptr< PointSet< T > > |
Public Member Functions | |
OrderedPointSet ()=default | |
Default constructor. | |
OrderedPointSet (std::size_t width) | |
Constructor with width parameter. More... | |
OrderedPointSet (std::size_t width, T initVal) | |
Constructor with width parameter and initialization value. More... | |
const T & | operator() (std::size_t y, std::size_t x) const |
Get a point from the OrderedPointSet at row y, column x. More... | |
T & | operator() (std::size_t y, std::size_t x) |
Get a point from the OrderedPointSet at row y, column x. More... | |
std::size_t | width () const |
Return the number of columns in the OrderedPointSet. More... | |
std::size_t | height () const |
Return the number of rows in the OrderedPointSet. More... | |
void | setWidth (std::size_t width) |
Set the ordering width. More... | |
void | reset () |
Like clear(), but zeroes the OrderedPointSet width so that it can be redefined. More... | |
void | pushRow (const std::vector< T > &points) |
Add a row of points to the OrderedPointSet. More... | |
void | pushRow (std::vector< T > &&points) |
Add a row of points to the OrderedPointSet. More... | |
void | push_back (const T &val)=delete |
void | push_back (T &&val)=delete |
void | emplace_back (const T &val)=delete |
void | emplace_back (T &&val)=delete |
void | append (const OrderedPointSet< T > &ps) |
Append an OrderedPointSet to the end of the current one. More... | |
std::vector< T > | getRow (std::size_t i) const |
Get a row of points. More... | |
OrderedPointSet | copyRows (std::size_t i, std::size_t j) const |
Get multiple rows of points. More... | |
![]() | |
PointSet ()=default | |
Default constructor. | |
PointSet (std::size_t initSize) | |
Construct and preallocate a number of Point elements. More... | |
PointSet (std::size_t initSize, T initVal) | |
Construct and fill a number of elements with an initial value. More... | |
const T & | operator[] (std::size_t idx) const |
Get a Point by index. More... | |
T & | operator[] (std::size_t idx) |
Get a Point by index. More... | |
std::size_t | size () const |
Get the size of the PointSet. More... | |
bool | empty () const |
Return whether the PointSet is empty. More... | |
Container | as_vector () |
Get the PointSet storage container. More... | |
void | clear () |
Remove all elements from the PointSet. More... | |
void | push_back (const T &val) |
Add a Point to the PointSet. More... | |
void | push_back (T &&val) |
template<class... Args> | |
void | emplace_back (Args &&... args) |
Emplace a Point at the back of the PointSet. More... | |
template<class ContainerType > | |
void | append (const ContainerType &c) |
Append a PointSet to the end of the current one. More... | |
Iterator | begin () |
Return an iterator that points to the first element in the PointSet. More... | |
ConstIterator | begin () const |
Return an iterator that points to the first element in the PointSet. More... | |
Iterator | end () |
Return an iterator that points to the past-the-end element in the PointSet. More... | |
ConstIterator | end () const |
Return an iterator that points to the past-the-end element in the PointSet. More... | |
T & | front () |
Return a reference to the first element in the PointSet. More... | |
const T & | front () const |
Return a reference to the first element in the PointSet. More... | |
T & | back () |
Return a reference to the last element in the PointSet. More... | |
const T & | back () const |
Return a reference to the last element in the PointSet. More... | |
T | min () const |
Return the element with the smallest absolute norm (L2) More... | |
T | max () const |
Return the element with the largest absolute norm (L2) More... | |
std::pair< T, T > | minMax () const |
Return a pair of elements containing the points with the smallest and largest absolute norm (L2) More... | |
Public Attributes | |
Container | data_ |
std::size_t | width_ {0} |
static constexpr std::size_t | CAPACITY_MULTIPLIER = 20 |
static OrderedPointSet | Fill (std::size_t width, std::size_t height, T initVal) |
Create an OrderedPointSet of a specific size, filled with an initial value. More... | |
Additional Inherited Members | |
![]() | |
static PointSet | Fill (std::size_t initSize, T initVal) |
Create a PointSet of a specific size, filled with an initial value. More... | |
![]() | |
static constexpr int | FORMAT_VERSION = 1 |
static constexpr auto | HEADER_TERMINATOR = "<>" |
static constexpr auto | HEADER_TERMINATOR_REGEX = "^<>$" |
![]() | |
Container | data_ |
Holds a collection of ordered points.
An OrderedPointSet stores points with 2D array-like adjacency information that is independent of the Euclidean position of the points themselves. Point ordering provides extra topological information that may not be obvious from positional information alone.
It is currently used by the propagation-based segmentation algorithms (LRPS, STPS), where an entire row of points propagates through the volume for a discrete number of iterations. The path a single point takes through the volume is given by a single column of the resulting OrderedPointSet.
An OrderedPointSet can only grow in the number of rows that it has. To change the width of the point set, make a new OrderedPointSet with the desired width or use reset() in conjunction with setWidth().
In order to use the PointSetIO functions, the point type should be based on int
, float
, or double
(e.g. cv::Vec2i
, cv::Vec3d
, etc.)
Definition at line 41 of file OrderedPointSet.hpp.
using volcart::OrderedPointSet< T >::BaseClass = PointSet<T> |
Definition at line 44 of file OrderedPointSet.hpp.
using volcart::OrderedPointSet< T >::Pointer = std::shared_ptr<OrderedPointSet<T> > |
Pointer type
Definition at line 49 of file OrderedPointSet.hpp.
|
inlineexplicit |
Constructor with width parameter.
Definition at line 56 of file OrderedPointSet.hpp.
|
inlineexplicit |
Constructor with width parameter and initialization value.
Definition at line 62 of file OrderedPointSet.hpp.
|
inline |
Append an OrderedPointSet to the end of the current one.
std::logic_error | If the widths of the two point sets do not match. |
Definition at line 158 of file OrderedPointSet.hpp.
|
inline |
Get multiple rows of points.
Copies rows [i, j).
Throws a std::range_error if i
is outside the range of row indices. Throws std::logic_error if j <= i
.
Definition at line 193 of file OrderedPointSet.hpp.
|
inlinestatic |
Create an OrderedPointSet of a specific size, filled with an initial value.
Definition at line 218 of file OrderedPointSet.hpp.
|
inline |
Get a row of points.
Throws a std::range_error if i
is outside the range of row indices.
Definition at line 173 of file OrderedPointSet.hpp.
|
inline |
Return the number of rows in the OrderedPointSet.
Definition at line 94 of file OrderedPointSet.hpp.
|
inline |
Get a point from the OrderedPointSet at row y, column x.
Definition at line 79 of file OrderedPointSet.hpp.
|
inline |
Get a point from the OrderedPointSet at row y, column x.
Definition at line 71 of file OrderedPointSet.hpp.
|
inline |
Add a row of points to the OrderedPointSet.
Definition at line 130 of file OrderedPointSet.hpp.
|
inline |
Add a row of points to the OrderedPointSet.
Definition at line 138 of file OrderedPointSet.hpp.
|
inline |
Like clear(), but zeroes the OrderedPointSet width so that it can be redefined.
Definition at line 121 of file OrderedPointSet.hpp.
|
inline |
Set the ordering width.
This class provides no ability to resize the OrderedPointSet's width after it has been set. To reuse the same OrderedPointSet object with a different width value, use reset() before calling this function.
This function throws a std::logic_error if the width has already been set.
Definition at line 108 of file OrderedPointSet.hpp.
|
inline |
Return the number of columns in the OrderedPointSet.
Definition at line 89 of file OrderedPointSet.hpp.
|
staticconstexprprivate |
Number of rows preallocated
Definition at line 235 of file OrderedPointSet.hpp.
Container volcart::PointSet< T >::data_ |
Point container
Definition at line 207 of file PointSet.hpp.
|
private |
Number of columns
Definition at line 233 of file OrderedPointSet.hpp.