12#ifndef BUFFEREDHUVOLUME_H_6014714286
13#define BUFFEREDHUVOLUME_H_6014714286
48template<
typename VoxelType,
typename BufferType >
101 return (
static_cast< VoxelType
>(
huValue + 1024 ) << (
sizeof( VoxelType ) * 8 - 12 ) );
109 ,
unsigned int z )
const
111 const std::size_t index = x +
size.x() * y +
size.y() *
size.x() * z;
120 return ( *
this )(
at.x(),
at.y(),
at.z() );
129 const std::size_t index = x +
size.x() * y +
size.y() *
size.x() * z;
168 const std::unique_ptr< Association< BufferType > >
myBuffer;
172 void initializeBuffer()
176 ,
"No volume data buffer supplied!" );
180 ,
"Supplied volume data buffer is of size "
182 <<
" bytes but must be at least "
Defines Carna::base::CarnaException, Carna::base::AssertionFailure.
#define CARNA_ASSERT_EX(expression, description)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
#define CARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Defines Carna::base::Composition.
Defines Carna::base::HUVolume.
Represents an association.
AssociatedObjectType * get() const
Returns raw pointer to the referenced object.
Implements HUVolume generically for a particular VoxelType.
HUV operator()(unsigned int x, unsigned int y, unsigned int z) const
Returns HUV of specified voxel.
void setVoxel(const math::Vector3ui &at, HUV huv)
Sets the HUV of a voxel.
HUV operator()(const math::Vector3ui &at) const
Returns HUV of specified voxel.
const std::unique_ptr< Association< BufferType > > myBuffer
Holds the underlying buffer.
BufferedHUVolume(const math::Vector3ui &size, Association< BufferType > *buffer)
Instantiates with , where is size.
BufferType Buffer
Holds the used buffer type.
static HUV bufferValueToHUV(VoxelType bufferValue)
Returns the HU value corresponding to bufferValue.
VoxelType Voxel
Holds the type used to store the value of a single voxel.
void setVoxel(unsigned int x, unsigned int y, unsigned int z, HUV huv)
Sets the HUV of a voxel.
BufferedHUVolume(const math::Vector3ui &size)
static VoxelType HUVToBufferValue(HUV huValue)
Returns the buffer value corresponding to huValue.
const BufferType & buffer() const
References the underlying buffer.
BufferType & buffer()
References the underlying buffer.
Represents a composition, i.e. a strong reference. This basically is a std::unique_ptr that supports ...
Defines interface to volumetric data.
math::Vector3ui size
Holds the resolution.
Eigen::Matrix< unsigned int, 3, 1 > Vector3ui
Defines vector.
static HUV abs(T value)
Wraps an absolute HU value.