12#ifndef VOLUMEGRID_H_6014714286
13#define VOLUMEGRID_H_6014714286
23#include <Carna/Carna.h>
62template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
131 typedef typename SegmentIntensityVolumeType::Value
VoxelType;
155 typedef typename SegmentNormalsVolumeType::Value
VoxelType;
173 template<
typename Selector >
178 template<
typename Selector >
179 typename Selector::VoxelType
getVoxel(
unsigned int x,
unsigned int y,
unsigned int z );
185 template<
typename Selector >
190 template<
typename Selector >
191 void setVoxel(
unsigned int x,
unsigned int y,
unsigned int z,
const typename Selector::VoxelType&
voxel );
195 std::vector< Segment* > segments;
202template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
206 : maxSegmentSize( maxSegmentSize )
207 , segmentCounts( segmentCounts )
216 const std::size_t index = segmentIndex( x, y, z );
224template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
227 std::for_each( segments.begin(), segments.end(), std::default_delete< Segment >() );
231template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
241template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
246 return segmentAt(
p.x(),
p.y(),
p.z() );
250template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
255 return segmentAt(
p.x(),
p.y(),
p.z() );
259template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
272template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
285template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
286template<
typename Selector >
288 (
unsigned int x,
unsigned int y,
unsigned int z )
290 const unsigned int segmentX = x / maxSegmentSize.x();
291 const unsigned int segmentY = y / maxSegmentSize.y();
292 const unsigned int segmentZ = z / maxSegmentSize.z();
294 const unsigned int localX = x % maxSegmentSize.x();
295 const unsigned int localY = y % maxSegmentSize.y();
296 const unsigned int localZ = z % maxSegmentSize.z();
303template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
304template<
typename Selector >
312template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
313template<
typename Selector >
315 (
unsigned int x,
unsigned int y,
unsigned int z,
const typename Selector::VoxelType&
voxel )
317 const unsigned int segmentX = x / maxSegmentSize.x();
318 const unsigned int segmentY = y / maxSegmentSize.y();
319 const unsigned int segmentZ = z / maxSegmentSize.z();
321 const unsigned int localX = x % maxSegmentSize.x();
322 const unsigned int localY = y % maxSegmentSize.y();
323 const unsigned int localZ = z % maxSegmentSize.z();
354 .setVoxel( maxSegmentSize.x(), maxSegmentSize.y(),
localZ,
voxel );
359 .setVoxel( maxSegmentSize.x(),
localY, maxSegmentSize.z(),
voxel );
364 .setVoxel(
localX, maxSegmentSize.y(), maxSegmentSize.z(),
voxel );
370 .setVoxel( maxSegmentSize,
voxel );
375template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
376template<
typename Selector >
389template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
397template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
410template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
418template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
Defines Carna::base::CarnaException, Carna::base::AssertionFailure.
#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::IntensityVolume.
Defines Carna::base::VolumeSegment.
Represents an association.
Represents a particular partitioning of volumetric data.
VolumeGrid(const math::Vector3ui &maxSegmentSize, const math::Vector3ui &segmentCounts)
Instantiates.
Segment & segmentAt(unsigned int segmentX, unsigned int segmentY, unsigned int segmentZ)
virtual ~VolumeGrid()
Deletes this and all partitions.
VolumeSegment< SegmentIntensityVolumeType, SegmentNormalsVolumeType > Segment
Reflects the data type that represents a single partition.
Selector::VoxelType getVoxel(unsigned int x, unsigned int y, unsigned int z)
void setVoxel(const math::Vector3ui &location, const typename Selector::VoxelType &voxel)
Writes the voxel of the volume that the Selector selects from the partition at location.
SegmentIntensityVolumeType SegmentIntensityVolume
Reflects the type to use for storing the intensity volume of a single partition.
const Segment & segmentAt(unsigned int segmentX, unsigned int segmentY, unsigned int segmentZ) const
SegmentNormalsVolumeType SegmentNormalsVolume
Reflects the type to use for storing the normal map of a single partition.
const math::Vector3ui maxSegmentSize
Holds the maximum resolution of a single partition.
void setVoxel(unsigned int x, unsigned int y, unsigned int z, const typename Selector::VoxelType &voxel)
Selector::VoxelType getVoxel(const math::Vector3ui &location)
Reads the voxel of the volume that the Selector selects from the partition at location.
const Segment & segmentAt(const base::math::Vector3ui &) const
Segment & segmentAt(const base::math::Vector3ui &location)
References the partition at location.
const math::Vector3ui segmentCounts
Holds the number of partitions along each dimension.
Represents a single volumetric data partition.
Eigen::Matrix< unsigned int, 3, 1 > Vector3ui
Defines vector.
#define NON_COPYABLE
Features class it is placed in as non-copyable.
References the intensity volume of a given partition.
SegmentIntensityVolumeType::Value VoxelType
Reflects the voxel type of the volume this selector references.
static SegmentIntensityVolumeType & volume(Segment &segment)
References the intensity volume of a given partition.
References the normal map of a given partition.
static SegmentNormalsVolumeType & volume(Segment &segment)
References the normal map of a given partition.
SegmentNormalsVolumeType::Value VoxelType
Reflects the voxel type of the volume this selector references.