![]() |
Seg3D
2.4
Seg3D is a free volume segmentation and processing tool developed by the NIH Center for Integrative Biomedical Computing at the University of Utah Scientific Computing and Imaging (SCI) Institute.
|
#include <DataBlock.h>
Public Types | |
typedef long long | generation_type |
typedef int | index_type |
![]() | |
typedef boost::shared_mutex | mutex_type |
typedef boost::unique_lock< mutex_type > | lock_type |
typedef boost::shared_lock< mutex_type > | shared_lock_type |
typedef boost::upgrade_lock< mutex_type > | upgrade_lock_type |
typedef boost::upgrade_to_unique_lock< mutex_type > | upgrade_to_unique_lock_type |
Public Member Functions | |
size_t | get_nx () const |
Get the number of samples in the x direction. | |
size_t | get_ny () const |
Get the number of samples in the y direction. | |
size_t | get_nz () const |
Get the number of samples in the z direction. | |
size_t | get_size () const |
Get the total number of samples. | |
size_t | get_elem_size () const |
Get the size of the data elements. | |
size_t | get_byte_size () const |
Get the size in bytes. | |
index_type | to_index (index_type x, index_type y, index_type z) const |
Compute the real index based on the coordinates in index space. | |
void | from_index (index_type index, index_type &x, index_type &y, index_type &z) const |
Compute the index components from the actual index. | |
DataType | get_data_type () const |
The type of the data. | |
void * | get_data () |
Pointer to the block of data. | |
double | get_data_at (index_type x, index_type y, index_type z) const |
Get data at a certain location in the data block. | |
double | get_data_at (index_type index) const |
Get data at a certain index location in the data block. | |
void | set_data_at (index_type x, index_type y, index_type z, double value) |
Set data at a certain location in the data block. | |
void | set_data_at (index_type index, double value) |
Set data at a certain index location in the data block. | |
void | clear () |
Clear the data inside the data block. | |
double | get_max () const |
double | get_min () const |
double | get_range () const |
const Histogram & | get_histogram () const |
Get the histogram of the underlying data. | |
bool | update_histogram () |
Recompute the histogram. This needs to be triggered each time the data is updated. | |
void | update_data_type (DataType type) |
generation_type | get_generation () const |
Get the current generation number of the data volume. | |
void | increase_generation () |
void | set_histogram (const Histogram &histogram) |
Set the histogram of the dataset. | |
void | swap_endian () |
Swap the endianess of the data. | |
void | set_data (void *data) |
Set the data pointer of the data. | |
bool | insert_slice (const DataSliceHandle slice) |
Insert slice into the datablock. | |
bool | extract_slice (SliceType type, index_type index, DataSliceHandle &slice) |
Extract a slice from the datablock. | |
![]() | |
mutex_type & | get_mutex () const |
Static Public Member Functions | |
static bool | ConvertDataType (const DataBlockHandle &src_data_block, DataBlockHandle &dst_data_block, DataType new_data_type) |
Convert the data to a specific format. | |
static bool | PermuteData (const DataBlockHandle &src_data_block, DataBlockHandle &dst_data_block, std::vector< int > permutation) |
static bool | QuantizeData (const DataBlockHandle &src_data_block, DataBlockHandle &dst_data_block, DataType new_data_type) |
static bool | Duplicate (const DataBlockHandle &src_data_block, DataBlockHandle &dst_data_block) |
Clone the data in a datablock by generating a new one and copying the data into it. | |
static bool | Pad (DataBlockHandle src_data_block, DataBlockHandle &dst_data_block, int pad=1, double pad_value=0.0) |
static bool | Clip (DataBlockHandle src_data_block, DataBlockHandle &dst_data_block, int width, int height, int depth, double fill_value=0.0) |
static bool | IsBigEndian () |
Check whether current architecture is big endian. | |
static bool | IsLittleEndian () |
Check whether current architecture is little endian. | |
Public Attributes | |
boost::signals2::signal< void()> | data_changed_signal_ |
Triggered when data has been changed. | |
Protected Member Functions | |
void | set_nx (size_t nx) |
Set the dimensions of the datablock. | |
void | set_ny (size_t ny) |
void | set_nz (size_t nz) |
void | set_type (DataType type) |
Set the type of the data. | |
Friends | |
class | DataBlockManager |
This class is an abstract representation of a block of volume data in memory. It stores the pointer to where the data is located as well as its dimensions, and the type of the data NOTE: This is a base class that does not do any memory allocation, use one of the derived classes to generate a datablock. The implementation in this class is just the common access to the data.
typedef long long Core::DataBlock::generation_type |
Generation number for keeping track of unique data snapshots for session/provenance tracking
double Core::DataBlock::get_max | ( | ) | const |
Get the maximum value of the data NOTE: update_histogram needs to be called to ensure the data is accurate
double Core::DataBlock::get_min | ( | ) | const |
Get the minimum value of the data NOTE: update_histogram needs to be called to ensure the data is accurate
double Core::DataBlock::get_range | ( | ) | const |
Get the dynamic range of the data NOTE: update_histogram needs to be called to ensure the data is accurate
void Core::DataBlock::increase_generation | ( | ) |
Increase the generation number to a new unique number. NOTE: THis one does not lock the mutex as the mutex should protect both the data change and the update of the generation atomically.
|
static |
Reorder the data by shuffling the axis, the permutation is a vector of three components that specify -1, 1 , and -2, 2, and -3, 3 for each of the axis, where the negative number indicates an inverted axis.
|
static |
Quantize the data based on its min and max value NOTE: This function assumes that the histogram has been actualized
void Core::DataBlock::update_data_type | ( | DataType | type | ) |
Reset the data type NOTE: this does not do any conversion of the data, hence use this function with care