Parallel elastic registration functional. More...
#include <cmtkImagePairNonrigidRegistrationFunctionalTemplate.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 ImagePairNonrigidRegistrationFunctionalTemplate < VM > | Self |
This class. | |
typedef SmartPointer< Self > | SmartPtr |
Smart pointer to this class. | |
typedef ImagePairNonrigidRegistrationFunctional | Superclass |
Superclass. | |
Public Member Functions | |
ImagePairNonrigidRegistrationFunctionalTemplate (UniformVolume::SmartPtr &reference, UniformVolume::SmartPtr &floating, const Interpolators::InterpolationEnum interpolation) | |
Constructor. | |
virtual | ~ImagePairNonrigidRegistrationFunctionalTemplate () |
Destructor. | |
virtual void | SetForceOutside (const bool flag=true, const Types::DataItem value=0) |
Set flag and value for forcing values outside the floating image. | |
virtual void | SetWarpXform (SplineWarpXform::SmartPtr &warp) |
Set warp transformation. | |
virtual void | MatchRefFltIntensities () |
Match intensities of reference and floating images. | |
Self::ReturnType | Evaluate () |
Evaluate functional for the complete image data. | |
Self::ReturnType | EvaluateIncremental (const SplineWarpXform &warp, VM &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. | |
Protected Attributes | |
SmartPointer< VM > | m_IncrementalMetric |
Metric object for incremental computation. | |
Private Member Functions | |
void | UpdateWarpFixedParameters () |
Update set of active and passive parameters. | |
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 | |
std::vector< VM > | m_TaskMetric |
Metric object for threadwise computation. | |
std::vector< typename Self::EvaluateGradientTaskInfo > | m_InfoTaskGradient |
Info blocks for parallel threads evaluating functional gradient. | |
std::vector< typename Self::EvaluateCompleteTaskInfo > | m_InfoTaskComplete |
Info blocks for parallel threads evaluating complete functional. | |
bool | WarpNeedsFixUpdate |
Warp's fixed parameters need to be updated. | |
JointHistogram< unsigned int > ::SmartPtr | m_ConsistencyHistogram |
Histogram used for consistency computation. |
Parallel elastic registration functional.
This class provides multi-threaded implementations for the most time-consuming tasks performed by ImagePairNonrigidRegistrationFunctional and its derived classes. Inherit from general image pair registration functional.
Definition at line 60 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
typedef ImagePairNonrigidRegistrationFunctionalTemplate<VM> cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::Self |
This class.
Reimplemented from cmtk::ImagePairNonrigidRegistrationFunctional.
Definition at line 75 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
typedef SmartPointer<Self> cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::SmartPtr |
Smart pointer to this class.
Reimplemented from cmtk::ImagePairNonrigidRegistrationFunctional.
Definition at line 78 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
typedef ImagePairNonrigidRegistrationFunctional cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::Superclass |
Superclass.
Reimplemented from cmtk::ImagePairNonrigidRegistrationFunctional.
Definition at line 81 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::ImagePairNonrigidRegistrationFunctionalTemplate | ( | UniformVolume::SmartPtr & | reference, |
UniformVolume::SmartPtr & | floating, | ||
const Interpolators::InterpolationEnum | interpolation | ||
) | [inline] |
Constructor.
Definition at line 84 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
virtual cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::~ImagePairNonrigidRegistrationFunctionalTemplate | ( | ) | [inline, virtual] |
Destructor.
Free all per-thread data structures.
Definition at line 97 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
Self::ReturnType cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::Evaluate | ( | ) | [inline, virtual] |
Evaluate functional for the complete image data.
This function builds the pre-computed deformed floating image that is later used for rapid gradient computation.
Reimplemented from cmtk::Functional.
Definition at line 122 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
virtual Self::ReturnType cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateAt | ( | CoordinateVector & | v ) | [inline, virtual] |
Evaluate functional.
Definition at line 241 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
static void cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< 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 363 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
References cmtk::SplineWarpXform::GetTransformedGridRow().
static void cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< 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 297 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
References cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateGradientTaskInfo::BaseValue, cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateGradientTaskInfo::Gradient, cmtk::Xform::m_Parameters, cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateGradientTaskInfo::Parameters, cmtk::Xform::SetParamVector(), cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateGradientTaskInfo::Step, and cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateGradientTaskInfo::thisObject.
Self::ReturnType cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::EvaluateIncremental | ( | const SplineWarpXform & | warp, |
VM & | localMetric, | ||
const DataGrid::RegionType & | voi, | ||
Vector3D *const | vectorCache | ||
) | [inline] |
Evaluate functional after change of a single parameter.
warp | The current deformation. |
localMetric | The local metric oobject for partial recomputation. |
voi | Volume-of-Influence for the parameter under consideration. |
vectorCache | Pre-allocated cache storage for locally used transformed vectors. |
Definition at line 158 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
References cmtk::Region< NDIM, T >::From(), cmtk::SplineWarpXform::GetTransformedGridRow(), and cmtk::Region< NDIM, T >::To().
virtual Self::ReturnType cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< 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 cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
References cmtk::Vector< T >::Elements.
void cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::MatchRefFltIntensities | ( | ) | [virtual] |
Match intensities of reference and floating images.
Definition at line 39 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.txx.
References cmtk::TYPE_ITEM.
virtual void cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::SetForceOutside | ( | const bool | flag = true , |
const Types::DataItem | value = 0 |
||
) | [inline, virtual] |
Set flag and value for forcing values outside the floating image.
Reimplemented from cmtk::ImagePairRegistrationFunctional.
Definition at line 101 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
virtual void cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::SetWarpXform | ( | SplineWarpXform::SmartPtr & | warp ) | [inline, virtual] |
Set warp transformation.
Implements cmtk::ImagePairNonrigidRegistrationFunctional.
Definition at line 109 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
void cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::UpdateWarpFixedParameters | ( | ) | [private] |
Update set of active and passive parameters.
This function computes local entropies in the neighborhood of all control points of the Warp transformation. Those control points for which both reference and floating image have less than half the maximum entropy in this neighborhood as compared to the rest of the image are set passive. The passive parameters are not considered for gradient computation and therefore save significant computation time.
We cannot use the precomputed table of VOIs here because in "fast" mode, these VOIs are smaller than we want them here.
Definition at line 51 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.txx.
References cmtk::DATACLASS_LABEL, cmtk::Region< NDIM, T >::From(), and cmtk::Region< NDIM, T >::To().
JointHistogram<unsigned int>::SmartPtr cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::m_ConsistencyHistogram [private] |
Histogram used for consistency computation.
Definition at line 430 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
SmartPointer<VM> cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::m_IncrementalMetric [protected] |
Metric object for incremental computation.
Before computing the incremental metric after change of one parameter, the global metric is copied to this object. It is then used for in-place application of all necessary changes, leaving the original metric intact.
Definition at line 71 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
std::vector<typename Self::EvaluateCompleteTaskInfo> cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::m_InfoTaskComplete [private] |
Info blocks for parallel threads evaluating complete functional.
Definition at line 360 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
std::vector<typename Self::EvaluateGradientTaskInfo> cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::m_InfoTaskGradient [private] |
Info blocks for parallel threads evaluating functional gradient.
Definition at line 287 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
std::vector<VM> cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::m_TaskMetric [private] |
Metric object for threadwise computation.
The objects in this array are the per-thread equivalent of the ImagePairNonrigidRegistrationFunctional::IncrementalMetric object.
Definition at line 264 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.
bool cmtk::ImagePairNonrigidRegistrationFunctionalTemplate< VM >::WarpNeedsFixUpdate [private] |
Warp's fixed parameters need to be updated.
This flag is set when the warp transformation is set or modified. It signals that the active and passive parameters of the transformation will have to be updated before the next gradient computation.
Definition at line 427 of file cmtkImagePairNonrigidRegistrationFunctionalTemplate.h.