ISIS Core Library 0.7.2 (api 3.0.0)
|
Main class for four-dimensional random-access data blocks. More...
#include <chunk.hpp>
Public Types | |
typedef ValueArrayBase::const_value_iterator | const_iterator |
typedef const_iterator::reference | const_reference |
typedef ValueArrayBase::value_iterator | iterator |
typedef iterator::reference | reference |
Public Member Functions | |
template<typename TYPE > | |
ValueArray< TYPE > & | asValueArray () |
ValueArrayBase & | asValueArrayBase () |
std::list< Chunk > | autoSplice (uint32_t acquisitionNumberStride=0) const |
Splices the chunk at the uppermost dimension and automatically sets indexOrigin and acquisitionNumber appropriately. | |
const_iterator | begin () const |
iterator | begin () |
Chunk (const isis::data::ValueArrayReference &src, size_t nrOfColumns, size_t nrOfRows=1, size_t nrOfSlices=1, size_t nrOfTimesteps=1, bool fakeValid=false) | |
Chunk | cloneToNew (size_t nrOfColumns, size_t nrOfRows=1, size_t nrOfSlices=1, size_t nrOfTimesteps=1) const |
Creates a new empty Chunk of different size and without properties, but of the same datatype as this. | |
size_t | compare (const Chunk &dst) const |
size_t | compareRange (const size_t source_start[], const size_t source_end[], const Chunk &dst, const size_t destination[]) const |
bool | convertToType (short unsigned int ID, scaling_pair scaling=scaling_pair()) |
Ensure, the chunk has the type with the requested ID. | |
Chunk | copyByID (unsigned short ID=0, scaling_pair scaling=scaling_pair()) const |
Create a new Chunk of the requested type and copy all voxel data of the chunk into it. | |
void | copyRange (const size_t source_start[], const size_t source_end[], Chunk &dst, const size_t destination[]) const |
void | copySlice (size_t thirdDimS, size_t fourthDimS, Chunk &dst, size_t thirdDimD, size_t fourthDimD) const |
template<typename T > | |
bool | copyToMem (T *dst, size_t len, scaling_pair scaling=scaling_pair()) const |
Copy all voxel data of the chunk into memory. | |
iterator | end () |
const_iterator | end () const |
template<typename TYPE > | |
size_t | foreachVoxel (VoxelOp< TYPE > &op) |
Run a functor on every Voxel in the chunk. | |
template<typename TYPE > | |
size_t | foreachVoxel (VoxelOp< TYPE > &op, util::vector4< size_t > offset) |
Run a functor on every Voxel in the chunk. | |
size_t | getBytesPerVoxel () const |
std::pair < util::ValueReference, util::ValueReference > | getMinMax () const |
scaling_pair | getScalingTo (unsigned short typeID, autoscaleOption scaleopt=autoscale) const |
get the scaling (and offset) which would be used in an conversion to the given type | |
scaling_pair | getScalingTo (unsigned short typeID, const std::pair< util::ValueReference, util::ValueReference > &minmax, autoscaleOption scaleopt=autoscale) const |
unsigned short | getTypeID () const |
std::string | getTypeName () const |
template<typename TYPE > | |
const ValueArray< TYPE > | getValueArray () const |
const ValueArrayBase & | getValueArrayBase () const |
const util::ValueReference | getVoxelValue (size_t nrOfColumns, size_t nrOfRows=0, size_t nrOfSlices=0, size_t nrOfTimesteps=0) const |
template<typename T > | |
bool | is () const |
Chunk & | operator= (const Chunk &ref) |
util::PropertyValue & | propertyValueAt (const util::PropertyMap::KeyType &key, size_t at) |
Access properties of the next lower dimension (e.g. | |
const util::PropertyValue & | propertyValueAt (const util::PropertyMap::KeyType &key, size_t at) const |
void | setVoxelValue (const util::ValueReference &val, size_t nrOfColumns, size_t nrOfRows=0, size_t nrOfSlices=0, size_t nrOfTimesteps=0) |
std::list< Chunk > | splice (dimensions atDim) const |
Splices the chunk at the given dimension and all dimensions above. | |
void | swapAlong (const dimensions dim) const |
Swaps the image along a dimension dim in image space. | |
bool | transformCoords (boost::numeric::ublas::matrix< float > transform_matrix, bool transformCenterIsImageCenter=false) |
Transforms the image coordinate system into an other system by multiplying the orientation matrix with a user defined transformation matrix. | |
size_t | useCount () const |
template<typename TYPE > | |
const TYPE & | voxel (size_t nrOfColumns, size_t nrOfRows=0, size_t nrOfSlices=0, size_t nrOfTimesteps=0) const |
Gets a const reference of the element at a given index. | |
template<typename TYPE > | |
TYPE & | voxel (size_t nrOfColumns, size_t nrOfRows=0, size_t nrOfSlices=0, size_t nrOfTimesteps=0) |
Gets a reference to the element at a given index. | |
Static Public Member Functions | |
static Chunk | createByID (short unsigned int ID, size_t nrOfColumns, size_t nrOfRows=1, size_t nrOfSlices=1, size_t nrOfTimesteps=1, bool fakeValid=false) |
Creates a new empty Chunk without properties but of specified type and specified size. | |
Protected Member Functions | |
template<typename TYPE , typename D > | |
Chunk (TYPE *src, D d, size_t nrOfColumns, size_t nrOfRows=1, size_t nrOfSlices=1, size_t nrOfTimesteps=1) | |
Creates an data-block from existing data. | |
Chunk () | |
Friends | |
class | Image |
class | std::vector< Chunk > |
Main class for four-dimensional random-access data blocks.
Like in ValueArray, the copy of a Chunk will reference the same data. (cheap copy) (If you want to make a memory based deep copy of a Chunk create a MemChunk from it)
typedef const_iterator::reference isis::data::Chunk::const_reference |
typedef iterator::reference isis::data::Chunk::reference |
isis::data::Chunk::Chunk | ( | TYPE * | src, |
D | d, | ||
size_t | nrOfColumns, | ||
size_t | nrOfRows = 1 , |
||
size_t | nrOfSlices = 1 , |
||
size_t | nrOfTimesteps = 1 |
||
) | [inline, protected] |
Creates an data-block from existing data.
src | is a pointer to the existing data. This data will automatically be deleted. So don't use this pointer afterwards. |
d | is the deleter to be used for deletion of src. It must define operator(TYPE *), which than shall free the given pointer. |
nrOfColumns | size in the first dimension (usually read-encoded dim) |
nrOfRows | size in the second dimension (usually phase-encoded dim) |
nrOfSlices | size in the third dimension (usually slice-encoded dim) |
nrOfTimesteps | size in the fourth dimension |
_internal isis::data::Chunk::Chunk | ( | const isis::data::ValueArrayReference & | src, |
size_t | nrOfColumns, | ||
size_t | nrOfRows = 1 , |
||
size_t | nrOfSlices = 1 , |
||
size_t | nrOfTimesteps = 1 , |
||
bool | fakeValid = false |
||
) |
ValueArray<TYPE>& isis::data::Chunk::asValueArray | ( | ) | [inline] |
ValueArrayBase& isis::data::Chunk::asValueArrayBase | ( | ) | [inline] |
std::list< Chunk > isis::data::Chunk::autoSplice | ( | uint32_t | acquisitionNumberStride = 0 | ) | const |
Splices the chunk at the uppermost dimension and automatically sets indexOrigin and acquisitionNumber appropriately.
This automatically selects the upermost dimension of the chunk to be spliced and will compute the correct offsets for indexOrigin and acquisitionNumberOffset which will be applied to the resulting splices.
E.g. autoSplice() on a chunk of the size 512x512x128, with rowVec 1,0,0, columnVec 0,1,0 and indexOrigin 0,0,0 will result in 128 chunks of the size 512x512x1, with constant rowVec's 1,0,0, and columnVec's 0,1,0 while the indexOrigin will be going from 0,0,0 to 0,0,128 (If voxelSize is 1,1,1 and voxelGap is 0,0,0). The acquisitionNumber will be reset to a simple incrementing counter starting at acquisitionNumberOffset.
Chunk::const_iterator isis::data::Chunk::begin | ( | ) | const |
Chunk::iterator isis::data::Chunk::begin | ( | ) |
Chunk isis::data::Chunk::cloneToNew | ( | size_t | nrOfColumns, |
size_t | nrOfRows = 1 , |
||
size_t | nrOfSlices = 1 , |
||
size_t | nrOfTimesteps = 1 |
||
) | const |
size_t isis::data::Chunk::compare | ( | const Chunk & | dst | ) | const |
size_t isis::data::Chunk::compareRange | ( | const size_t | source_start[], |
const size_t | source_end[], | ||
const Chunk & | dst, | ||
const size_t | destination[] | ||
) | const |
bool isis::data::Chunk::convertToType | ( | short unsigned int | ID, |
scaling_pair | scaling = scaling_pair() |
||
) |
Chunk isis::data::Chunk::copyByID | ( | unsigned short | ID = 0 , |
scaling_pair | scaling = scaling_pair() |
||
) | const |
Create a new Chunk of the requested type and copy all voxel data of the chunk into it.
If neccessary a conversion into the requested type is done using the given scale.
ID | the ID of the requested type (type of the source is used if not given) |
scaling | the scaling to be used when converting the data (will be determined automatically if not given) |
void isis::data::Chunk::copyRange | ( | const size_t | source_start[], |
const size_t | source_end[], | ||
Chunk & | dst, | ||
const size_t | destination[] | ||
) | const |
void isis::data::Chunk::copySlice | ( | size_t | thirdDimS, |
size_t | fourthDimS, | ||
Chunk & | dst, | ||
size_t | thirdDimD, | ||
size_t | fourthDimD | ||
) | const |
bool isis::data::Chunk::copyToMem | ( | T * | dst, |
size_t | len, | ||
scaling_pair | scaling = scaling_pair() |
||
) | const [inline] |
Copy all voxel data of the chunk into memory.
If neccessary a conversion into T is done using min/max of the image.
dst | c-pointer for the memory to copy into |
len | the allocated size of that memory in elements |
scaling | the scaling to be used when converting the data (will be determined automatically if not given) |
static Chunk isis::data::Chunk::createByID | ( | short unsigned int | ID, |
size_t | nrOfColumns, | ||
size_t | nrOfRows = 1 , |
||
size_t | nrOfSlices = 1 , |
||
size_t | nrOfTimesteps = 1 , |
||
bool | fakeValid = false |
||
) | [static] |
Creates a new empty Chunk without properties but of specified type and specified size.
Chunk::iterator isis::data::Chunk::end | ( | ) |
Chunk::const_iterator isis::data::Chunk::end | ( | ) | const |
size_t isis::data::Chunk::foreachVoxel | ( | VoxelOp< TYPE > & | op, |
util::vector4< size_t > | offset | ||
) | [inline] |
Run a functor on every Voxel in the chunk.
If the data of the chunk are not of type TYPE, behaviour is undefined. (If _DEBUG_LOG is enabled you will get an error message before the progrmm will crash).
op | a functor inheriting from VoxelOp |
offset | offset to be added to the voxel position before op is called |
size_t isis::data::Chunk::foreachVoxel | ( | VoxelOp< TYPE > & | op | ) | [inline] |
std::pair< util::ValueReference, util::ValueReference > isis::data::Chunk::getMinMax | ( | ) | const |
scaling_pair isis::data::Chunk::getScalingTo | ( | unsigned short | typeID, |
autoscaleOption | scaleopt = autoscale |
||
) | const |
scaling_pair isis::data::Chunk::getScalingTo | ( | unsigned short | typeID, |
const std::pair< util::ValueReference, util::ValueReference > & | minmax, | ||
autoscaleOption | scaleopt = autoscale |
||
) | const |
const ValueArray<TYPE> isis::data::Chunk::getValueArray | ( | ) | const [inline] |
const ValueArrayBase& isis::data::Chunk::getValueArrayBase | ( | ) | const [inline] |
const util::ValueReference isis::data::Chunk::getVoxelValue | ( | size_t | nrOfColumns, |
size_t | nrOfRows = 0 , |
||
size_t | nrOfSlices = 0 , |
||
size_t | nrOfTimesteps = 0 |
||
) | const |
bool isis::data::Chunk::is | ( | ) | const [inline] |
Reimplemented in isis::data::MemChunk< TYPE >, and isis::data::MemChunkNonDel< TYPE >.
const util::PropertyValue & isis::data::Chunk::propertyValueAt | ( | const util::PropertyMap::KeyType & | key, |
size_t | at | ||
) | const |
Access properties of the next lower dimension (e.g.
slice-timings in volumes) This is there for effiency on IO only (you don't have to split up chunks just to store some properties). It will be resolved by reindexing anyway. So, in an clean Image Chunks will never have such sub-properties.
util::PropertyValue & isis::data::Chunk::propertyValueAt | ( | const util::PropertyMap::KeyType & | key, |
size_t | at | ||
) |
Access properties of the next lower dimension (e.g.
slice-timings in volumes) This is there for effiency on IO only (you don't have to split up chunks just to store some properties). It will be resolved by reindexing anyway. So, in an clean Image Chunks will never have such sub-properties.
void isis::data::Chunk::setVoxelValue | ( | const util::ValueReference & | val, |
size_t | nrOfColumns, | ||
size_t | nrOfRows = 0 , |
||
size_t | nrOfSlices = 0 , |
||
size_t | nrOfTimesteps = 0 |
||
) |
std::list< Chunk > isis::data::Chunk::splice | ( | dimensions | atDim | ) | const |
Splices the chunk at the given dimension and all dimensions above.
As this will not set or use any property
void isis::data::Chunk::swapAlong | ( | const dimensions | dim | ) | const |
bool isis::data::Chunk::transformCoords | ( | boost::numeric::ublas::matrix< float > | transform_matrix, |
bool | transformCenterIsImageCenter = false |
||
) | [inline] |
Transforms the image coordinate system into an other system by multiplying the orientation matrix with a user defined transformation matrix.
Additionally, the index origin will be transformed into the new coordinate system. This function only changes the
IMPORTANT!: If you call this function with a matrix other than the identidy matrix, it's not guaranteed that the image is still in ISIS space according to the DICOM conventions. Maybe some ISIS algorithms that depend on correct image orientations won't work as expected. Use this method with caution!
size_t isis::data::Chunk::useCount | ( | ) | const |
const TYPE& isis::data::Chunk::voxel | ( | size_t | nrOfColumns, |
size_t | nrOfRows = 0 , |
||
size_t | nrOfSlices = 0 , |
||
size_t | nrOfTimesteps = 0 |
||
) | const [inline] |
TYPE& isis::data::Chunk::voxel | ( | size_t | nrOfColumns, |
size_t | nrOfRows = 0 , |
||
size_t | nrOfSlices = 0 , |
||
size_t | nrOfTimesteps = 0 |
||
) | [inline] |