Classes | Public Types | Public Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes

cmtk::ParallelElasticFunctional< VM > Class Template Reference
[cmtkRegistration Library]

Parallel elastic registration functional. More...

#include <cmtkParallelElasticFunctional.h>

Inheritance diagram for cmtk::ParallelElasticFunctional< VM >:
Inheritance graph
[legend]
Collaboration diagram for cmtk::ParallelElasticFunctional< VM >:
Collaboration graph
[legend]

List of all members.

Classes

class  EvaluateCompleteTaskInfo
 Thread parameter block for complete functional evaluation. More...
class  EvaluateGradientTaskInfo
 Thread parameter block for incremental gradient computation. More...

Public Types

typedef
ParallelElasticFunctional< VM > 
Self
 This class.
typedef
VoxelMatchingElasticFunctional_Template
< VM > 
Superclass
 Superclass.

Public Member Functions

 ParallelElasticFunctional (UniformVolume::SmartPtr &reference, UniformVolume::SmartPtr &floating)
 Constructor.
virtual ~ParallelElasticFunctional ()
 Destructor.
virtual void SetWarpXform (SplineWarpXform::SmartPtr &warp)
 Set warp transformation.
Self::ReturnType EvaluateIncremental (const SplineWarpXform &warp, VM *const localMetric, const DataGrid::RegionType &voi, Vector3D *const vectorCache)
 Evaluate functional after change of a single parameter.
virtual Self::ReturnType EvaluateWithGradient (CoordinateVector &v, CoordinateVector &g, const typename Self::ParameterType step=1)
 Compute functional value and gradient.
virtual Self::ReturnType EvaluateAt (CoordinateVector &v)
 Evaluate functional.
virtual Self::ReturnType Evaluate ()
 Evaluate functional.

Protected Attributes

std::vector
< SplineWarpXform::SmartPtr
ThreadWarp
 Array of warp transformation objects for the parallel threads.
Vector3D ** ThreadVectorCache
 Array of storage for simultaneously retrieving multiple deformed vectors.
size_t m_NumberOfThreads
 Number of actual parallel threads used for computations.
size_t m_NumberOfTasks
 Number of parallel tasks.

Static Private Member Functions

static void EvaluateGradientThread (void *arg, const size_t taskIdx, const size_t taskCnt, const size_t threadIdx, const size_t)
 Compute functional gradient as a thread.
static void EvaluateCompleteThread (void *arg, const size_t taskIdx, const size_t taskCnt, const size_t threadIdx, const size_t)
 Multi-threaded implementation of complete metric evaluation.

Private Attributes

VM ** TaskMetric
 Metric object for threadwise computation.
JointHistogram< unsigned int > ** ThreadConsistencyHistogram
 Consistency histogram objects for threadwise computation.
std::vector< typename
Self::EvaluateGradientTaskInfo > 
InfoTaskGradient
 Info blocks for parallel threads evaluating functional gradient.
std::vector< typename
Self::EvaluateCompleteTaskInfo > 
InfoTaskComplete
 Info blocks for parallel threads evaluating complete functional.

Detailed Description

template<class VM>
class cmtk::ParallelElasticFunctional< VM >

Parallel elastic registration functional.

This class provides multi-threaded implementations for the most time-consuming tasks performed by VoxelMatchingElasticFunctional and its derived classes. Inherit from non-parallel functional.

Definition at line 56 of file cmtkParallelElasticFunctional.h.


Member Typedef Documentation

template<class VM>
typedef ParallelElasticFunctional<VM> cmtk::ParallelElasticFunctional< VM >::Self

This class.

Reimplemented from cmtk::VoxelMatchingElasticFunctional_Template< VM >.

Definition at line 79 of file cmtkParallelElasticFunctional.h.


Constructor & Destructor Documentation

template<class VM>
cmtk::ParallelElasticFunctional< VM >::ParallelElasticFunctional ( UniformVolume::SmartPtr reference,
UniformVolume::SmartPtr floating 
) [inline]

Constructor.

Definition at line 85 of file cmtkParallelElasticFunctional.h.

References cmtk::ThreadPool::GetNumberOfThreads().

template<class VM>
virtual cmtk::ParallelElasticFunctional< VM >::~ParallelElasticFunctional (  ) [inline, virtual]

Destructor.

Free all per-thread data structures.

Definition at line 109 of file cmtkParallelElasticFunctional.h.

References cmtk::Memory::DeleteArray().


Member Function Documentation

template<class VM>
virtual Self::ReturnType cmtk::ParallelElasticFunctional< VM >::Evaluate (  ) [inline, virtual]

Evaluate functional.

Reimplemented from cmtk::VoxelMatchingElasticFunctional_Template< VM >.

Definition at line 248 of file cmtkParallelElasticFunctional.h.

template<class VM>
virtual Self::ReturnType cmtk::ParallelElasticFunctional< VM >::EvaluateAt ( CoordinateVector v ) [inline, virtual]

Evaluate functional.

Reimplemented from cmtk::VoxelMatchingElasticFunctional_Template< VM >.

Definition at line 242 of file cmtkParallelElasticFunctional.h.

template<class VM>
static void cmtk::ParallelElasticFunctional< VM >::EvaluateCompleteThread ( void *  arg,
const size_t  taskIdx,
const size_t  taskCnt,
const size_t  threadIdx,
const   size_t 
) [inline, static, private]

Multi-threaded implementation of complete metric evaluation.

Definition at line 382 of file cmtkParallelElasticFunctional.h.

References cmtk::SplineWarpXform::GetTransformedGridRow().

template<class VM>
static void cmtk::ParallelElasticFunctional< VM >::EvaluateGradientThread ( void *  arg,
const size_t  taskIdx,
const size_t  taskCnt,
const size_t  threadIdx,
const   size_t 
) [inline, static, private]

Compute functional gradient as a thread.

This function (i.e., each thread) iterates over all parameters of the current warp transformation. Among all active (i.e., not disabled) parameters, it selects the ones that have an index with modulus equal to the threads index when divided by the total number of threads. For these parameters, the thread computes the partial derivative of the functional by finite-difference approximation.

Definition at line 316 of file cmtkParallelElasticFunctional.h.

References cmtk::Xform::m_Parameters, and cmtk::Xform::SetParamVector().

template<class VM>
Self::ReturnType cmtk::ParallelElasticFunctional< VM >::EvaluateIncremental ( const SplineWarpXform warp,
VM *const   localMetric,
const DataGrid::RegionType voi,
Vector3D *const   vectorCache 
) [inline]

Evaluate functional after change of a single parameter.

Parameters:
warpThe current deformation.
localMetricThe local working metric.
voiVolume-of-Influence for the parameter under consideration.
vectorCachePre-allocated storage for holding transformed vectors.
Returns:
The metric after recomputation over the given volume-of-influence.

Definition at line 158 of file cmtkParallelElasticFunctional.h.

References cmtk::Region< NDIM, T >::From(), cmtk::SplineWarpXform::GetTransformedGridRow(), and cmtk::Region< NDIM, T >::To().

template<class VM>
virtual Self::ReturnType cmtk::ParallelElasticFunctional< VM >::EvaluateWithGradient ( CoordinateVector v,
CoordinateVector g,
const typename Self::ParameterType  step = 1 
) [inline, virtual]

Compute functional value and gradient.

Definition at line 211 of file cmtkParallelElasticFunctional.h.

References cmtk::Vector< T >::Elements, and cmtk::ThreadPool::Run().

template<class VM>
virtual void cmtk::ParallelElasticFunctional< VM >::SetWarpXform ( SplineWarpXform::SmartPtr warp ) [inline, virtual]

Set warp transformation.

In the multi-threaded implementation, Warp[0] will be linked directly to the given warp, while for all other threads a copy of the original object is created by a call to WarpXform::Clone().

Reimplemented from cmtk::VoxelMatchingElasticFunctional_WarpTemplate< SplineWarpXform >.

Definition at line 126 of file cmtkParallelElasticFunctional.h.


Member Data Documentation

template<class VM>
std::vector<typename Self::EvaluateCompleteTaskInfo> cmtk::ParallelElasticFunctional< VM >::InfoTaskComplete [private]

Info blocks for parallel threads evaluating complete functional.

Definition at line 379 of file cmtkParallelElasticFunctional.h.

template<class VM>
std::vector<typename Self::EvaluateGradientTaskInfo> cmtk::ParallelElasticFunctional< VM >::InfoTaskGradient [private]

Info blocks for parallel threads evaluating functional gradient.

Definition at line 306 of file cmtkParallelElasticFunctional.h.

template<class VM>
size_t cmtk::ParallelElasticFunctional< VM >::m_NumberOfTasks [protected]

Number of parallel tasks.

Definition at line 75 of file cmtkParallelElasticFunctional.h.

template<class VM>
size_t cmtk::ParallelElasticFunctional< VM >::m_NumberOfThreads [protected]

Number of actual parallel threads used for computations.

All duplicated data structures are generated with the multiplicity given by this value. It is determined from Threads when the object is first instanced. It cannot be changed afterwards.

Definition at line 72 of file cmtkParallelElasticFunctional.h.

template<class VM>
VM** cmtk::ParallelElasticFunctional< VM >::TaskMetric [private]

Metric object for threadwise computation.

The objects in this array are the per-thread equivalent of the VoxelMatchingElasticFunctional::IncrementalMetric object.

Definition at line 280 of file cmtkParallelElasticFunctional.h.

template<class VM>
JointHistogram<unsigned int>** cmtk::ParallelElasticFunctional< VM >::ThreadConsistencyHistogram [private]

Consistency histogram objects for threadwise computation.

Definition at line 283 of file cmtkParallelElasticFunctional.h.

template<class VM>
Vector3D** cmtk::ParallelElasticFunctional< VM >::ThreadVectorCache [protected]

Array of storage for simultaneously retrieving multiple deformed vectors.

Definition at line 65 of file cmtkParallelElasticFunctional.h.

template<class VM>
std::vector<SplineWarpXform::SmartPtr> cmtk::ParallelElasticFunctional< VM >::ThreadWarp [protected]

Array of warp transformation objects for the parallel threads.

Definition at line 62 of file cmtkParallelElasticFunctional.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines