15#ifndef VOLUMEGRID_H_6014714286
16#define VOLUMEGRID_H_6014714286
61template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
130 typedef typename SegmentIntensityVolumeType::Value
VoxelType;
154 typedef typename SegmentNormalsVolumeType::Value
VoxelType;
172 template<
typename Selector >
177 template<
typename Selector >
178 typename Selector::VoxelType
getVoxel(
unsigned int x,
unsigned int y,
unsigned int z );
184 template<
typename Selector >
189 template<
typename Selector >
190 void setVoxel(
unsigned int x,
unsigned int y,
unsigned int z,
const typename Selector::VoxelType&
voxel );
194 std::vector< Segment* > segments;
201template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
205 : maxSegmentSize( maxSegmentSize )
206 , segmentCounts( segmentCounts )
215 const std::size_t index = segmentIndex( x, y, z );
223template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
226 std::for_each( segments.begin(), segments.end(), std::default_delete< Segment >() );
230template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
240template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
245 return segmentAt(
p.x(),
p.y(),
p.z() );
249template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
254 return segmentAt(
p.x(),
p.y(),
p.z() );
258template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
271template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
284template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
285template<
typename Selector >
287 (
unsigned int x,
unsigned int y,
unsigned int z )
289 const unsigned int segmentX = x / maxSegmentSize.x();
290 const unsigned int segmentY = y / maxSegmentSize.y();
291 const unsigned int segmentZ = z / maxSegmentSize.z();
293 const unsigned int localX = x % maxSegmentSize.x();
294 const unsigned int localY = y % maxSegmentSize.y();
295 const unsigned int localZ = z % maxSegmentSize.z();
302template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
303template<
typename Selector >
311template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
312template<
typename Selector >
314 (
unsigned int x,
unsigned int y,
unsigned int z,
const typename Selector::VoxelType&
voxel )
316 const unsigned int segmentX = x / maxSegmentSize.x();
317 const unsigned int segmentY = y / maxSegmentSize.y();
318 const unsigned int segmentZ = z / maxSegmentSize.z();
320 const unsigned int localX = x % maxSegmentSize.x();
321 const unsigned int localY = y % maxSegmentSize.y();
322 const unsigned int localZ = z % maxSegmentSize.z();
353 .setVoxel( maxSegmentSize.x(), maxSegmentSize.y(),
localZ,
voxel );
358 .setVoxel( maxSegmentSize.x(),
localY, maxSegmentSize.z(),
voxel );
363 .setVoxel(
localX, maxSegmentSize.y(), maxSegmentSize.z(),
voxel );
369 .setVoxel( maxSegmentSize,
voxel );
374template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
375template<
typename Selector >
388template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
396template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
409template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
417template<
typename SegmentIntensityVolumeType,
typename SegmentNormalsVolumeType >
Defines LibCarna::base::IntensityVolume.
Defines LibCarna::base::LibCarnaException and LibCarna::base::AssertionFailure.
#define LIBCARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Contains forward-declarations.
Defines LibCarna::base::VolumeSegment.
Represents an association.
Represents a particular partitioning of volumetric data.
Selector::VoxelType getVoxel(const math::Vector3ui &location)
Reads the voxel of the volume that the Selector selects from the partition at location.
SegmentNormalsVolumeType SegmentNormalsVolume
Reflects the type to use for storing the normal map of a single partition.
VolumeGrid(const math::Vector3ui &maxSegmentSize, const math::Vector3ui &segmentCounts)
Instantiates.
SegmentIntensityVolumeType SegmentIntensityVolume
Reflects the type to use for storing the intensity volume of a single partition.
Segment & segmentAt(unsigned int segmentX, unsigned int segmentY, unsigned int segmentZ)
void setVoxel(unsigned int x, unsigned int y, unsigned int z, const typename Selector::VoxelType &voxel)
const math::Vector3ui maxSegmentSize
Holds the maximum resolution of a single partition.
Selector::VoxelType getVoxel(unsigned int x, unsigned int y, unsigned int z)
Segment & segmentAt(const base::math::Vector3ui &location)
References the partition at location.
virtual ~VolumeGrid()
Deletes this and all partitions.
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.
const Segment & segmentAt(const base::math::Vector3ui &) const
const Segment & segmentAt(unsigned int segmentX, unsigned int segmentY, unsigned int segmentZ) const
VolumeSegment< SegmentIntensityVolumeType, SegmentNormalsVolumeType > Segment
Reflects the data type that represents a single partition.
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
Marks the class that it is placed in as non-copyable.
References the intensity volume of a given partition.
static SegmentIntensityVolumeType & volume(Segment &segment)
References the intensity volume of a given partition.
SegmentIntensityVolumeType::Value VoxelType
Reflects the voxel type of the volume this selector references.
References the normal map of a given partition.
SegmentNormalsVolumeType::Value VoxelType
Reflects the voxel type of the volume this selector references.
static SegmentNormalsVolumeType & volume(Segment &segment)
References the normal map of a given partition.