NPL
Neurological Programs and Libraries
|
The Rigid Corr Computer is used to compute the correlation and gradient of correlation between two images. As the name implies, it is designed for 6 parameter rigid transforms. More...
#include <registration.h>
Public Member Functions | |
RigidCorrComp (bool mindiff) | |
Constructor for the rigid correlation class. Note that rigid rotation is assumed to be about the center of the fixed image space. Also note that changed to the input images by the outside will * be reflected in the registration images HOWEVER you need to call reinit() if you change the inputs, otherwise the image gradients will be incorrect. More... | |
int | valueGrad (const Eigen::VectorXd ¶ms, double &val, Eigen::VectorXd &grad) |
Computes the gradient and value of the correlation. More... | |
int | grad (const Eigen::VectorXd ¶ms, Eigen::VectorXd &grad) |
Computes the gradient of the correlation. Note that this function just calls valueGrad because computing the additional values are trivial. More... | |
int | value (const Eigen::VectorXd ¶ms, double &val) |
Computes the correlation. More... | |
void | setFixed (ptr< const MRImage > fixed) |
Set the fixed image for registration/comparison. More... | |
ptr< const MRImage > | getFixed () |
Return the current fixed image. More... | |
void | setMoving (ptr< const MRImage > moving) |
Set the moving image for comparison, note that setting this triggers a derivative computation and so is slower than setFixed. More... | |
ptr< const MRImage > | getMoving () |
Return the current moving image. More... | |
size_t | nparam () |
Returns the number of parameters that are being estimated. More... | |
Public Attributes | |
bool | m_compdiff |
Negative of correlation (which will make it work with most optimizers) More... | |
The Rigid Corr Computer is used to compute the correlation and gradient of correlation between two images. As the name implies, it is designed for 6 parameter rigid transforms.
Requires that both setFixed and setMoving be set
Note that if you want to use this for registration, you should set m_mindiff to get the negative of correlation.
Definition at line 213 of file registration.h.
npl::RigidCorrComp::RigidCorrComp | ( | bool | mindiff | ) |
Constructor for the rigid correlation class. Note that rigid rotation is assumed to be about the center of the fixed image space. Also note that changed to the input images by the outside will * be reflected in the registration images HOWEVER you need to call reinit() if you change the inputs, otherwise the image gradients will be incorrect.
mindiff | Whether to use negative correlation (for instance to minimize negative correlation using a gradient descent). |
Return the current fixed image.
Definition at line 275 of file registration.h.
Return the current moving image.
Note that modification of the moving image outside this class without re-calling setMoving is undefined and will result in an out-of-date moving image derivative. THIS WILL BREAK GRADIENT CALCULATIONS.
Definition at line 296 of file registration.h.
int npl::RigidCorrComp::grad | ( | const Eigen::VectorXd & | params, |
Eigen::VectorXd & | grad | ||
) |
Computes the gradient of the correlation. Note that this function just calls valueGrad because computing the additional values are trivial.
params | Paramters (Rx, Ry, Rz, Sx, Sy, Sz). |
grad | Gradient at the given rotation |
|
inline |
Returns the number of parameters that are being estimated.
Definition at line 303 of file registration.h.
Set the fixed image for registration/comparison.
fixed | Input fixed image (not modified) |
Set the moving image for comparison, note that setting this triggers a derivative computation and so is slower than setFixed.
Note that modification of the moving image outside this class without re-calling setMoving is undefined and will result in an out-of-date moving image derivative. THIS WILL BREAK GRADIENT CALCULATIONS.
moving | Input moving image (not modified) |
int npl::RigidCorrComp::value | ( | const Eigen::VectorXd & | params, |
double & | val | ||
) |
Computes the correlation.
params | Paramters (Rx, Ry, Rz, Sx, Sy, Sz). |
val | Value at the given rotation |
int npl::RigidCorrComp::valueGrad | ( | const Eigen::VectorXd & | params, |
double & | val, | ||
Eigen::VectorXd & | grad | ||
) |
Computes the gradient and value of the correlation.
params | Paramters (Rx, Ry, Rz, Sx, Sy, Sz). |
val | Value at the given rotation |
grad | Gradient at the given rotation |
bool npl::RigidCorrComp::m_compdiff |
Negative of correlation (which will make it work with most optimizers)
Definition at line 303 of file registration.h.