public class ThinPlateR2LogRSplineKernelTransform extends Object implements Serializable
M. H. Davis, a Khotanzad, D. P. Flamig, and S. E. Harms, “A physics-based coordinate transformation for 3-D image matching.,” IEEE Trans. Med. Imaging, vol. 16, no. 3, pp. 317–28, Jun. 1997.
Modifier and Type | Field and Description |
---|---|
protected double[][] |
aMatrix |
protected double[] |
bVector |
protected boolean |
computeAffine |
protected org.ejml.data.DenseMatrix64F |
dMatrix |
protected static double |
EPS |
protected static org.apache.log4j.Logger |
logger |
protected int |
ndims |
protected int |
nLandmarks |
protected double[][] |
sourceLandmarks |
protected double |
stiffness |
protected double[] |
tmpDisplacement |
protected double[] |
weights |
protected boolean |
wMatrixComputeD |
Constructor and Description |
---|
ThinPlateR2LogRSplineKernelTransform(double[][] srcPts,
double[][] aMatrix,
double[] bVector,
double[] dMatrixData)
Constructor with transformation parameters.
|
ThinPlateR2LogRSplineKernelTransform(int ndims) |
ThinPlateR2LogRSplineKernelTransform(int ndims,
double[][] srcPts,
double[][] tgtPts) |
ThinPlateR2LogRSplineKernelTransform(int ndims,
double[][] srcPts,
double[][] tgtPts,
boolean computeAffine) |
ThinPlateR2LogRSplineKernelTransform(int ndims,
double[][] srcPts,
double[][] tgtPts,
double[] weights)
Constructor with weighted point matches
|
ThinPlateR2LogRSplineKernelTransform(int ndims,
float[][] srcPts,
float[][] tgtPts) |
ThinPlateR2LogRSplineKernelTransform(int ndims,
float[][] srcPts,
float[][] tgtPts,
boolean computeAffine) |
Modifier and Type | Method and Description |
---|---|
double[] |
apply(double[] pt)
Transforms the input point according to the thin plate spline stored by
this object.
|
void |
apply(double[] pt,
double[] result) |
void |
apply(double[] pt,
double[] result,
boolean debug)
Transform a source vector pt into a target vector result.
|
void |
applyInPlace(double[] pt)
Transform pt in place.
|
org.ejml.data.DenseMatrix64F |
buildDisplacements(double[][] targetLandmarks) |
org.ejml.data.DenseMatrix64F |
buildDisplacements(float[][] targetLandmarks) |
jitk.spline.ThinPlateR2LogRSplineKernelTransform.IndexDistancePair |
closestTargetLandmarkAndDistance(double[] target)
Returns the index of the target landmark closest to the input point as well
as the distance to that landmark.
|
void |
computeDeformationContribution(double[] thispt,
double[] result) |
void |
computeG(double[] pt,
org.ejml.data.DenseMatrix64F mtx) |
void |
computeG(double[] pt,
org.ejml.data.DenseMatrix64F mtx,
double w) |
protected void |
computeK(org.ejml.data.DenseMatrix64F kMatrix)
Builds the K matrix from landmark points and G matrix.
|
protected org.ejml.data.DenseMatrix64F |
computeL(org.ejml.data.DenseMatrix64F kMatrix,
org.ejml.data.DenseMatrix64F pMatrix) |
protected void |
computeP(org.ejml.data.DenseMatrix64F pMatrix) |
protected org.ejml.data.DenseMatrix64F |
computeReflexiveG() |
protected void |
computeW(org.ejml.data.DenseMatrix64F yMatrix)
The main workhorse method.
|
double[][] |
getAffine() |
double[] |
getKnotWeights() |
int |
getNumDims() |
int |
getNumLandmarks() |
double[][] |
getSourceLandmarks() |
double[] |
getTranslation() |
double[] |
initialGuessAtInverse(double[] target)
Approximates the inverse of the input target point by taking the best of several
available approximation methods.
|
double[] |
inverse(double[] target,
double tolerance)
Computes the inverse of this transformation.
|
double |
inverse(double[] target,
double[] result,
double tolerance,
int maxIters)
Computes the inverse of this transformation.
|
double[] |
inverseGuessAffineInv(double[] target)
Quickly approximates the inverse of the input target point,
using the affine portion of the transform only.
|
double |
inverseTol(double[] target,
double[] guess,
double tolerance,
int maxIters) |
double[][] |
jacobian(double[] p)
Computes the jacobian of this tranformation around the point p.
|
static double |
normSqrd(double[] v) |
void |
printXfmBacks2d(int maxx,
int maxy,
int delx,
int dely) |
static double |
r2Logr(double r) |
double[][] |
r2LogrDerivative(double[] p)
The derivative of component j of the output point, with respect to x_d
(the dth component of the vector) is:
\sum_i D[ d, l ] G'( r ) ( x_j - l_ij ) / ( sqrt( N_l(p) ))
where: D is the D matrix i indexes the landmarks N_l(p) is the squared
euclidean norm between landmark l and point p l_ij is the jth component
of landmark i G' is the derivative of the kernel function.
|
static double |
r2LogrFromDisplacement(double[] displacement) |
protected void |
reorganizeW(org.ejml.data.DenseMatrix64F wMatrix)
Copies data from the W matrix to the D, A, and b matrices which represent
the deformable, affine and translational portions of the transformation,
respectively.
|
void |
setDoAffine(boolean estimateAffine) |
protected void |
srcPtDisplacement(int i,
double[] pt,
double[] res)
Computes the displacement between the i^th source point and the input
point.
|
protected void |
srcPtDisplacement(int i,
int j,
double[] res)
Computes the displacement between the i^th and j^th source points.
|
void |
stepInDerivativeDirection(double[][] derivative,
double[] start,
double[] dest,
double stepLength) |
protected void |
tgtPtDisplacement(int i,
double[] pt,
double[] res)
Computes the displacement between the i^th source point and the input
point.
|
double[] |
transformPointAffine(double[] pt)
Transforms the input point according to the affine part of the thin plate
spline stored by this object.
|
protected final int ndims
protected org.ejml.data.DenseMatrix64F dMatrix
protected double[][] aMatrix
protected double[] bVector
protected double stiffness
protected boolean wMatrixComputeD
protected boolean computeAffine
protected int nLandmarks
protected final double[][] sourceLandmarks
protected double[] weights
protected double[] tmpDisplacement
protected static final double EPS
protected static org.apache.log4j.Logger logger
public ThinPlateR2LogRSplineKernelTransform(int ndims)
public ThinPlateR2LogRSplineKernelTransform(int ndims, double[][] srcPts, double[][] tgtPts)
public ThinPlateR2LogRSplineKernelTransform(int ndims, float[][] srcPts, float[][] tgtPts)
public ThinPlateR2LogRSplineKernelTransform(int ndims, double[][] srcPts, double[][] tgtPts, boolean computeAffine)
public ThinPlateR2LogRSplineKernelTransform(int ndims, float[][] srcPts, float[][] tgtPts, boolean computeAffine)
public ThinPlateR2LogRSplineKernelTransform(int ndims, double[][] srcPts, double[][] tgtPts, double[] weights)
ndims
- num dimensionssrcPts
- source pointstgtPts
- target pointsweights
- point weightspublic ThinPlateR2LogRSplineKernelTransform(double[][] srcPts, double[][] aMatrix, double[] bVector, double[] dMatrixData)
srcPts
- source pointsaMatrix
- A matrixbVector
- b vectordMatrixData
- D matrixpublic int getNumLandmarks()
public int getNumDims()
public double[][] getSourceLandmarks()
public double[][] getAffine()
public double[] getTranslation()
public double[] getKnotWeights()
public void setDoAffine(boolean estimateAffine)
protected org.ejml.data.DenseMatrix64F computeReflexiveG()
public static double normSqrd(double[] v)
public org.ejml.data.DenseMatrix64F buildDisplacements(double[][] targetLandmarks)
public org.ejml.data.DenseMatrix64F buildDisplacements(float[][] targetLandmarks)
protected void computeW(org.ejml.data.DenseMatrix64F yMatrix)
Implements Equation (5) in Davis et al. and calls reorganizeW.
yMatrix
- the y matrixprotected org.ejml.data.DenseMatrix64F computeL(org.ejml.data.DenseMatrix64F kMatrix, org.ejml.data.DenseMatrix64F pMatrix)
protected void computeP(org.ejml.data.DenseMatrix64F pMatrix)
protected void computeK(org.ejml.data.DenseMatrix64F kMatrix)
kMatrix
- the k matrixprotected void reorganizeW(org.ejml.data.DenseMatrix64F wMatrix)
wMatrix
- the w matrixpublic void computeG(double[] pt, org.ejml.data.DenseMatrix64F mtx)
public void computeG(double[] pt, org.ejml.data.DenseMatrix64F mtx, double w)
public void computeDeformationContribution(double[] thispt, double[] result)
public double[][] r2LogrDerivative(double[] p)
p
- The point at which to evaluate the derivativepublic double[][] jacobian(double[] p)
The result is stored in a new double array where element [ i ][ j ] gives the derivative of variable i with respect to variable j
p
- the pointpublic void stepInDerivativeDirection(double[][] derivative, double[] start, double[] dest, double stepLength)
public void printXfmBacks2d(int maxx, int maxy, int delx, int dely)
public double[] transformPointAffine(double[] pt)
pt
- the point to be transformedpublic void apply(double[] pt, double[] result)
public void apply(double[] pt, double[] result, boolean debug)
pt
- the pointresult
- the resultdebug
- do debugpublic double[] apply(double[] pt)
pt
- the point to be transformedpublic void applyInPlace(double[] pt)
pt
- the pointpublic jitk.spline.ThinPlateR2LogRSplineKernelTransform.IndexDistancePair closestTargetLandmarkAndDistance(double[] target)
target
- the pointpublic double[] initialGuessAtInverse(double[] target)
target
- the target pointpublic double[] inverseGuessAffineInv(double[] target)
target
- a point in the target spacepublic double inverse(double[] target, double[] result, double tolerance, int maxIters)
target
- the target pointresult
- array in which to store the resulttolerance
- the desired precision - must be greater than zeromaxIters
- maximum number of iterationspublic double[] inverse(double[] target, double tolerance)
target
- the target pointtolerance
- the desired precision - must be greater than zeropublic double inverseTol(double[] target, double[] guess, double tolerance, int maxIters)
protected void srcPtDisplacement(int i, int j, double[] res)
i
- first indexj
- second indexres
- resultprotected void srcPtDisplacement(int i, double[] pt, double[] res)
i
- first indexpt
- the pointres
- the resultprotected void tgtPtDisplacement(int i, double[] pt, double[] res)
i
- first indexpt
- the pointres
- the resultpublic static double r2Logr(double r)
public static double r2LogrFromDisplacement(double[] displacement)
Copyright © 2015–2021 Fiji. All rights reserved.