OpenWalnut
1.5.0dev
|
A template that performs an operation on a per voxel basis. More...
#include <WThreadedPerVoxelOperation.h>
Public Types | |
typedef WValueSet< Value_T > | ValueSetType |
the input valueset's type More... | |
typedef WValueSet< Output_T > | OutValueSetType |
the output valueset's type More... | |
typedef ValueSetType::SubArray const | TransmitType |
the input type for the per-voxel operation More... | |
typedef boost::array< Output_T, numOutputs > | OutTransmitType |
the output type for the per-voxel operation More... | |
typedef boost::function< OutTransmitType const(TransmitType const &) > | FunctionType |
the function type More... | |
Public Types inherited from WThreadedStripingJobs< WValueSet< Value_T >, std::size_t > | |
typedef WValueSet< Value_T > | InputType |
the input type More... | |
typedef std::size_t | JobType |
the job type More... | |
Public Member Functions | |
WThreadedPerVoxelOperation (std::shared_ptr< WDataSetSingle const > dataset, FunctionType func) | |
Construct a per-voxel operation. More... | |
virtual | ~WThreadedPerVoxelOperation () |
Destructor. More... | |
virtual void | compute (std::shared_ptr< ValueSetType const > input, std::size_t voxelNum) |
Perform the computation for a specific voxel. More... | |
std::shared_ptr< WDataSetSingle > | getResult () |
Get the output dataset. More... | |
Public Member Functions inherited from WThreadedStripingJobs< WValueSet< Value_T >, std::size_t > | |
WThreadedStripingJobs (std::shared_ptr< InputType const > input) | |
Constructor. More... | |
virtual | ~WThreadedStripingJobs () |
Destructor. More... | |
void | operator() (std::size_t id, std::size_t numThreads, WBoolFlag const &shutdown) |
The threaded function operation. More... | |
Private Types | |
typedef WThreadedStripingJobs< WValueSet< Value_T >, std::size_t > | BaseType |
the base class More... | |
typedef std::shared_ptr< std::vector< Output_T > > | OutputVectorType |
a threadsafe vector (container) More... | |
Private Attributes | |
OutputVectorType | m_output |
stores the output of the per-voxel-operation More... | |
FunctionType | m_func |
the function applied to every voxel More... | |
std::shared_ptr< WGrid > | m_grid |
store the grid More... | |
Friends | |
class | WThreadedPerVoxelOperationTest |
the test is a friend More... | |
Additional Inherited Members | |
Protected Attributes inherited from WThreadedStripingJobs< WValueSet< Value_T >, std::size_t > | |
std::shared_ptr< InputType const > | m_input |
the input More... | |
A template that performs an operation on a per voxel basis.
This template is intended to be used in combination with
The template parameters are the internal datatype of the input datasets valueset, the number of input data elements per voxel, the type of the output data and the number of outputs per voxel.
Example: Suppose one wants to calculate the largest eigenvector of a symmetric tensor of order 2 per voxel, where the input tensors are stored als 6 floats. The output could be 3 double values. The corresponding template parameters would be float, 6, double, 3.
A function that converts the input values to output values needs to be given via a boost::function object. The correct 'signature' is:
boost::array< Output_T, numOutputs > func( WValueSet< Value_T >::SubArray const& );
The subarray will have exactly numInputs entries.
Definition at line 69 of file WThreadedPerVoxelOperation.h.
|
private |
the base class
Definition at line 75 of file WThreadedPerVoxelOperation.h.
typedef boost::function< OutTransmitType const ( TransmitType const& ) > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::FunctionType |
the function type
Definition at line 91 of file WThreadedPerVoxelOperation.h.
|
private |
a threadsafe vector (container)
Definition at line 126 of file WThreadedPerVoxelOperation.h.
typedef boost::array< Output_T, numOutputs > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::OutTransmitType |
the output type for the per-voxel operation
Definition at line 88 of file WThreadedPerVoxelOperation.h.
typedef WValueSet< Output_T > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::OutValueSetType |
the output valueset's type
Definition at line 82 of file WThreadedPerVoxelOperation.h.
typedef ValueSetType::SubArray const WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::TransmitType |
the input type for the per-voxel operation
Definition at line 85 of file WThreadedPerVoxelOperation.h.
typedef WValueSet< Value_T > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::ValueSetType |
the input valueset's type
Definition at line 79 of file WThreadedPerVoxelOperation.h.
WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::WThreadedPerVoxelOperation | ( | std::shared_ptr< WDataSetSingle const > | dataset, |
FunctionType | func | ||
) |
Construct a per-voxel operation.
dataset | The input dataset. |
func | The function to be evaluated per voxel. |
Definition at line 139 of file WThreadedPerVoxelOperation.h.
References WThreadedPerVoxelOperationTest::func(), WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::m_func, WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::m_grid, WThreadedStripingJobs< WValueSet< Value_T >, std::size_t >::m_input, and WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::m_output.
|
virtual |
Destructor.
Definition at line 184 of file WThreadedPerVoxelOperation.h.
|
virtual |
Perform the computation for a specific voxel.
input | The input dataset. |
voxelNum | The voxel number to operate on. |
Implements WThreadedStripingJobs< WValueSet< Value_T >, std::size_t >.
Definition at line 189 of file WThreadedPerVoxelOperation.h.
std::shared_ptr< WDataSetSingle > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::getResult |
Get the output dataset.
Definition at line 201 of file WThreadedPerVoxelOperation.h.
|
friend |
the test is a friend
Definition at line 72 of file WThreadedPerVoxelOperation.h.
|
private |
the function applied to every voxel
Definition at line 132 of file WThreadedPerVoxelOperation.h.
Referenced by WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::WThreadedPerVoxelOperation().
|
private |
store the grid
Definition at line 135 of file WThreadedPerVoxelOperation.h.
Referenced by WThreadedPerVoxelOperationTest::testInstantiation(), and WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::WThreadedPerVoxelOperation().
|
private |
stores the output of the per-voxel-operation
Definition at line 129 of file WThreadedPerVoxelOperation.h.
Referenced by WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::WThreadedPerVoxelOperation().