Public Member Functions
T3DDatafield< T > Class Template Reference

A templated class of a 3D data field. More...

#include <mia/3d/datafield.hh>

Inheritance diagram for T3DDatafield< T >:
T3DVectorfield< T >

Public Member Functions

const_iterator begin () const
 
iterator begin ()
 
const_iterator begin_at (size_t x, size_t y, size_t z) const
 
iterator begin_at (size_t x, size_t y, size_t z)
 
range_iterator begin_range (const C3DBounds &begin, const C3DBounds &end)
 
const_range_iterator begin_range (const C3DBounds &begin, const C3DBounds &end) const
 
void clear ()
 
const_iterator end () const
 
iterator end ()
 
range_iterator end_range (const C3DBounds &begin, const C3DBounds &end)
 
const_range_iterator end_range (const C3DBounds &begin, const C3DBounds &end) const
 
value_type get_avg ()
 
value_type get_block_avrg (const C3DBounds &Start, const C3DBounds &BlockSize) const
 
void get_data_line_x (int y, int z, std::vector< T > &buffer) const
 
void get_data_line_y (int x, int z, std::vector< T > &buffer) const
 
void get_data_line_z (int x, int y, std::vector< T > &buffer) const
 
T2DDatafield< T > get_data_plane_xy (size_t z) const
 
T2DDatafield< T > get_data_plane_xz (size_t y) const
 
T2DDatafield< T > get_data_plane_yz (size_t x) const
 
template<typename Out >
T3DVector< Out > get_gradient (const T3DVector< float > &p) const
 
template<typename Out >
T3DVector< Out > get_gradient (size_t x, size_t y, size_t z) const
 
template<typename Out >
T3DVector< Out > get_gradient (int index) const
 
template<>
T3DVector< Out > get_gradient (int hardcode) const
 
value_type get_interpol_val_at (const T3DVector< float > &p) const
 
size_t get_plane_size_xy () const
 
const C3DBoundsget_size () const
 
value_type get_trilin_interpol_val_at (const T3DVector< float > &p) const
 
bool holds_unique_data () const
 
void make_single_ref ()
 
template<class TMask >
void mask (const TMask &m)
 
value_type operator() (const T3DVector< float > &pos) const
 
const_reference operator() (size_t x, size_t y, size_t z) const
 
const_reference operator() (const C3DBounds &l) const
 
reference operator() (size_t x, size_t y, size_t z)
 
reference operator() (const C3DBounds &l)
 
T3DDatafieldoperator= (const T3DDatafield &org)
 
const_reference operator[] (int i) const
 
reference operator[] (int i)
 
void put_data_line_x (int y, int z, const std::vector< T > &buffer)
 
void put_data_line_y (int x, int z, const std::vector< T > &buffer)
 
void put_data_line_z (int x, int y, const std::vector< T > &buffer)
 
void put_data_plane_xy (size_t z, const T2DDatafield< T > &p)
 
void put_data_plane_xz (size_t y, const T2DDatafield< T > &p)
 
void put_data_plane_yz (size_t x, const T2DDatafield< T > &p)
 
void read_xslice_flat (size_t x, std::vector< atomic_type > &buffer) const
 
void read_yslice_flat (size_t y, std::vector< atomic_type > &buffer) const
 
void read_zslice_flat (size_t z, std::vector< atomic_type > &buffer) const
 
size_type size () const
 
value_type strip_avg ()
 
void swap (T3DDatafield &other)
 swap the data ofthis 3DDatafield with another one More...
 
 T3DDatafield ()
 a shortcut data type More...
 
 T3DDatafield (const C3DBounds &_Size)
 
 T3DDatafield (const C3DBounds &size, const T *data)
 
 T3DDatafield (const T3DDatafield< T > &org)
 
void write_xslice_flat (size_t x, const std::vector< atomic_type > &buffer)
 
void write_yslice_flat (size_t y, const std::vector< atomic_type > &buffer)
 
void write_zslice_flat (size_t z, const std::vector< atomic_type > &buffer)
 
virtual ~T3DDatafield ()
 make sure the destructor is virtual More...
 

Detailed Description

template<class T>
class T3DDatafield< T >

A templated class of a 3D data field.

Definition at line 45 of file 3d/datafield.hh.

Constructor & Destructor Documentation

template<class T>
T3DDatafield< T >::T3DDatafield ( )

a shortcut data type

template<class T>
T3DDatafield< T >::T3DDatafield ( const C3DBounds _Size)

Constructor to create empty Datafield if given size

template<class T>
T3DDatafield< T >::T3DDatafield ( const C3DBounds size,
const T *  data 
)

Constructor to create Datafield if given size and with initialization data

Parameters
sizethe size of the 3D-field
datato use for initialization
template<class T>
T3DDatafield< T >::T3DDatafield ( const T3DDatafield< T > &  org)

copy - Constructor

template<class T>
virtual T3DDatafield< T >::~T3DDatafield ( )
virtual

make sure the destructor is virtual

Member Function Documentation

template<class T>
const_iterator T3DDatafield< T >::begin ( ) const
inline
Returns
an read only forward iterator over the whole data field

Definition at line 342 of file 3d/datafield.hh.

template<class T>
iterator T3DDatafield< T >::begin ( )
inline
Returns
an read/write random access iterator over the whole data field pointing at the beginning of the data. The functions ensures, that the field uses a single referenced datafield

Definition at line 367 of file 3d/datafield.hh.

template<class T>
const_iterator T3DDatafield< T >::begin_at ( size_t  x,
size_t  y,
size_t  z 
) const
inline
Returns
an read only forward iterator over data field starting at (x,y,z)

Definition at line 350 of file 3d/datafield.hh.

Referenced by FDeformer3D::operator()().

template<class T>
iterator T3DDatafield< T >::begin_at ( size_t  x,
size_t  y,
size_t  z 
)
inline

Obtain an iterator at position (x,y,z) The functions ensures, that the field uses a single referenced datafield

Parameters
x
y
z
Returns
the iterator

Definition at line 397 of file 3d/datafield.hh.

template<class T>
range_iterator T3DDatafield< T >::begin_range ( const C3DBounds begin,
const C3DBounds end 
)
Returns
an read/write forward iterator over a subset of the data. The functions ensures, that the field uses a single referenced datafield
template<class T>
const_range_iterator T3DDatafield< T >::begin_range ( const C3DBounds begin,
const C3DBounds 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
template<class T>
void T3DDatafield< T >::clear ( )

Set alle elements of the field to T() == Zero

template<class T>
const_iterator T3DDatafield< T >::end ( ) const
inline
Returns
the end iterator to the 3D data field

Definition at line 359 of file 3d/datafield.hh.

template<class T>
iterator T3DDatafield< T >::end ( )
inline
Returns
an read/write random access iterator over the whole data field pointing at the end of the data. The functions ensures, that the field uses a single referenced datafield

Definition at line 406 of file 3d/datafield.hh.

template<class T>
range_iterator T3DDatafield< T >::end_range ( const C3DBounds begin,
const C3DBounds end 
)
Returns
the end of a read/write forward iterator over a subset of the data.
template<class T>
const_range_iterator T3DDatafield< T >::end_range ( const C3DBounds begin,
const C3DBounds end 
) const
Returns
the end of a read/write forward iterator over a subset of the data.
template<class T>
value_type T3DDatafield< T >::get_avg ( )
Returns
the average over the whole datafield
template<class T>
value_type T3DDatafield< T >::get_block_avrg ( const C3DBounds Start,
const C3DBounds BlockSize 
) const

Get the average over a given Block Attn: Type T must be able to hold the Sum of all Elements in Block

template<class T>
void T3DDatafield< T >::get_data_line_x ( int  y,
int  z,
std::vector< T > &  buffer 
) const

Get some Data along some line parallel to X axis

template<class T>
void T3DDatafield< T >::get_data_line_y ( int  x,
int  z,
std::vector< T > &  buffer 
) const

Get some Data along some line parallel to Y axis

template<class T>
void T3DDatafield< T >::get_data_line_z ( int  x,
int  y,
std::vector< T > &  buffer 
) const

Get some Data along some line parallel to Z axis

template<class T>
T2DDatafield<T> T3DDatafield< T >::get_data_plane_xy ( size_t  z) const

Read a z-plane from the 3D data set.

Parameters
z
Returns
the copied data in a 2D data field
template<class T>
T2DDatafield<T> T3DDatafield< T >::get_data_plane_xz ( size_t  y) const

Read a y-plane from the 3D data set.

Parameters
y
Returns
the copied data in a 2D data field
template<class T>
T2DDatafield<T> T3DDatafield< T >::get_data_plane_yz ( size_t  x) const

Read a x-plane from the 3D data set.

Parameters
x
Returns
the copied data in a 2D data field
template<class T >
template<typename Out >
T3DVector< Out > T3DDatafield< T >::get_gradient ( const T3DVector< float > &  p) const

Gradient calculation using tri-linear interpolation

Parameters
pposition where to evaluate the gradient

Definition at line 524 of file 3d/datafield.hh.

References T3DVector< T >::x, T3DVector< T >::y, and T3DVector< T >::z.

template<class T >
template<typename Out >
T3DVector< Out > T3DDatafield< T >::get_gradient ( size_t  x,
size_t  y,
size_t  z 
) const

calculate gradient of data field at a grid point

Definition at line 475 of file 3d/datafield.hh.

template<class T >
template<typename Out >
T3DVector< Out > T3DDatafield< T >::get_gradient ( int  index) const

calculate the gradient at a grid point given by a linear location

Definition at line 496 of file 3d/datafield.hh.

template<>
T3DVector< Out > T3DDatafield< bool >::get_gradient ( int  hardcode) const

Specialization to handle the wired std::vector<bool> implementation

Definition at line 513 of file 3d/datafield.hh.

template<class T>
value_type T3DDatafield< T >::get_interpol_val_at ( const T3DVector< float > &  p) const

Interpolate the value of Field at p default uses tri-linear interpolation

template<class T>
size_t T3DDatafield< T >::get_plane_size_xy ( ) const
inline
Returns
the element count of one z slice

Definition at line 429 of file 3d/datafield.hh.

template<class T>
const C3DBounds& T3DDatafield< T >::get_size ( ) const
inline
Returns
the 3D-size of the data field

Definition at line 152 of file 3d/datafield.hh.

Referenced by FDeformer3D::operator()().

template<class T>
value_type T3DDatafield< T >::get_trilin_interpol_val_at ( const T3DVector< float > &  p) const

just as the name says

template<class T>
bool T3DDatafield< T >::holds_unique_data ( ) const
inline

Checks whether the data hold by the data field is unique.

Returns
true if it is

Definition at line 73 of file 3d/datafield.hh.

template<class T>
void T3DDatafield< T >::make_single_ref ( )

makes a single reference of the data, after calling this, it is save to write to the data field

template<class T>
template<class TMask >
void T3DDatafield< T >::mask ( const TMask &  m)

Mask the data field with a given mask

template<class T>
value_type T3DDatafield< T >::operator() ( const T3DVector< float > &  pos) const

interpolating access operator

template<class T>
const_reference T3DDatafield< T >::operator() ( size_t  x,
size_t  y,
size_t  z 
) const
inline

read-only indx operator

Definition at line 181 of file 3d/datafield.hh.

template<class T>
const_reference T3DDatafield< T >::operator() ( const C3DBounds l) const
inline

alternate read-only indx operator

Definition at line 193 of file 3d/datafield.hh.

template<class T>
reference T3DDatafield< T >::operator() ( size_t  x,
size_t  y,
size_t  z 
)
inline

Index operator witch gives write access

Definition at line 199 of file 3d/datafield.hh.

template<class T>
reference T3DDatafield< T >::operator() ( const C3DBounds l)
inline

Alternate index operator witch gives write access

Definition at line 210 of file 3d/datafield.hh.

template<class T>
T3DDatafield& T3DDatafield< T >::operator= ( const T3DDatafield< T > &  org)

Assignment operator -

Remarks
it just copys a pointer to the data and increases its reference count, before writing it is necesary to call make_single_ref
template<class T>
const_reference T3DDatafield< T >::operator[] ( int  i) const
inline

a linear read only access operator

Definition at line 413 of file 3d/datafield.hh.

template<class T>
reference T3DDatafield< T >::operator[] ( int  i)
inline

A linear read/write access operator. The refcount of Data must be 1, else the program will abort with a failed assertion (if assert is enabled)

Definition at line 421 of file 3d/datafield.hh.

template<class T>
void T3DDatafield< T >::put_data_line_x ( int  y,
int  z,
const std::vector< T > &  buffer 
)

Put some Data along some line parallel to X axis

template<class T>
void T3DDatafield< T >::put_data_line_y ( int  x,
int  z,
const std::vector< T > &  buffer 
)

Put some Data along some line parallel to Y axis

template<class T>
void T3DDatafield< T >::put_data_line_z ( int  x,
int  y,
const std::vector< T > &  buffer 
)

Put some Data along some line parallel to Z axis

template<class T>
void T3DDatafield< T >::put_data_plane_xy ( size_t  z,
const T2DDatafield< T > &  p 
)

write a z-plane to the 3D data set.

Parameters
z
pplane data, must be of dimensions (size.x, size.y)
template<class T>
void T3DDatafield< T >::put_data_plane_xz ( size_t  y,
const T2DDatafield< T > &  p 
)

write a y-plane to the 3D data set.

Parameters
y
pplane data, must be of dimensions (size.x, size.z)
template<class T>
void T3DDatafield< T >::put_data_plane_yz ( size_t  x,
const T2DDatafield< T > &  p 
)

write a x-plane to the 3D data set.

Parameters
x
pplane data, must be of dimensions (size.y, size.z)
template<class T>
void T3DDatafield< T >::read_xslice_flat ( size_t  x,
std::vector< atomic_type > &  buffer 
) const

Read the a x-slice of the data field into a flat buffer - i.e. the information about multi-dimensionality of the elements is lost. For this to work, T has to be a POD-like data type, i.e., it has no hidden elements like a virtual methods table, and, if T is a type of more then one element, all these elements have to be of the same type. Specifically, a specialization of the trait atomic_data for T must exists.

Parameters
xslice to be read
[out]bufferBuffer where the data will be written to. It must large enough to hold size.y * size.z * number of elements
template<class T>
void T3DDatafield< T >::read_yslice_flat ( size_t  y,
std::vector< atomic_type > &  buffer 
) const

Read the a y-slice of the data field into a flat buffer - i.e. the information about multi-dimensionality of the elements is lost. For this to work, T has to be a POD-like data type, i.e., it has no hidden elements like a virtual methods table, and, if T is a type of more then one element, all these elements have to be of the same type. Specifically, a specialization of the trait atomic_data for T must exists.

Parameters
yslice to be read
[out]bufferBuffer where the data will be written to. It must large enough to hold size.x * size.z * number of elements
template<class T>
void T3DDatafield< T >::read_zslice_flat ( size_t  z,
std::vector< atomic_type > &  buffer 
) const

Read the a z-slice of the data field into a flat buffer - i.e. the information about multi-dimensionality of the elements is lost. For this to work, T has to be a POD-like data type, i.e., it has no hidden elements like a virtual methods table, and, if T is a type of more then one element, all these elements have to be of the same type. Specifically, a specialization of the trait atomic_data for T must exists.

Parameters
zslice to be read
[out]bufferBuffer where the data will be written to. It must large enough to hold size.x * size.y * number of elements
template<class T>
size_type T3DDatafield< T >::size ( ) const
inline
Returns
the number of elements in the datafield

Definition at line 161 of file 3d/datafield.hh.

template<class T>
value_type T3DDatafield< T >::strip_avg ( )

Strip average from data

Returns
the stripped average
template<class T>
void T3DDatafield< T >::swap ( T3DDatafield< T > &  other)

swap the data ofthis 3DDatafield with another one

template<class T>
void T3DDatafield< T >::write_xslice_flat ( size_t  x,
const std::vector< atomic_type > &  buffer 
)

Write a x-slice from a flat buffer to the 3D data field. For details see void read_yslice_flat(size_t x, std::vector<atomic_type>& buffer) const;

template<class T>
void T3DDatafield< T >::write_yslice_flat ( size_t  y,
const std::vector< atomic_type > &  buffer 
)

Write a y-slice from a flat buffer to the 3D data field. For details see void read_yslice_flat(size_t y, std::vector<atomic_type>& buffer) const;

template<class T>
void T3DDatafield< T >::write_zslice_flat ( size_t  z,
const std::vector< atomic_type > &  buffer 
)

Write a z-slice from a flat buffer to the 3D data field. For details see void read_zslice_flat(size_t z, std::vector<atomic_type>& buffer) const;


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