Volume Cartographer 2.27.0
Public Types | Public Attributes | List of all members
volcart::OrderedPointSet< T > Class Template Reference

Holds a collection of ordered points. More...

#include <vc/core/types/OrderedPointSet.hpp>

Inheritance diagram for volcart::OrderedPointSet< T >:
[legend]
Collaboration diagram for volcart::OrderedPointSet< T >:
[legend]

Public Types

using BaseClass = PointSet< T >
 
using Pointer = std::shared_ptr< OrderedPointSet< T > >
 
- Public Types inherited from volcart::PointSet< 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...
 
- Public Member Functions inherited from volcart::PointSet< T >
 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...
 
min () const
 Return the element with the smallest absolute norm (L2) More...
 
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 Public Member Functions inherited from volcart::PointSet< T >
static PointSet Fill (std::size_t initSize, T initVal)
 Create a PointSet of a specific size, filled with an initial value. More...
 
- Static Public Attributes inherited from volcart::PointSet< T >
static constexpr int FORMAT_VERSION = 1
 
static constexpr auto HEADER_TERMINATOR = "<>"
 
static constexpr auto HEADER_TERMINATOR_REGEX = "^<>$"
 
- Protected Attributes inherited from volcart::PointSet< T >
Container data_
 

Detailed Description

template<typename T>
class volcart::OrderedPointSet< T >

Holds a collection of ordered points.

Author
Sean Karlage

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.

Member Typedef Documentation

◆ BaseClass

template<typename T >
using volcart::OrderedPointSet< T >::BaseClass = PointSet<T>

Definition at line 44 of file OrderedPointSet.hpp.

◆ Pointer

template<typename T >
using volcart::OrderedPointSet< T >::Pointer = std::shared_ptr<OrderedPointSet<T> >

Pointer type

Definition at line 49 of file OrderedPointSet.hpp.

Constructor & Destructor Documentation

◆ OrderedPointSet() [1/2]

template<typename T >
volcart::OrderedPointSet< T >::OrderedPointSet ( std::size_t  width)
inlineexplicit

Constructor with width parameter.

Definition at line 56 of file OrderedPointSet.hpp.

◆ OrderedPointSet() [2/2]

template<typename T >
volcart::OrderedPointSet< T >::OrderedPointSet ( std::size_t  width,
initVal 
)
inlineexplicit

Constructor with width parameter and initialization value.

Definition at line 62 of file OrderedPointSet.hpp.

Member Function Documentation

◆ append()

template<typename T >
void volcart::OrderedPointSet< T >::append ( const OrderedPointSet< T > &  ps)
inline

Append an OrderedPointSet to the end of the current one.

Exceptions
std::logic_errorIf the widths of the two point sets do not match.

Definition at line 158 of file OrderedPointSet.hpp.

◆ copyRows()

template<typename T >
OrderedPointSet volcart::OrderedPointSet< T >::copyRows ( std::size_t  i,
std::size_t  j 
) const
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.

◆ Fill()

template<typename T >
static OrderedPointSet volcart::OrderedPointSet< T >::Fill ( std::size_t  width,
std::size_t  height,
initVal 
)
inlinestatic

Create an OrderedPointSet of a specific size, filled with an initial value.

Definition at line 218 of file OrderedPointSet.hpp.

◆ getRow()

template<typename T >
std::vector< T > volcart::OrderedPointSet< T >::getRow ( std::size_t  i) const
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.

◆ height()

template<typename T >
std::size_t volcart::OrderedPointSet< T >::height ( ) const
inline

Return the number of rows in the OrderedPointSet.

Definition at line 94 of file OrderedPointSet.hpp.

◆ operator()() [1/2]

template<typename T >
T & volcart::OrderedPointSet< T >::operator() ( std::size_t  y,
std::size_t  x 
)
inline

Get a point from the OrderedPointSet at row y, column x.

Definition at line 79 of file OrderedPointSet.hpp.

◆ operator()() [2/2]

template<typename T >
const T & volcart::OrderedPointSet< T >::operator() ( std::size_t  y,
std::size_t  x 
) const
inline

Get a point from the OrderedPointSet at row y, column x.

Definition at line 71 of file OrderedPointSet.hpp.

◆ pushRow() [1/2]

template<typename T >
void volcart::OrderedPointSet< T >::pushRow ( const std::vector< T > &  points)
inline

Add a row of points to the OrderedPointSet.

Definition at line 130 of file OrderedPointSet.hpp.

◆ pushRow() [2/2]

template<typename T >
void volcart::OrderedPointSet< T >::pushRow ( std::vector< T > &&  points)
inline

Add a row of points to the OrderedPointSet.

Definition at line 138 of file OrderedPointSet.hpp.

◆ reset()

template<typename T >
void volcart::OrderedPointSet< T >::reset ( )
inline

Like clear(), but zeroes the OrderedPointSet width so that it can be redefined.

Definition at line 121 of file OrderedPointSet.hpp.

◆ setWidth()

template<typename T >
void volcart::OrderedPointSet< T >::setWidth ( std::size_t  width)
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.

◆ width()

template<typename T >
std::size_t volcart::OrderedPointSet< T >::width ( ) const
inline

Return the number of columns in the OrderedPointSet.

Definition at line 89 of file OrderedPointSet.hpp.

Member Data Documentation

◆ CAPACITY_MULTIPLIER

template<typename T >
constexpr std::size_t volcart::OrderedPointSet< T >::CAPACITY_MULTIPLIER = 20
staticconstexprprivate

Number of rows preallocated

Definition at line 235 of file OrderedPointSet.hpp.

◆ data_

template<typename T >
Container volcart::PointSet< T >::data_

Point container

Definition at line 207 of file PointSet.hpp.

◆ width_

template<typename T >
std::size_t volcart::OrderedPointSet< T >::width_ {0}
private

Number of columns

Definition at line 233 of file OrderedPointSet.hpp.


The documentation for this class was generated from the following file: