T3DDatafield< T > Class Template Reference

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

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

Inheritance diagram for T3DDatafield< T >:
[legend]

Data Structures

class  ConstRange
 
class  Range
 a shortcut data type More...
 

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
 
range_iterator_with_boundary_flag begin_range_with_boundary_flags (const C3DBounds &begin, const C3DBounds &end)
 
const_range_iterator_with_boundary_flag begin_range_with_boundary_flags (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
 
range_iterator_with_boundary_flag end_range_with_boundary_flags (const C3DBounds &begin, const C3DBounds &end)
 
const_range_iterator_with_boundary_flag end_range_with_boundary_flags (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 __attribute__((deprecated))
 
size_t get_plane_size_xy () const
 
Range get_range (const C3DBounds &start, const C3DBounds &end)
 
ConstRange get_range (const C3DBounds &start, const C3DBounds &end) const
 
const C3DBoundsget_size () const
 
bool holds_unique_data () const __attribute__((deprecated))
 
void make_single_ref () __attribute__((deprecated))
 
template<class TMask >
void mask (const TMask &m)
 
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)
 
T3DDatafieldoperator= (T3DDatafield &&org)
 Moave asignment. More...
 
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 ()
 
 T3DDatafield (const C3DBounds &_Size)
 
 T3DDatafield (const C3DBounds &size, const T *data)
 
 T3DDatafield (const C3DBounds &size, const data_array &data)
 
 T3DDatafield (const T3DDatafield< T > &org)
 
 T3DDatafield (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 82 of file 3d/datafield.hh.

Constructor & Destructor Documentation

◆ T3DDatafield() [1/6]

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

◆ T3DDatafield() [2/6]

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

Constructor to create empty Datafield if given size

◆ T3DDatafield() [3/6]

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

◆ T3DDatafield() [4/6]

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

Constructor to create Datafield if given size and with initialization data

Parameters
sizethe size of the 3D-field
datato use for initialization

◆ T3DDatafield() [5/6]

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

copy - Constructor

◆ T3DDatafield() [6/6]

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

move constructor

◆ ~T3DDatafield()

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

make sure the destructor is virtual

Member Function Documentation

◆ begin() [1/2]

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

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

Referenced by T3DDatafield< C3DFVector >::begin().

◆ begin() [2/2]

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 441 of file 3d/datafield.hh.

◆ begin_at() [1/2]

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 424 of file 3d/datafield.hh.

Referenced by FDeformer3D::operator()().

◆ begin_at() [2/2]

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 488 of file 3d/datafield.hh.

◆ begin_range() [1/2]

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

Referenced by T3DDatafield< C3DFVector >::begin().

◆ begin_range() [2/2]

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

◆ begin_range_with_boundary_flags() [1/2]

template<class T>
range_iterator_with_boundary_flag T3DDatafield< T >::begin_range_with_boundary_flags ( const C3DBounds begin,
const C3DBounds end 
)
Returns
an read/write forward iterator over a subset of the data with indicator for the boundaries.

Referenced by T3DDatafield< C3DFVector >::begin().

◆ begin_range_with_boundary_flags() [2/2]

template<class T>
const_range_iterator_with_boundary_flag T3DDatafield< T >::begin_range_with_boundary_flags ( const C3DBounds begin,
const C3DBounds end 
) const
Returns
an read/write forward iterator over a subset of the data with indicator for the boundaries.

◆ clear()

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

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

Referenced by T3DDatafield< C3DFVector >::get_size().

◆ end() [1/2]

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

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

Referenced by T3DDatafield< C3DFVector >::begin().

◆ end() [2/2]

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 496 of file 3d/datafield.hh.

◆ end_range() [1/2]

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.

Referenced by T3DDatafield< C3DFVector >::begin().

◆ end_range() [2/2]

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.

◆ end_range_with_boundary_flags() [1/2]

template<class T>
range_iterator_with_boundary_flag T3DDatafield< T >::end_range_with_boundary_flags ( const C3DBounds begin,
const C3DBounds end 
)
Returns
the end of a read/write forward iterator over a subset of the data with indicator for the boundaries.

Referenced by T3DDatafield< C3DFVector >::begin().

◆ end_range_with_boundary_flags() [2/2]

template<class T>
const_range_iterator_with_boundary_flag T3DDatafield< T >::end_range_with_boundary_flags ( const C3DBounds begin,
const C3DBounds end 
) const
Returns
the end of a read/write forward iterator over a subset of the data with indicator for the boundaries.

◆ get_avg()

template<class T>
value_type T3DDatafield< T >::get_avg ( )
Returns
the average over the whole datafield

Referenced by T3DDatafield< C3DFVector >::size().

◆ get_block_avrg()

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

◆ get_data_line_x()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ get_data_line_y()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ get_data_line_z()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ get_data_plane_xy()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ get_data_plane_xz()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ get_data_plane_yz()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ get_gradient() [1/4]

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 637 of file 3d/datafield.hh.

◆ get_gradient() [2/4]

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 589 of file 3d/datafield.hh.

◆ get_gradient() [3/4]

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 609 of file 3d/datafield.hh.

◆ get_gradient() [4/4]

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

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

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

◆ get_interpol_val_at()

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

Referenced by T3DVectorfield< C3DFVector >::set_voxel_size().

◆ get_plane_size_xy()

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

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

◆ get_range() [1/2]

template<class T>
Range T3DDatafield< T >::get_range ( const C3DBounds start,
const C3DBounds end 
)

◆ get_range() [2/2]

template<class T>
ConstRange T3DDatafield< T >::get_range ( const C3DBounds start,
const C3DBounds end 
) const

◆ get_size()

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

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

Referenced by FDeformer3D::operator()().

◆ holds_unique_data()

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 97 of file 3d/datafield.hh.

◆ make_single_ref()

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

◆ mask()

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

Mask the data field with a given mask

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ operator()() [1/4]

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 256 of file 3d/datafield.hh.

◆ operator()() [2/4]

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

alternate read-only indx operator

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

◆ operator()() [3/4]

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 273 of file 3d/datafield.hh.

◆ operator()() [4/4]

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

Alternate index operator witch gives write access

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Moave asignment.

◆ operator[]() [1/2]

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

a linear read only access operator

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

◆ operator[]() [2/2]

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 510 of file 3d/datafield.hh.

◆ put_data_line_x()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ put_data_line_y()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ put_data_line_z()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ put_data_plane_xy()

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)

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ put_data_plane_xz()

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)

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ put_data_plane_yz()

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)

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ read_xslice_flat()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ read_yslice_flat()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ read_zslice_flat()

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

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ size()

template<class T>
size_type T3DDatafield< T >::size ( ) const
inline
Returns
the number of elements in the datafield

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

◆ strip_avg()

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

Strip average from data

Returns
the stripped average

Referenced by T3DDatafield< C3DFVector >::size().

◆ swap()

template<class T>
void T3DDatafield< T >::swap ( T3DDatafield< T > &  other)

swap the data ofthis 3DDatafield with another one

Referenced by T3DDatafield< C3DFVector >::size().

◆ write_xslice_flat()

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;

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ write_yslice_flat()

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;

Referenced by T3DDatafield< C3DFVector >::operator()().

◆ write_zslice_flat()

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;

Referenced by T3DDatafield< C3DFVector >::operator()().


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