OpenWalnut
1.5.0dev
|
Base class for all rasterization algorithms. More...
#include <WRasterAlgorithm.h>
Public Member Functions | |
WRasterAlgorithm (std::shared_ptr< WGridRegular3D > grid) | |
Creates new raster algorithm within the given grid. More... | |
virtual | ~WRasterAlgorithm () |
Dispose a this raster algorithm. More... | |
virtual void | raster (const WLine &line)=0 |
Rasterize the given line into the grid of dataset. More... | |
std::shared_ptr< WDataSetScalar > | generateDataSet () const |
Computes a dataset out of our voxel values and the previously given grid. More... | |
void | addParameterizationAlgorithm (std::shared_ptr< WRasterParameterization > algorithm) |
This method allows the user of the raster algorithm to add arbitrary parameterizations. More... | |
virtual void | finished () |
Called whenever all lines have been rasterized. More... | |
Protected Member Functions | |
virtual void | parameterizeVoxel (const WVector3i &voxel, size_t voxelIdx, const int axis, const double value, const WPosition &start, const WPosition &end) |
This method allows all registered parameterization algorithms to update. More... | |
virtual void | newLine (const WLine &line) |
Distribute a new line getting rasterized to all parameterize algorithms. More... | |
virtual void | newSegment (const WPosition &start, const WPosition &end) |
Distribute a new segment of a line to all parameterization algorithms. More... | |
Protected Attributes | |
std::vector< std::shared_ptr< WRasterParameterization > > | m_parameterizations |
All the parameterization algorithms to apply while rasterizing a line. More... | |
std::shared_mutex | m_parameterizationsLock |
The mutex used to lock access to m_parameterizations. More... | |
std::shared_ptr< WGridRegular3D > | m_grid |
The grid is used for the following purposes: More... | |
std::vector< double > | m_values |
Stores the value of each voxel. More... | |
Base class for all rasterization algorithms.
The interface will be as follows: You need a WGridRegular3D grid and some geometry. The grid specifies the volume where you raster the geometry. For other geometries than lines please overload the raster() member function.
Definition at line 46 of file WRasterAlgorithm.h.
|
explicit |
Creates new raster algorithm within the given grid.
The grid may later also be used to generate a real DataSet,
grid | The grid specifying the voxels. |
Definition at line 36 of file WRasterAlgorithm.cpp.
References wlog::debug(), and m_values.
|
virtual |
Dispose a this raster algorithm.
Definition at line 45 of file WRasterAlgorithm.cpp.
void WRasterAlgorithm::addParameterizationAlgorithm | ( | std::shared_ptr< WRasterParameterization > | algorithm | ) |
This method allows the user of the raster algorithm to add arbitrary parameterizations.
Each parameterization creates a new volume dataset parameterizing the voxelized line somehow.
algorithm | the algorithm |
Definition at line 59 of file WRasterAlgorithm.cpp.
References m_parameterizations, and m_parameterizationsLock.
|
virtual |
Called whenever all lines have been rasterized.
Definition at line 95 of file WRasterAlgorithm.cpp.
References m_parameterizations, and m_parameterizationsLock.
std::shared_ptr< WDataSetScalar > WRasterAlgorithm::generateDataSet | ( | ) | const |
Computes a dataset out of our voxel values and the previously given grid.
Note this may take some time.
Definition at line 49 of file WRasterAlgorithm.cpp.
References m_values.
|
protectedvirtual |
Distribute a new line getting rasterized to all parameterize algorithms.
line | the new line. |
Definition at line 66 of file WRasterAlgorithm.cpp.
References m_parameterizations.
Referenced by WBresenham::raster().
|
protectedvirtual |
Distribute a new segment of a line to all parameterization algorithms.
Gets called for each new line segment getting rasterized, as one segment can have multiple voxels.
start | start point of the new line segment |
end | end point of the new line segment |
Definition at line 75 of file WRasterAlgorithm.cpp.
References m_parameterizations.
Referenced by WBresenham::raster().
|
protectedvirtual |
This method allows all registered parameterization algorithms to update.
This basically simply calls all parameterizeVoxel methods in m_parameterizations vector.
voxel | the voxel to parameterize |
voxelIdx | the voxel index in the common grid calculated using "voxel" (this is for convenience) |
axis | Along which axis the traversal takes place. Since when walking in e.g. X-direction there are not supporting voxels in the |
value | the new voxel value |
start | Start point of the line segment (used to computed the distance) |
end | End point of the line segment (used to computed the distance) |
Definition at line 84 of file WRasterAlgorithm.cpp.
References m_parameterizations.
Referenced by WBresenham::markVoxel().
|
pure virtual |
Rasterize the given line into the grid of dataset.
The value of the voxel which will be hit changes its value.
line | Polyline which is about to be rastered. |
Implemented in WBresenham.
|
protected |
The grid is used for the following purposes:
Definition at line 111 of file WRasterAlgorithm.h.
Referenced by WBresenham::computeDistances(), WBresenham::markVoxel(), WBresenham::rasterSegment(), and WBresenhamDBL::rasterSegment().
|
protected |
All the parameterization algorithms to apply while rasterizing a line.
Definition at line 97 of file WRasterAlgorithm.h.
Referenced by addParameterizationAlgorithm(), finished(), newLine(), newSegment(), and parameterizeVoxel().
|
protected |
The mutex used to lock access to m_parameterizations.
Definition at line 102 of file WRasterAlgorithm.h.
Referenced by addParameterizationAlgorithm(), finished(), and WBresenham::raster().
|
protected |
Stores the value of each voxel.
If and only if a voxel is not hit by a line segment its value is 0.0.
Definition at line 117 of file WRasterAlgorithm.h.
Referenced by generateDataSet(), WBresenham::markVoxel(), and WRasterAlgorithm().