|
cgv
|
the ooc_sliced_volume data structure allows random access to a volume that is stored as per slice file on disk. More...
#include <sliced_volume.h>
Public Member Functions | |
| std::string | get_slice_file_name (int i) const |
| unsigned | get_nr_slices () const |
| dimension_type | get_dimensions () const |
| overload to compose dimensions from slice format and number dimensions | |
| void | resize (const dimension_type &S) |
| resize the data view to hold a slice and set the total number of slices as well | |
| bool | open_read (const std::string &file_name) |
| open for read | |
| bool | is_open () const |
| bool | read_slice (int i, const std::string &slice_file_name="") |
| bool | open_write (const std::string &file_name, const std::string &_file_name_pattern, unsigned nr_slices) |
| open for write, set the data format to the slice format (width, height, components, component type) before calling this function | |
| bool | write_slice (int i) const |
| set the content of the data view through ref_data | |
| void | close () |
Public Member Functions inherited from cgv::media::volume::volume | |
| 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_format & | get_format () const |
| return const reference to data format | |
| cgv::data::data_format & | get_format () |
| return reference to data format | |
| 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 | |
| size_t | get_nr_voxels () const |
| return the total number of voxels | |
| 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_type & | get_extent () const |
| return const reference to spatial extent | |
| extent_type & | ref_extent () |
| return reference spacing | |
| extent_type | get_spacing () const |
| return the voxel spacing, computed by extent/dimensions | |
| const cgv::data::data_view & | get_data_view () const |
| return a const reference to the data view | |
| cgv::data::data_view & | get_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 > | |
| T | get_voxel_component (unsigned i, unsigned j, unsigned k, unsigned ci=0) |
| return a voxel component converted to type T | |
| 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 | |
Public Attributes | |
| unsigned | nr_slices |
| unsigned | offset |
| std::string | file_name_pattern |
Additional Inherited Members | |
Public Types inherited from cgv::media::volume::volume | |
| 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 |
Protected Attributes inherited from cgv::media::volume::volume | |
| 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 | |
the ooc_sliced_volume data structure allows random access to a volume that is stored as per slice file on disk.
The data structure keeps a data format and a data view inherited from the base class volume and uses it to store a single slice.
Definition at line 16 of file sliced_volume.h.
| cgv::media::volume::ooc_sliced_volume::ooc_sliced_volume | ( | ) |
Definition at line 18 of file sliced_volume.cxx.
| void cgv::media::volume::ooc_sliced_volume::close | ( | ) |
Definition at line 171 of file sliced_volume.cxx.
|
virtual |
overload to compose dimensions from slice format and number dimensions
Reimplemented from cgv::media::volume::volume.
Definition at line 24 of file sliced_volume.cxx.
References cgv::media::volume::volume::df, cgv::data::data_format::get_height(), cgv::data::data_format::get_nr_dimensions(), and cgv::data::data_format::get_width().
| unsigned cgv::media::volume::ooc_sliced_volume::get_nr_slices | ( | ) | const |
Definition at line 106 of file sliced_volume.cxx.
| std::string cgv::media::volume::ooc_sliced_volume::get_slice_file_name | ( | int | i | ) | const |
Definition at line 42 of file sliced_volume.cxx.
| bool cgv::media::volume::ooc_sliced_volume::is_open | ( | ) | const |
Definition at line 101 of file sliced_volume.cxx.
| bool cgv::media::volume::ooc_sliced_volume::open_read | ( | const std::string & | file_name | ) |
open for read
Definition at line 52 of file sliced_volume.cxx.
References cgv::media::volume::volume::df, cgv::media::volume::volume::extent, cgv::data::data_format::set_component_format(), cgv::data::data_format::set_height(), cgv::data::data_format::set_nr_dimensions(), and cgv::data::data_format::set_width().
| bool cgv::media::volume::ooc_sliced_volume::open_write | ( | const std::string & | file_name, |
| const std::string & | _file_name_pattern, | ||
| unsigned | nr_slices | ||
| ) |
open for write, set the data format to the slice format (width, height, components, component type) before calling this function
Definition at line 79 of file sliced_volume.cxx.
| bool cgv::media::volume::ooc_sliced_volume::read_slice | ( | int | i, |
| const std::string & | slice_file_name = "" |
||
| ) |
Definition at line 111 of file sliced_volume.cxx.
|
virtual |
resize the data view to hold a slice and set the total number of slices as well
Reimplemented from cgv::media::volume::volume.
Definition at line 33 of file sliced_volume.cxx.
References cgv::media::volume::volume::df, cgv::media::volume::volume::dv, cgv::data::data_format::set_height(), and cgv::data::data_format::set_width().
| bool cgv::media::volume::ooc_sliced_volume::write_slice | ( | int | i | ) | const |
set the content of the data view through ref_data
Definition at line 154 of file sliced_volume.cxx.
References cgv::media::image::image_writer::close(), cgv::media::volume::volume::dv, and cgv::media::image::image_writer::write_image().
| std::string cgv::media::volume::ooc_sliced_volume::file_name_pattern |
Definition at line 21 of file sliced_volume.h.
| unsigned cgv::media::volume::ooc_sliced_volume::nr_slices |
Definition at line 19 of file sliced_volume.h.
| unsigned cgv::media::volume::ooc_sliced_volume::offset |
Definition at line 20 of file sliced_volume.h.