A class to hold data on a regular 2D grid. More...
#include <mia/2d/datafield.hh>
Public Types | |
typedef ::std::vector< T > | data_array |
type for the flat reprentation of the 2D data field More... | |
typedef std::shared_ptr < data_array > | data_pointer |
pointer type More... | |
Public Member Functions | |
const_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) |
range_iterator | begin_range (const C2DBounds &begin, const C2DBounds &end) |
const_range_iterator | begin_range (const C2DBounds &begin, const C2DBounds &end) const |
void | clear () |
const_iterator | end () const |
iterator | end () |
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 |
T | get_interpol_val_at (const C2DFVector &p) const |
This function should really go away. More... | |
const C2DBounds & | get_size () const |
void | make_single_ref () |
const_reference | operator() (size_t x, size_t y) const |
reference | operator() (size_t x, size_t y) |
const_reference | operator() (const C2DBounds &l) const |
reference | operator() (const C2DBounds &l) |
T2DDatafield & | operator= (const T2DDatafield &org) |
const_reference | operator[] (size_t idx) const |
reference | operator[] (size_t idx) |
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 T *_data) | |
T2DDatafield (const C2DBounds &size, const data_array &data) | |
T2DDatafield (const T2DDatafield< T > &org) | |
virtual | ~T2DDatafield () |
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.
T | the data type of the values hold at the grid points. |
Definition at line 52 of file 2d/datafield.hh.
typedef ::std::vector<T> T2DDatafield< T >::data_array |
type for the flat reprentation of the 2D data field
Definition at line 57 of file 2d/datafield.hh.
typedef std::shared_ptr<data_array > T2DDatafield< T >::data_pointer |
pointer type
Definition at line 60 of file 2d/datafield.hh.
T2DDatafield< T >::T2DDatafield | ( | ) |
T2DDatafield< T >::T2DDatafield | ( | const C2DBounds & | size) |
Create a 2D data field with the given size
size |
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
size | |
_data | must at least be of size (size.x*size.y) |
T2DDatafield< T >::T2DDatafield | ( | const C2DBounds & | size, |
const data_array & | data | ||
) |
Create a 2D data field with the given size and initialize it with the given data
size | |
data | must at least be of size (size.x*size.y) |
T2DDatafield< T >::T2DDatafield | ( | const T2DDatafield< T > & | org) |
copy constructor, it does a shallow copy of the original, i.e. the data is not copied, only the shared pointer increases its reference count. If you want a truely unique copy, call make_single_ref() afterwards.
|
virtual |
|
inline |
Definition at line 216 of file 2d/datafield.hh.
Referenced by FDeformer2D::operator()().
|
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.
Definition at line 231 of file 2d/datafield.hh.
|
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.
x | |
y |
Definition at line 252 of file 2d/datafield.hh.
|
inline |
Get a read-only iterator to iterate over the field staring from the given position.
x | |
y |
Definition at line 265 of file 2d/datafield.hh.
range_iterator T2DDatafield< T >::begin_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) |
const_range_iterator T2DDatafield< T >::begin_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) | const |
void T2DDatafield< T >::clear | ( | ) |
This function first ensures that the copy of the data is unique by calling make_single_ref() and then sets the elements of data to T().
|
inline |
Definition at line 222 of file 2d/datafield.hh.
|
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.
Definition at line 241 of file 2d/datafield.hh.
range_iterator T2DDatafield< T >::end_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) |
const_range_iterator T2DDatafield< T >::end_range | ( | const C2DBounds & | begin, |
const C2DBounds & | end | ||
) | const |
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
[in] | y | row to be copied from |
[out] | buffer | to copy the data to. It will be resized to fit the data |
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
[in] | x | column to be copied from |
[out] | buffer | to copy the data to. It will be resized to fit the data |
T T2DDatafield< T >::get_interpol_val_at | ( | const C2DFVector & | p) | const |
This function should really go away.
const C2DBounds& T2DDatafield< T >::get_size | ( | ) | const |
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
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.
x | |
y |
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.
const_reference T2DDatafield< T >::operator() | ( | const C2DBounds & | l) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
reference T2DDatafield< T >::operator() | ( | const C2DBounds & | l) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
T2DDatafield& T2DDatafield< T >::operator= | ( | const T2DDatafield< T > & | org) |
Assignment operator, Just like the copy constructor this call does only increment the reference count to the data. If you want a truely unique copy, call make_single_ref() afterwards.
|
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 but is doesn't test whether the index is inside the image domain.
idx |
Definition at line 159 of file 2d/datafield.hh.
|
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 but is doesn't test whether the index is inside the image domain.
idx |
Definition at line 171 of file 2d/datafield.hh.
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.
[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 |
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.
[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_type T2DDatafield< T >::size | ( | ) | const |