6#ifndef BUFFEREDINTENSITYVOLUME_H_6014714286
7#define BUFFEREDINTENSITYVOLUME_H_6014714286
41template<
typename VoxelType,
typename BufferType >
86 return bufferValue /
static_cast< float >( ( 1 << ( 8 *
sizeof( VoxelType ) ) ) - 1 );
95 const auto valueMax = ( 1 << ( 8 *
sizeof( VoxelType ) ) ) - 1;
98 return static_cast< VoxelType
>( value );
106 ,
unsigned int z )
const
108 const std::size_t index = x +
size.x() * y +
size.y() *
size.x() * z;
116 return ( *
this )(
at.x(),
at.y(),
at.z() );
125 const std::size_t index = x +
size.x() * y +
size.y() *
size.x() * z;
163 const std::unique_ptr< Association< BufferType > >
myBuffer;
167 void initializeBuffer()
171 ,
"No volume data buffer supplied!" );
175 ,
"Supplied volume data buffer is of size "
177 <<
" 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::IntensityVolume.
Represents an association.
AssociatedObjectType * get() const
Returns raw pointer to the referenced object.
Implements IntensityVolume generically for a particular VoxelType.
BufferType Buffer
Holds the used buffer type.
static float bufferValueToIntensity(VoxelType bufferValue)
Returns the intensity value corresponding to bufferValue.
BufferedIntensityVolume(const math::Vector3ui &size)
float operator()(const math::Vector3ui &at) const
void setVoxel(const math::Vector3ui &at, float intensity)
const BufferType & buffer() const
References the underlying buffer.
BufferType & buffer()
References the underlying buffer.
void setVoxel(unsigned int x, unsigned int y, unsigned int z, float intensity)
Sets the HUV of a voxel.
BufferedIntensityVolume(const math::Vector3ui &size, Association< BufferType > *buffer)
Instantiates with , where is size.
VoxelType Voxel
Holds the type used to store the value of a single voxel.
const std::unique_ptr< Association< BufferType > > myBuffer
Holds the underlying buffer.
float operator()(unsigned int x, unsigned int y, unsigned int z) const
Returns intensity of specified voxel.
static VoxelType intensityToBufferValue(float intensity)
Returns the buffer value corresponding to an intensity.
Represents a composition, i.e. a strong reference. This basically is a std::unique_ptr that supports ...
Defines interface to volume data.
math::Vector3ui size
Holds the resolution.
Eigen::Matrix< unsigned int, 3, 1 > Vector3ui
Defines vector.