OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Types | Private Attributes | Friends | List of all members
WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs > Class Template Reference

A template that performs an operation on a per voxel basis. More...

#include <WThreadedPerVoxelOperation.h>

+ Inheritance diagram for WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >:
+ Collaboration diagram for WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >:

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< WDataSetSinglegetResult ()
 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< WGridm_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...
 

Detailed Description

template<typename Value_T, std::size_t numValues, typename Output_T, std::size_t numOutputs>
class WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >

A template that performs an operation on a per voxel basis.

This template is intended to be used in combination with

See also
WThreadedFunction.

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.

Member Typedef Documentation

◆ BaseType

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
typedef WThreadedStripingJobs< WValueSet< Value_T >, std::size_t > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::BaseType
private

the base class

Definition at line 75 of file WThreadedPerVoxelOperation.h.

◆ FunctionType

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
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.

◆ OutputVectorType

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
typedef std::shared_ptr< std::vector< Output_T > > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::OutputVectorType
private

a threadsafe vector (container)

Definition at line 126 of file WThreadedPerVoxelOperation.h.

◆ OutTransmitType

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
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.

◆ OutValueSetType

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
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.

◆ TransmitType

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
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.

◆ ValueSetType

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
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.

Constructor & Destructor Documentation

◆ WThreadedPerVoxelOperation()

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::WThreadedPerVoxelOperation ( std::shared_ptr< WDataSetSingle const >  dataset,
FunctionType  func 
)

◆ ~WThreadedPerVoxelOperation()

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::~WThreadedPerVoxelOperation
virtual

Destructor.

Definition at line 184 of file WThreadedPerVoxelOperation.h.

Member Function Documentation

◆ compute()

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
void WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::compute ( std::shared_ptr< ValueSetType const >  input,
std::size_t  voxelNum 
)
virtual

Perform the computation for a specific voxel.

Parameters
inputThe input dataset.
voxelNumThe voxel number to operate on.

Implements WThreadedStripingJobs< WValueSet< Value_T >, std::size_t >.

Definition at line 189 of file WThreadedPerVoxelOperation.h.

◆ getResult()

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
std::shared_ptr< WDataSetSingle > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::getResult

Get the output dataset.

Returns
The oupput dataset.

Definition at line 201 of file WThreadedPerVoxelOperation.h.

Friends And Related Function Documentation

◆ WThreadedPerVoxelOperationTest

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
friend class WThreadedPerVoxelOperationTest
friend

the test is a friend

Definition at line 72 of file WThreadedPerVoxelOperation.h.

Member Data Documentation

◆ m_func

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
FunctionType WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::m_func
private

◆ m_grid

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
std::shared_ptr< WGrid > WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::m_grid
private

◆ m_output

template<typename Value_T , std::size_t numValues, typename Output_T , std::size_t numOutputs>
OutputVectorType WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::m_output
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().


The documentation for this class was generated from the following file: