cgv
Loading...
Searching...
No Matches
cgv::media::volume::volume Class Reference
Inheritance diagram for cgv::media::volume::volume:
cgv::media::volume::ooc_sliced_volume

Public Types

typedef float coord_type
 
typedef cgv::math::fvec< int, 3 > index_type
 
typedef cgv::math::fvec< int, 3 > dimension_type
 
typedef cgv::math::fvec< coord_type, 3 > point_type
 
typedef cgv::math::fvec< coord_type, 3 > extent_type
 
typedef cgv::media::axis_aligned_box< coord_type, 3 > box_type
 

Public Member Functions

 volume ()
 construct empty volume with unit cube as box and "uint8[L]" as component type
 
 volume (const volume &V)
 copy construct volume by allocating a copy of the volume data
 
 ~volume ()
 destruct
 
bool empty () const
 return whether volume is empty
 
void clear ()
 deallocate all memory and reset data format to "uint8[L]"
 
const cgv::data::data_formatget_format () const
 return const reference to data format
 
cgv::data::data_formatget_format ()
 return reference to data format
 
access to voxel format (components and type)
cgv::type::info::TypeId get_component_type () const
 return the component type
 
cgv::data::ComponentFormat get_component_format () const
 return component format
 
void set_component_format (cgv::data::ComponentFormat cf)
 set a different component format
 
void set_component_type (cgv::type::info::TypeId type_id)
 set the value type of the voxel components
 
void set_component_format (const std::string &format)
 set the component format from a string according to the syntax declared in <cgv/data/component_format.h>
 
unsigned get_nr_components () const
 return the number of components within a voxel
 
unsigned get_component_size () const
 return the size of a voxel component in bytes
 
unsigned get_voxel_size () const
 return the size of a voxel in bytes
 
size_t get_row_size () const
 return the size of a row within a slice in bytes
 
size_t get_slice_size () const
 return the size of a slice in bytes
 
size_t get_size () const
 return size of volume in bytes
 
access to sampling resolution
virtual dimension_type get_dimensions () const
 return the dimensions or (0,0,0) if not available
 
size_t get_nr_voxels () const
 return the total number of voxels
 
virtual void resize (const dimension_type &S)
 resize the volume
 
access to extent of volume
box_type get_box () const
 return the bounding box in volume coordinates, which is computed from spacing and dimensions and centered around the origin
 
const extent_typeget_extent () const
 return const reference to spatial extent
 
extent_typeref_extent ()
 return reference spacing
 
extent_type get_spacing () const
 return the voxel spacing, computed by extent/dimensions
 
access to volume data
const cgv::data::data_viewget_data_view () const
 return a const reference to the data view
 
cgv::data::data_viewget_data_view ()
 return a reference to the data view
 
template<typename T >
const T * get_data_ptr () const
 return a const pointer to the data
 
template<typename T >
T * get_data_ptr ()
 return a pointer to the data
 
template<typename T >
const T * get_slice_ptr (unsigned k) const
 return a const pointer to the data of the k-th slice
 
template<typename T >
T * get_slice_ptr (unsigned k)
 return a pointer to the data of the k-th slice
 
template<typename T >
const T * get_row_ptr (unsigned j, unsigned k) const
 return a const pointer to the data of the j-th row in the k-th slice
 
template<typename T >
T * get_row_ptr (unsigned j, unsigned k)
 return a pointer to the data of the j-th row in the k-th slice
 
template<typename T >
const T * get_voxel_ptr (unsigned i, unsigned j, unsigned k) const
 return a const pointer to the component data of voxel (i,j,k)
 
template<typename T >
T * get_voxel_ptr (unsigned i, unsigned j, unsigned k)
 return a pointer to the component data of voxel (i,j,k)
 
template<typename T >
get_voxel_component (unsigned i, unsigned j, unsigned k, unsigned ci=0)
 return a voxel component converted to type T
 
adding and replacing components of volume data
bool add_new_component (data::data_view &component_dv)
 add new component on the end (if result has <=4 components)
 
bool replace_component (unsigned i, data::data_view &component_dv)
 replace the i-th component in the volume data by the given data
 

Protected Attributes

cgv::data::data_format df
 format description of volume data
 
cgv::data::data_view dv
 data storage of volume data
 
extent_type extent
 extent of the volume in each coordinate direction
 

Detailed Description

Definition at line 14 of file volume.h.

Member Typedef Documentation

◆ box_type

Definition at line 22 of file volume.h.

◆ coord_type

typedef float cgv::media::volume::volume::coord_type

Definition at line 17 of file volume.h.

◆ dimension_type

Definition at line 19 of file volume.h.

◆ extent_type

Definition at line 21 of file volume.h.

◆ index_type

Definition at line 18 of file volume.h.

◆ point_type

Definition at line 20 of file volume.h.

Constructor & Destructor Documentation

◆ volume() [1/2]

cgv::media::volume::volume::volume ( )

construct empty volume with unit cube as box and "uint8[L]" as component type

Definition at line 14 of file volume.cxx.

◆ volume() [2/2]

cgv::media::volume::volume::volume ( const volume V)

copy construct volume by allocating a copy of the volume data

Definition at line 19 of file volume.cxx.

References df, dv, cgv::data::data_format::get_nr_bytes(), and cgv::data::data_view_impl< D, P >::get_ptr().

◆ ~volume()

cgv::media::volume::volume::~volume ( )
inline

destruct

Definition at line 36 of file volume.h.

Member Function Documentation

◆ add_new_component()

◆ clear()

void cgv::media::volume::volume::clear ( )
inline

deallocate all memory and reset data format to "uint8[L]"

Definition at line 40 of file volume.h.

◆ empty()

bool cgv::media::volume::volume::empty ( ) const
inline

return whether volume is empty

Definition at line 38 of file volume.h.

◆ get_box()

volume::box_type cgv::media::volume::volume::get_box ( ) const

return the bounding box in volume coordinates, which is computed from spacing and dimensions and centered around the origin

Definition at line 35 of file volume.cxx.

References extent.

◆ get_component_format()

cgv::data::ComponentFormat cgv::media::volume::volume::get_component_format ( ) const
inline

return component format

Definition at line 51 of file volume.h.

References cgv::data::component_format::get_standard_component_format().

◆ get_component_size()

unsigned cgv::media::volume::volume::get_component_size ( ) const
inline

return the size of a voxel component in bytes

Definition at line 61 of file volume.h.

References cgv::type::info::get_type_size().

◆ get_component_type()

cgv::type::info::TypeId cgv::media::volume::volume::get_component_type ( ) const
inline

return the component type

Definition at line 49 of file volume.h.

References cgv::data::component_format::get_component_type().

◆ get_data_ptr() [1/2]

template<typename T >
T * cgv::media::volume::volume::get_data_ptr ( )
inline

return a pointer to the data

Definition at line 105 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_data_ptr() [2/2]

template<typename T >
const T * cgv::media::volume::volume::get_data_ptr ( ) const
inline

return a const pointer to the data

Definition at line 102 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_data_view() [1/2]

cgv::data::data_view & cgv::media::volume::volume::get_data_view ( )
inline

return a reference to the data view

Definition at line 99 of file volume.h.

◆ get_data_view() [2/2]

const cgv::data::data_view & cgv::media::volume::volume::get_data_view ( ) const
inline

return a const reference to the data view

Definition at line 97 of file volume.h.

◆ get_dimensions()

volume::dimension_type cgv::media::volume::volume::get_dimensions ( ) const
virtual

◆ get_extent()

const extent_type & cgv::media::volume::volume::get_extent ( ) const
inline

return const reference to spatial extent

Definition at line 87 of file volume.h.

◆ get_format() [1/2]

cgv::data::data_format & cgv::media::volume::volume::get_format ( )
inline

return reference to data format

Definition at line 44 of file volume.h.

◆ get_format() [2/2]

const cgv::data::data_format & cgv::media::volume::volume::get_format ( ) const
inline

return const reference to data format

Definition at line 42 of file volume.h.

◆ get_nr_components()

unsigned cgv::media::volume::volume::get_nr_components ( ) const
inline

return the number of components within a voxel

Definition at line 59 of file volume.h.

References cgv::data::component_format::get_nr_components().

◆ get_nr_voxels()

std::size_t cgv::media::volume::volume::get_nr_voxels ( ) const

return the total number of voxels

Definition at line 212 of file volume.cxx.

References get_dimensions().

◆ get_row_ptr() [1/2]

template<typename T >
T * cgv::media::volume::volume::get_row_ptr ( unsigned  j,
unsigned  k 
)
inline

return a pointer to the data of the j-th row in the k-th slice

Definition at line 117 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_row_ptr() [2/2]

template<typename T >
const T * cgv::media::volume::volume::get_row_ptr ( unsigned  j,
unsigned  k 
) const
inline

return a const pointer to the data of the j-th row in the k-th slice

Definition at line 114 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_row_size()

size_t cgv::media::volume::volume::get_row_size ( ) const
inline

return the size of a row within a slice in bytes

Definition at line 65 of file volume.h.

References cgv::data::data_format::get_width().

◆ get_size()

size_t cgv::media::volume::volume::get_size ( ) const
inline

return size of volume in bytes

Definition at line 69 of file volume.h.

◆ get_slice_ptr() [1/2]

template<typename T >
T * cgv::media::volume::volume::get_slice_ptr ( unsigned  k)
inline

return a pointer to the data of the k-th slice

Definition at line 111 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_slice_ptr() [2/2]

template<typename T >
const T * cgv::media::volume::volume::get_slice_ptr ( unsigned  k) const
inline

return a const pointer to the data of the k-th slice

Definition at line 108 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_slice_size()

size_t cgv::media::volume::volume::get_slice_size ( ) const
inline

return the size of a slice in bytes

Definition at line 67 of file volume.h.

References cgv::data::data_format::get_height().

◆ get_spacing()

volume::extent_type cgv::media::volume::volume::get_spacing ( ) const

return the voxel spacing, computed by extent/dimensions

Definition at line 41 of file volume.cxx.

References extent, and get_dimensions().

◆ get_voxel_component()

template<typename T >
T cgv::media::volume::volume::get_voxel_component ( unsigned  i,
unsigned  j,
unsigned  k,
unsigned  ci = 0 
)
inline

return a voxel component converted to type T

Definition at line 126 of file volume.h.

References cgv::data::data_view_impl< D, P >::get().

◆ get_voxel_ptr() [1/2]

template<typename T >
T * cgv::media::volume::volume::get_voxel_ptr ( unsigned  i,
unsigned  j,
unsigned  k 
)
inline

return a pointer to the component data of voxel (i,j,k)

Definition at line 123 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_voxel_ptr() [2/2]

template<typename T >
const T * cgv::media::volume::volume::get_voxel_ptr ( unsigned  i,
unsigned  j,
unsigned  k 
) const
inline

return a const pointer to the component data of voxel (i,j,k)

Definition at line 120 of file volume.h.

References cgv::data::data_view_impl< D, P >::get_ptr().

◆ get_voxel_size()

unsigned cgv::media::volume::volume::get_voxel_size ( ) const
inline

return the size of a voxel in bytes

Definition at line 63 of file volume.h.

References cgv::data::data_format::get_component_format(), and cgv::data::component_format::get_entry_size().

◆ ref_extent()

extent_type & cgv::media::volume::volume::ref_extent ( )
inline

return reference spacing

Definition at line 89 of file volume.h.

◆ replace_component()

◆ resize()

void cgv::media::volume::volume::resize ( const dimension_type S)
virtual

◆ set_component_format() [1/2]

void cgv::media::volume::volume::set_component_format ( cgv::data::ComponentFormat  cf)
inline

set a different component format

Definition at line 53 of file volume.h.

References cgv::data::component_format::get_component_type(), and cgv::data::data_format::set_component_format().

◆ set_component_format() [2/2]

void cgv::media::volume::volume::set_component_format ( const std::string &  format)
inline

set the component format from a string according to the syntax declared in <cgv/data/component_format.h>

Definition at line 57 of file volume.h.

References cgv::data::data_format::set_component_format().

◆ set_component_type()

void cgv::media::volume::volume::set_component_type ( cgv::type::info::TypeId  type_id)
inline

set the value type of the voxel components

Definition at line 55 of file volume.h.

References cgv::data::component_format::set_component_type().

Member Data Documentation

◆ df

◆ dv

cgv::data::data_view cgv::media::volume::volume::dv
protected

◆ extent

extent_type cgv::media::volume::volume::extent
protected

extent of the volume in each coordinate direction

Definition at line 29 of file volume.h.

Referenced by get_box(), get_spacing(), and cgv::media::volume::ooc_sliced_volume::open_read().


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