SurgSim::DataStructures::ImageBase< T > Class Template Referenceabstract

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

`#include <SurgSim/DataStructures/ImageBase.h>`

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

## Public Types

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

## Public Member Functions

virtual | ~ImageBase ()
| Destructor. More...
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...

## Private Attributes

size_t | m_width
size_t | m_height
size_t | m_channels

## Detailed Description

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

Base class for Image-like classes.

Template Parameters

  T | the data type of the image data

## Member Typedef Documentation

## ChannelType

template<class T>

typedef Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> SurgSim::DataStructures::ImageBase< T >::ChannelType

2D Channel Type;

## VectorType

template<class T>

typedef Eigen::Matrix<T, Eigen::Dynamic, 1> SurgSim::DataStructures::ImageBase< T >::VectorType

1D Vector Type;

## Constructor & Destructor Documentation

## ~ImageBase()

template<class T >

SurgSim::DataStructures::ImageBase< T >::~ImageBase | ( |  | ) |

virtual

Destructor.

## 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

  index | the 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

  index | the 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

  x | The horizontal image position
  y | The 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

  x | The horizontal position in the image
  y | The 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

  data | the 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

  index | the channel number
  data | the 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

  width | the image width
  height | the image height
  channels | the number of channels in the image

## Member Data Documentation

## m_channels

template<class T>

size_t SurgSim::DataStructures::ImageBase< T >::m_channels

private

## m_height

template<class T>

size_t SurgSim::DataStructures::ImageBase< T >::m_height

private

## m_width

template<class T>

size_t SurgSim::DataStructures::ImageBase< T >::m_width

private

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

- SurgSim/DataStructures/ImageBase.h
- SurgSim/DataStructures/ImageBase-inl.h