T2DDatafield< T > Class Template Reference
Basic data strctures and functions

A class to hold data on a regular 2D grid. More...

`#include <mia/2d/datafield.hh>`

Inheritance diagram for T2DDatafield< T >:
[legend]

## Data Structures

class | ConstRange
class | Range

## Public Types

typedef ::std::vector< typename __holder_type_dispatch< T >::type > | data_array
| type for the flat reprentation of the 2D data field

## Public Member Functions

iterator | begin ()
const_iterator | begin () const
iterator | begin_at (size_t x, size_t y)
const_iterator | begin_at (size_t x, size_t y) const
range_iterator | begin_range (const C2DBounds &begin, const C2DBounds &end)
const_range_iterator | begin_range (const C2DBounds &begin, const C2DBounds &end) const
void | clear ()
iterator | end ()
const_iterator | end () const
range_iterator | end_range (const C2DBounds &begin, const C2DBounds &end)
const_range_iterator | end_range (const C2DBounds &begin, const C2DBounds &end) const
void | get_data_line_x (size_t y, std::vector< T > &buffer) const
void | get_data_line_y (size_t x, std::vector< T > &buffer) const
Range | get_range (const C2DBounds &start, const C2DBounds &end)
ConstRange | get_range (const C2DBounds &start, const C2DBounds &end) const
const C2DBounds & | get_size () const
void | make_single_ref () __attribute__((deprecated))
reference | operator() (const C2DBounds &l)
const_reference | operator() (const C2DBounds &l) const
reference | operator() (size_t x, size_t y)
const_reference | operator() (size_t x, size_t y) const
T2DDatafield< T > & | operator= (const T2DDatafield< T > &org)
T2DDatafield< T > & | operator= (T2DDatafield< T > &&org)
reference | operator[] (size_t idx)
const_reference | operator[] (size_t idx) const
void | put_data_line_x (size_t y, const std::vector< T > &buffer)
void | put_data_line_y (size_t x, const std::vector< T > &buffer)
size_type | size () const
| T2DDatafield ()
| T2DDatafield (const C2DBounds &size)
| T2DDatafield (const C2DBounds &size, const std::vector< T > &data)
| T2DDatafield (const C2DBounds &size, const T *_data)
| T2DDatafield (const T2DDatafield< T > &org)
| T2DDatafield (T2DDatafield< T > &&org)
virtual | ~T2DDatafield ()

## Detailed Description

template<class T>
class T2DDatafield< T >

A class to hold data on a regular 2D grid.

This class is the base for all kind of 2D data that is stored over a regular grid. The data it hols is stored in a shared pointer.

Template Parameters

  T | the data type of the values hold at the grid points.

Definition at line 89 of file 2d/datafield.hh.

## Member Typedef Documentation

## data_array

template<class T>

typedef ::std::vector<typename __holder_type_dispatch<T>::type> T2DDatafield< T >::data_array

type for the flat reprentation of the 2D data field

Definition at line 95 of file 2d/datafield.hh.

## Constructor & Destructor Documentation

## T2DDatafield() [1/6]

template<class T>

T2DDatafield< T >::T2DDatafield | ( |  | ) |

Referenced by T2DDatafield< T >::ConstRange::end(), and T2DDatafield< T >::Range::end().

## T2DDatafield() [2/6]

template<class T>

T2DDatafield< T >::T2DDatafield | ( | const C2DBounds & | size | ) |

explicit

Create a 2D data field with the given size

Parameters

  size |

## T2DDatafield() [3/6]

template<class T>

T2DDatafield< T >::T2DDatafield | ( | const C2DBounds & | size,
|  | const T * | _data )

Create a 2D data field with the given size and initialize it with the given data

Parameters

  size |
  _data | must at least be of size (size.x*size.y)

## T2DDatafield() [4/6]

template<class T>

T2DDatafield< T >::T2DDatafield | ( | const C2DBounds & | size,
|  | const std::vector< T > & | data )

Create a 2D data field with the given size and initialize it with the given data

Parameters

  size |
  data | must at least be of size (size.x*size.y)

## T2DDatafield() [5/6]

template<class T>

T2DDatafield< T >::T2DDatafield | ( | const T2DDatafield< T > & | org | ) |

copy constructor, it does a deep copy.

## T2DDatafield() [6/6]

template<class T>

T2DDatafield< T >::T2DDatafield | ( | T2DDatafield< T > && | org | ) |

move constructor

## ~T2DDatafield()

template<class T>

virtual T2DDatafield< T >::~T2DDatafield | ( |  | ) |

virtual

## Member Function Documentation

## begin() [1/2]

template<class T>

iterator T2DDatafield< T >::begin | ( |  | ) |

inline

Get a read-write iterator to iterate over the whole field. The functions ensures that the data will only be referenced by this object.

Returns
  a read-write iterator to the begin of the data field

Definition at line 318 of file 2d/datafield.hh.

## begin() [2/2]

template<class T>

const_iterator T2DDatafield< T >::begin | ( |  | ) | const

inline

Returns
  a read-only iterator to the begin of the data field with x being the fastest changing index

Definition at line 303 of file 2d/datafield.hh.

## begin_at() [1/2]

template<class T>

iterator T2DDatafield< T >::begin_at | ( | size_t | x,
|  | size_t | y )

inline

Get a read-only iterator to iterate over the field staring from the given position.

Parameters

  x |
  y |

Returns
  a read-write iterator to the given position of the data field

Definition at line 351 of file 2d/datafield.hh.

## begin_at() [2/2]

template<class T>

const_iterator T2DDatafield< T >::begin_at | ( | size_t | x,
|  | size_t | y ) const

inline

Get a read-write iterator to iterate over the field staring from the given position. The functions ensures that the data will only be referenced by this object.

Parameters

  x |
  y |

Returns
  a read-write iterator to the given position of the data field

Definition at line 339 of file 2d/datafield.hh.

## begin_range() [1/2]

template<class T>

range_iterator T2DDatafield< T >::begin_range | ( | const C2DBounds & | begin,
|  | const C2DBounds & | end )

Returns
  an read/write forward iterator over a subset of the data. The functions ensures, that the field uses a single referenced datafield

Referenced by T2DImage< bool >::begin_range(), T2DImage< bool >::begin_range(), T3DImage< bool >::begin_range(), and T3DImage< bool >::begin_range().

## begin_range() [2/2]

template<class T>

const_range_iterator T2DDatafield< T >::begin_range | ( | const C2DBounds & | begin,
|  | const C2DBounds & | end ) const

Returns
  an read/write forward iterator over a subset of the data. The functions ensures, that the field uses a single referenced datafield

## clear()

template<class T>

void T2DDatafield< T >::clear | ( |  | ) |

This function sets the elements of data to T().

## end() [1/2]

template<class T>

iterator T2DDatafield< T >::end | ( |  | ) |

inline

Get a read-write iterator to iterate over the whole field. The functions ensures that the data will only be referenced by this object.

Returns
  a read-write iterator to the end of the data field

Definition at line 328 of file 2d/datafield.hh.

## end() [2/2]

template<class T>

const_iterator T2DDatafield< T >::end | ( |  | ) | const

inline

Returns
  a read-only iterator to the end of the data field with x being the fastest changing index

Definition at line 309 of file 2d/datafield.hh.

## end_range() [1/2]

template<class T>

range_iterator T2DDatafield< T >::end_range | ( | const C2DBounds & | begin,
|  | const C2DBounds & | end )

Returns
  the end of a read/write forward iterator over a subset of the data.

Referenced by T2DImage< bool >::end_range(), T2DImage< bool >::end_range(), T3DImage< bool >::end_range(), and T3DImage< bool >::end_range().

## end_range() [2/2]

template<class T>

const_range_iterator T2DDatafield< T >::end_range | ( | const C2DBounds & | begin,
|  | const C2DBounds & | end ) const

Returns
  the end of a read/write forward iterator over a subset of the data.

## get_data_line_x()

template<class T>

void T2DDatafield< T >::get_data_line_x | ( | size_t | y,
|  | std::vector< T > & | buffer ) const

Read a data row from the data field to the provided buffer

Parameters

  [in] | y | row to be copied from
  [out] | buffer | to copy the data to. It will be resized to fit the data

## get_data_line_y()

template<class T>

void T2DDatafield< T >::get_data_line_y | ( | size_t | x,
|  | std::vector< T > & | buffer ) const

Read a data column from the data field to the provided buffer

Parameters

  [in] | x | column to be copied from
  [out] | buffer | to copy the data to. It will be resized to fit the data

## get_range() [1/2]

template<class T>

Range T2DDatafield< T >::get_range | ( | const C2DBounds & | start,
|  | const C2DBounds & | end )

## get_range() [2/2]

template<class T>

ConstRange T2DDatafield< T >::get_range | ( | const C2DBounds & | start,
|  | const C2DBounds & | end ) const

## get_size()

template<class T>

const C2DBounds & T2DDatafield< T >::get_size | ( |  | ) | const

Returns
  the size of the data field

## make_single_ref()

template<class T>

void T2DDatafield< T >::make_single_ref | ( |  | ) |

Since the data is internally stored by a shared pointer, this function ensures that the data is not shared with any other object

## operator()() [1/4]

template<class T>

reference T2DDatafield< T >::operator() | ( | const C2DBounds & | l | ) |

## operator()() [2/4]

template<class T>

const_reference T2DDatafield< T >::operator() | ( | const C2DBounds & | l | ) | const

## operator()() [3/4]

template<class T>

reference T2DDatafield< T >::operator() | ( | size_t | x,
|  | size_t | y )

returns a writable reference to the data element at (x,y). If the index is outside the image domain, the function throws a std::invalid_argument exception.

## operator()() [4/4]

template<class T>

const_reference T2DDatafield< T >::operator() | ( | size_t | x,
|  | size_t | y ) const

returns a read-only reference to the data element at (x,y). If the index is outside the image domain, the function returns the Zero element.

Parameters

  x |
  y |

Returns
  the reference

## operator=() [1/2]

template<class T>

T2DDatafield< T > & T2DDatafield< T >::operator= | ( | const T2DDatafield< T > & | org | ) |

Assignment operator, does a deep copy.

## operator=() [2/2]

template<class T>

T2DDatafield< T > & T2DDatafield< T >::operator= | ( | T2DDatafield< T > && | org | ) |

Assignment move operator

## operator[]() [1/2]

template<class T>

reference T2DDatafield< T >::operator[] | ( | size_t | idx | ) |

inline

Direct index into the underlying data array - this access is usually faster then calling operator()(size_t x, size_t y) and corresponds to \(idx= x + y * m_size.x\) but is doesn't test whether the index is inside the image domain.

Parameters

  idx |

Returns
  read-write reference to the data

Definition at line 257 of file 2d/datafield.hh.

## operator[]() [2/2]

template<class T>

const_reference T2DDatafield< T >::operator[] | ( | size_t | idx | ) | const

inline

Direct index into the underlying data array - this access is usually faster then calling operator()(size_t x, size_t y) and corresponds to \(idx= x + y * m_size.x\) but is doesn't test whether the index is inside the image domain.

Parameters

  idx |

Returns
  read-only reference to the data

Definition at line 244 of file 2d/datafield.hh.

## put_data_line_x()

template<class T>

void T2DDatafield< T >::put_data_line_x | ( | size_t | y,
|  | const std::vector< T > & | buffer )

Write a data row to the data field. The function ensures that tha data is not shared with some other object.

Parameters

  [in] | y | row to be copied to
  [in] | buffer | data buffer, must be of the same size as the row size of the data field

## put_data_line_y()

template<class T>

void T2DDatafield< T >::put_data_line_y | ( | size_t | x,
|  | const std::vector< T > & | buffer )

Write a data column to the data field. The function ensures that tha data is not shared with some other object.

Parameters

  [in] | x | column to be copied to
  [in] | buffer | data buffer, must be of the same size as the column size of the data field

## size()

template<class T>

size_type T2DDatafield< T >::size | ( |  | ) | const

Returns
  the number of elements in the data field

Referenced by T2DVectorfield< C2DDVector >::T2DVectorfield(), and T2DVectorfield< C2DDVector >::T2DVectorfield().

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

- 2d/datafield.hh