opensurgsim
Public Types | Public Member Functions | Protected Member Functions | List of all members
SurgSim::DataStructures::ImageBase< T > Class Template Referenceabstract

Base class for Image-like classes. More...

#include <ImageBase.h>

Inheritance diagram for SurgSim::DataStructures::ImageBase< T >:
SurgSim::DataStructures::Image< T > SurgSim::DataStructures::ImageMap< T >

Public Types

typedef Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > ChannelType
 2D Channel Type;
 
typedef Eigen::Matrix< T, Eigen::Dynamic, 1 > VectorType
 1D Vector Type;
 

Public Member Functions

virtual ~ImageBase ()
 Destructor.
 
size_t getWidth () const
 Get the Image width. More...
 
size_t getHeight () const
 Get the Image height. More...
 
std::array< size_t, 3 > getSize () const
 Get the Image size. More...
 
size_t getNumChannels () const
 Get the number of channels in this Image. More...
 
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, 1 > > operator() (size_t x, size_t y)
 Get the pixel value at (x, y) More...
 
Eigen::Map< const Eigen::Matrix< T, Eigen::Dynamic, 1 > > operator() (size_t x, size_t y) const
 Get the pixel value at (x, y), constant version. More...
 
Eigen::Map< ChannelType, Eigen::Unaligned, Eigen::Stride<-1, -1 > > getChannel (size_t index)
 Get the 2D image channel data. More...
 
Eigen::Map< const ChannelType, Eigen::Unaligned, Eigen::Stride<-1, -1 > > getChannel (size_t index) const
 Get the 2D image channel data, constant version. More...
 
void setChannel (size_t index, const Eigen::Ref< const ChannelType > &data)
 Set the image data in the channel. More...
 
Eigen::Map< VectorType, Eigen::Unaligned > getAsVector ()
 Get the data as a 1D Vector. More...
 
Eigen::Map< const VectorType, Eigen::Unaligned > getAsVector () const
 Get the data as a 1D Vector, constant version. More...
 
void setAsVector (const Eigen::Ref< const VectorType > &data)
 Set the image data as a 1D Vector. More...
 
virtual T *const getData ()=0
 Get the pointer to the data. More...
 
virtual const T *const getData () const =0
 Get the pointer to the data, constant version. More...
 

Protected Member Functions

void setSize (size_t width, size_t height, size_t channels)
 Set the Image size. More...
 

Detailed Description

template<class T>
class SurgSim::DataStructures::ImageBase< T >

Base class for Image-like classes.

Template Parameters
Tthe data type of the image data

Member Function Documentation

§ getAsVector() [1/2]

template<class T >
Eigen::Map< typename ImageBase< T >::VectorType, Eigen::Unaligned > SurgSim::DataStructures::ImageBase< T >::getAsVector ( )

Get the data as a 1D Vector.

Returns
mutable 1D data as an Eigen::Map (can be used as an Eigen::Matrix)

§ getAsVector() [2/2]

template<class T >
Eigen::Map< const typename ImageBase< T >::VectorType, Eigen::Unaligned > SurgSim::DataStructures::ImageBase< T >::getAsVector ( ) const

Get the data as a 1D Vector, constant version.

Returns
constant 1D data as an Eigen::Map (can be used as an Eigen::Matrix)

§ getChannel() [1/2]

template<class T >
Eigen::Map< typename ImageBase< T >::ChannelType, Eigen::Unaligned, Eigen::Stride<-1, -1 > > SurgSim::DataStructures::ImageBase< T >::getChannel ( size_t  index)

Get the 2D image channel data.

Parameters
indexthe channel number
Returns
mutable channel data as an Eigen::Map (can be used as an Eigen::Matrix)

§ getChannel() [2/2]

template<class T >
Eigen::Map< const typename ImageBase< T >::ChannelType, Eigen::Unaligned, Eigen::Stride<-1, -1 > > SurgSim::DataStructures::ImageBase< T >::getChannel ( size_t  index) const

Get the 2D image channel data, constant version.

Parameters
indexthe channel number
Returns
constant channel data as an Eigen::Map (can be used as an Eigen::Matrix)

§ getData() [1/2]

template<class T>
virtual T* const SurgSim::DataStructures::ImageBase< T >::getData ( )
pure virtual

Get the pointer to the data.

Returns
the data

Implemented in SurgSim::DataStructures::Image< T >, and SurgSim::DataStructures::ImageMap< T >.

§ getData() [2/2]

template<class T>
virtual const T* const SurgSim::DataStructures::ImageBase< T >::getData ( ) const
pure virtual

Get the pointer to the data, constant version.

Returns
the data

Implemented in SurgSim::DataStructures::Image< T >, and SurgSim::DataStructures::ImageMap< T >.

§ getHeight()

template<class T >
size_t SurgSim::DataStructures::ImageBase< T >::getHeight ( ) const

Get the Image height.

Returns
the height

§ getNumChannels()

template<class T >
size_t SurgSim::DataStructures::ImageBase< T >::getNumChannels ( ) const

Get the number of channels in this Image.

Returns
the number of channels

§ getSize()

template<class T >
std::array< size_t, 3 > SurgSim::DataStructures::ImageBase< T >::getSize ( ) const

Get the Image size.

Returns
the image size as (width, height, channels)

§ getWidth()

template<class T >
size_t SurgSim::DataStructures::ImageBase< T >::getWidth ( ) const

Get the Image width.

Returns
the width

§ operator()() [1/2]

template<class T >
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, 1 > > SurgSim::DataStructures::ImageBase< T >::operator() ( size_t  x,
size_t  y 
)

Get the pixel value at (x, y)

Parameters
xThe horizontal image position
yThe vertical image position
Returns
mutable pixel value as Eigen::Map of size (channels x 1)

§ operator()() [2/2]

template<class T >
Eigen::Map< const Eigen::Matrix< T, Eigen::Dynamic, 1 > > SurgSim::DataStructures::ImageBase< T >::operator() ( size_t  x,
size_t  y 
) const

Get the pixel value at (x, y), constant version.

Parameters
xThe horizontal position in the image
yThe vertical position in the image
Returns
constant pixel value as Eigen::Map of size (channels x 1)

§ setAsVector()

template<class T >
void SurgSim::DataStructures::ImageBase< T >::setAsVector ( const Eigen::Ref< const VectorType > &  data)

Set the image data as a 1D Vector.

Parameters
datathe data as a compatible Eigen vector type

§ setChannel()

template<class T >
void SurgSim::DataStructures::ImageBase< T >::setChannel ( size_t  index,
const Eigen::Ref< const ChannelType > &  data 
)

Set the image data in the channel.

Parameters
indexthe channel number
datathe channel data as a compatible Eigen type

§ setSize()

template<class T >
void SurgSim::DataStructures::ImageBase< T >::setSize ( size_t  width,
size_t  height,
size_t  channels 
)
protected

Set the Image size.

Parameters
widththe image width
heightthe image height
channelsthe number of channels in the image

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