Volume Cartographer 2.27.0
Public Member Functions | Private Attributes | List of all members
volcart::Tensor3D< DType > Class Template Reference

A 3rd-order tensor object. More...

#include <vc/core/math/Tensor3D.hpp>

Public Member Functions

template<typename DType >
std::ostream & operator<< (std::ostream &s, const volcart::Tensor3D< DType > &tensor)
 Write a Tensor3D to an output stream. More...
 
 Tensor3D ()=default
 Default constructor.
 
 Tensor3D (std::size_t x, std::size_t y, std::size_t z, bool zero=true)
 Creates a Tensor3D, sets the dimensions and whether it's full of zeroes. More...
 
const DType & operator() (std::size_t x, std::size_t y, std::size_t z) const
 Get the tensor value at x, y, z. More...
 
DType & operator() (std::size_t x, std::size_t y, std::size_t z)
 Get the tensor value at x, y, z. More...
 
std::size_t dx ()
 Get the size of the X-axis. More...
 
std::size_t dx () const
 Get the size of the X-axis. More...
 
std::size_t dy ()
 Get the size of the Y-axis. More...
 
std::size_t dy () const
 Get the size of the Y-axis. More...
 
std::size_t dz ()
 Get the size of the Z-axis. More...
 
std::size_t dz () const
 Get the size of the Z-axis. More...
 
const cv::Mat_< DType > & xySlice (std::size_t z) const
 Get an XY cross section of the Tensor at z. More...
 
cv::Mat_< DType > & xySlice (std::size_t z)
 Get an XY cross section of the Tensor at z. More...
 
cv::Mat_< DType > xzSlice (std::size_t y) const
 Get an XZ cross section of the Tensor at y. More...
 
std::unique_ptr< DType[]> buffer () const
 Get a copy of the Tensor as a raw array. More...
 

Private Attributes

std::vector< cv::Mat_< DType > > tensor_
 
std::size_t dx_
 
std::size_t dy_
 
std::size_t dz_
 

Detailed Description

template<typename DType>
class volcart::Tensor3D< DType >

A 3rd-order tensor object.

Used by Volume to store gradients and structure tensors.

Definition at line 27 of file Tensor3D.hpp.

Constructor & Destructor Documentation

◆ Tensor3D()

template<typename DType >
volcart::Tensor3D< DType >::Tensor3D ( std::size_t  x,
std::size_t  y,
std::size_t  z,
bool  zero = true 
)
inline

Creates a Tensor3D, sets the dimensions and whether it's full of zeroes.

Parameters
xThe size of the X-axis
yThe size of the Y-axis
zThe size of the Z-axis
zeroIf true, initialize the Tensor with zeroes

Definition at line 155 of file Tensor3D.hpp.

Member Function Documentation

◆ buffer()

template<typename DType >
std::unique_ptr< DType[]> volcart::Tensor3D< DType >::buffer ( ) const
inline

Get a copy of the Tensor as a raw array.

Definition at line 124 of file Tensor3D.hpp.

◆ dx() [1/2]

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dx ( )
inline

Get the size of the X-axis.

Definition at line 86 of file Tensor3D.hpp.

◆ dx() [2/2]

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dx ( ) const
inline

Get the size of the X-axis.

Definition at line 89 of file Tensor3D.hpp.

◆ dy() [1/2]

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dy ( )
inline

Get the size of the Y-axis.

Definition at line 92 of file Tensor3D.hpp.

◆ dy() [2/2]

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dy ( ) const
inline

Get the size of the Y-axis.

Definition at line 95 of file Tensor3D.hpp.

◆ dz() [1/2]

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dz ( )
inline

Get the size of the Z-axis.

Definition at line 98 of file Tensor3D.hpp.

◆ dz() [2/2]

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dz ( ) const
inline

Get the size of the Z-axis.

Definition at line 101 of file Tensor3D.hpp.

◆ operator()() [1/2]

template<typename DType >
DType & volcart::Tensor3D< DType >::operator() ( std::size_t  x,
std::size_t  y,
std::size_t  z 
)
inline

Get the tensor value at x, y, z.

Definition at line 75 of file Tensor3D.hpp.

◆ operator()() [2/2]

template<typename DType >
const DType & volcart::Tensor3D< DType >::operator() ( std::size_t  x,
std::size_t  y,
std::size_t  z 
) const
inline

Get the tensor value at x, y, z.

Definition at line 66 of file Tensor3D.hpp.

◆ operator<<()

template<typename DType >
std::ostream & operator<< ( std::ostream &  s,
const volcart::Tensor3D< DType > &  tensor 
)

Write a Tensor3D to an output stream.

Definition at line 155 of file Tensor3D.hpp.

◆ xySlice() [1/2]

template<typename DType >
cv::Mat_< DType > & volcart::Tensor3D< DType >::xySlice ( std::size_t  z)
inline

Get an XY cross section of the Tensor at z.

Definition at line 109 of file Tensor3D.hpp.

◆ xySlice() [2/2]

template<typename DType >
const cv::Mat_< DType > & volcart::Tensor3D< DType >::xySlice ( std::size_t  z) const
inline

Get an XY cross section of the Tensor at z.

Definition at line 106 of file Tensor3D.hpp.

◆ xzSlice()

template<typename DType >
cv::Mat_< DType > volcart::Tensor3D< DType >::xzSlice ( std::size_t  y) const
inline

Get an XZ cross section of the Tensor at y.

Definition at line 112 of file Tensor3D.hpp.

Member Data Documentation

◆ dx_

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dx_
private

Size of the X-axis

Definition at line 142 of file Tensor3D.hpp.

◆ dy_

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dy_
private

Size of the Y-axis

Definition at line 144 of file Tensor3D.hpp.

◆ dz_

template<typename DType >
std::size_t volcart::Tensor3D< DType >::dz_
private

Size of the Z-axis

Definition at line 146 of file Tensor3D.hpp.

◆ tensor_

template<typename DType >
std::vector<cv::Mat_<DType> > volcart::Tensor3D< DType >::tensor_
private

Tensor storage

Definition at line 140 of file Tensor3D.hpp.


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