Parallel elastic registration functional. More...
#include <cmtkParallelElasticFunctional.h>
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. |
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.
typedef ParallelElasticFunctional<VM> cmtk::ParallelElasticFunctional< VM >::Self |
This class.
Reimplemented from cmtk::VoxelMatchingElasticFunctional_Template< VM >.
Definition at line 79 of file cmtkParallelElasticFunctional.h.
typedef VoxelMatchingElasticFunctional_Template<VM> cmtk::ParallelElasticFunctional< VM >::Superclass |
Superclass.
Reimplemented from cmtk::VoxelMatchingElasticFunctional_WarpTemplate< SplineWarpXform >.
Definition at line 82 of file cmtkParallelElasticFunctional.h.
cmtk::ParallelElasticFunctional< VM >::ParallelElasticFunctional | ( | UniformVolume::SmartPtr & | reference, |
UniformVolume::SmartPtr & | floating | ||
) | [inline] |
Constructor.
Definition at line 85 of file cmtkParallelElasticFunctional.h.
References cmtk::ThreadPool::GetNumberOfThreads().
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().
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.
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.
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().
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().
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.
warp | The current deformation. |
localMetric | The local working metric. |
voi | Volume-of-Influence for the parameter under consideration. |
vectorCache | Pre-allocated storage for holding transformed vectors. |
Definition at line 158 of file cmtkParallelElasticFunctional.h.
References cmtk::Region< NDIM, T >::From(), cmtk::SplineWarpXform::GetTransformedGridRow(), and cmtk::Region< NDIM, T >::To().
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().
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.
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.
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.
size_t cmtk::ParallelElasticFunctional< VM >::m_NumberOfTasks [protected] |
Number of parallel tasks.
Definition at line 75 of file cmtkParallelElasticFunctional.h.
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.
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.
JointHistogram<unsigned int>** cmtk::ParallelElasticFunctional< VM >::ThreadConsistencyHistogram [private] |
Consistency histogram objects for threadwise computation.
Definition at line 283 of file cmtkParallelElasticFunctional.h.
Vector3D** cmtk::ParallelElasticFunctional< VM >::ThreadVectorCache [protected] |
Array of storage for simultaneously retrieving multiple deformed vectors.
Definition at line 65 of file cmtkParallelElasticFunctional.h.
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.