|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbunwarpj.Transformation
public class Transformation
Class to perform the transformation for bUnwarpJ:
doRegistration (bidirectional) and doUnidirectionalRegistration (unidirectional).outputLevel.
| Nested Class Summary | |
|---|---|
private class |
Transformation.ColorResultTileMaker
Class to run concurrent tile windows for final results (color) |
private class |
Transformation.ConcurrentDeformation
Class to concurrently calculate the two deformation mapping tables |
private class |
Transformation.EvaluateConsistencyTile
Class to run concurrent consistency evaluation |
private class |
Transformation.EvaluateSimilarityTile
Class to run concurrent similarity evaluation |
private class |
Transformation.GrayscaleResultTileMaker
Class to run concurrent tile windows for final results (grayscale) |
private class |
Transformation.OutputTileMaker
Class to run concurrent tile windows updaters (for intermediate results) |
| Field Summary | |
|---|---|
private int |
accurate_mode
level of accuracy |
private double |
consistencyWeight
weight for the deformations consistency |
private double |
curlWeight
curl weight |
private double[][] |
cxSourceToTarget
x- B-spline coefficients keeping the transformation from source to target |
private double[][] |
cxTargetToSource
x- B-spline coefficients keeping the transformation from target to source |
private double[][] |
cySourceToTarget
y- B-spline coefficients keeping the transformation from source to target |
private double[][] |
cyTargetToSource
y- B-spline coefficients keeping the transformation from target to source |
private MainDialog |
dialog
pointer to the dialog of the bUnwarpJ interface |
private double |
divWeight
divergence weight |
private double |
finalDirectConsistencyError
direct consistency error at the end of the registration |
private double |
finalDirectLandmarkError
direct landmarks error at the end of the registration |
private double |
finalDirectRegularizationError
direct regularization error at the end of the registration |
private double |
finalDirectSimilarityError
direct similarity error at the end of the registration |
private double |
finalInverseConsistencyError
inverse consistency error at the end of the registration |
private double |
finalInverseLandmarkError
inverse landmarks error at the end of the registration |
private double |
finalInverseRegularizationError
inverse regularization error at the end of the registration |
private double |
finalInverseSimilarityError
inverse similarity error at the end of the registration |
private double |
FLT_EPSILON
float epsilon |
private java.lang.String |
fn_tnf_1
direct transformation file name |
private java.lang.String |
fn_tnf_2
inverse transformation file name |
private double |
imageWeight
weight for image similarity |
private int |
intervals
number of intervals to place B-spline coefficients |
private double |
landmarkWeight
landmark weight |
private int |
max_scale_deformation
maximum scale deformation |
private int |
min_scale_deformation
minimum scale deformation |
private int |
min_scale_image
minimum scale image |
private boolean |
ORIGINAL
original flag |
private ij.process.ImageProcessor |
originalSourceIP
initial source image processor |
private ij.process.ImageProcessor |
originalTargetIP
initial target image processor |
private ij.ImagePlus |
output_ip_1
reference to the first output image |
private ij.ImagePlus |
output_ip_2
reference to the second output image |
private int |
outputLevel
flag to specify the level of resolution in the output |
private double[][] |
P11_SourceToTarget
regularization P11 (source to target) matrix |
private double[][] |
P11_TargetToSource
regularization P11 (target to source) matrix |
private double[][] |
P12_SourceToTarget
regularization P12 (source to target) matrix |
private double[][] |
P12_TargetToSource
regularization P12 (target to source) matrix |
private double[][] |
P22_SourceToTarget
regularization P22 (source to target) matrix |
private double[][] |
P22_TargetToSource
regularization P22 (target to source) matrix |
private double |
partialDirectConsitencyError
direct consistency error for the current iteration |
private double |
partialDirectLandmarkError
direct landmarks error for the current iteration |
private double |
partialDirectRegularizationError
direct regularization error for the current iteration |
private double |
partialDirectSimilarityError
direct similarity error for the current iteration |
private double |
partialInverseConsitencyError
inverse consistency error for the current iteration |
private double |
partialInverseLandmarkError
inverse landmarks error for the current iteration |
private double |
partialInverseRegularizationError
inverse regularization error for the current iteration |
private double |
partialInverseSimilarityError
inverse similarity error for the current iteration |
private boolean |
PYRAMID
pyramid flag |
private boolean |
showMarquardtOptim
flag to show the optimizer |
private BSplineModel |
source
pointer to the source image model |
private double[][] |
sourceAffineMatrix
initial affine matrix for the source image |
private int |
sourceCurrentHeight
source image current height |
private int |
sourceCurrentWidth
source image current width |
private double |
sourceFactorHeight
height factor in the source image |
private double |
sourceFactorWidth
width factor in the source image |
private int |
sourceHeight
source image height |
private ij.ImagePlus |
sourceImp
pointer to the source image representation |
private Mask |
sourceMsk
pointer to the source mask |
private PointHandler |
sourcePh
pointer to the source point handler |
private int |
sourceWidth
source image width |
private double |
stopThreshold
stopping threshold |
private BSplineModel |
swxSourceToTarget
image model to interpolate the cxSourceToTarget coefficients |
private BSplineModel |
swxTargetToSource
image model to interpolate the cxTargetToSource coefficients |
private BSplineModel |
swySourceToTarget
image model to interpolate the cySourceToTarget coefficients |
private BSplineModel |
swyTargetToSource
image model to interpolate the cyTargetToSource coefficients |
private BSplineModel |
target
pointer to the target image model |
private double[][] |
targetAffineMatrix
initial affine matrix for the target image |
private int |
targetCurrentHeight
target image current height |
private int |
targetCurrentWidth
target image current width |
private double |
targetFactorHeight
height factor in the target image |
private double |
targetFactorWidth
width factor in the target image |
private int |
targetHeight
target image height |
private ij.ImagePlus |
targetImp
pointer to the target image representation |
private Mask |
targetMsk
pointer to the target mask |
private PointHandler |
targetPh
pointer to the target point handler |
private int |
targetWidth
source image width |
private int |
transformationSplineDegree
degree of the B-splines involved in the transformation |
| Constructor Summary | |
|---|---|
Transformation(ij.ImagePlus sourceImp,
ij.ImagePlus targetImp,
BSplineModel source,
BSplineModel target,
PointHandler sourcePh,
PointHandler targetPh,
Mask sourceMsk,
Mask targetMsk,
double[][] sourceAffineMatrix,
double[][] targetAffineMatrix,
int min_scale_deformation,
int max_scale_deformation,
int min_scale_image,
double divWeight,
double curlWeight,
double landmarkWeight,
double imageWeight,
double consistencyWeight,
double stopThreshold,
int outputLevel,
boolean showMarquardtOptim,
int accurate_mode,
java.lang.String fn_tnf_1,
java.lang.String fn_tnf_2,
ij.ImagePlus output_ip_1,
ij.ImagePlus output_ip_2,
MainDialog dialog)
Create an instance of Transformation. |
|
Transformation(ij.ImagePlus sourceImp,
ij.ImagePlus targetImp,
BSplineModel source,
BSplineModel target,
PointHandler sourcePh,
PointHandler targetPh,
Mask sourceMsk,
Mask targetMsk,
double[][] sourceAffineMatrix,
double[][] targetAffineMatrix,
int min_scale_deformation,
int max_scale_deformation,
int min_scale_image,
double divWeight,
double curlWeight,
double landmarkWeight,
double imageWeight,
double consistencyWeight,
double stopThreshold,
int outputLevel,
boolean showMarquardtOptim,
int accurate_mode,
java.lang.String fn_tnf_1,
java.lang.String fn_tnf_2,
ij.ImagePlus output_ip_1,
ij.ImagePlus output_ip_2,
MainDialog dialog,
ij.process.ImageProcessor originalSourceIP,
ij.process.ImageProcessor originalTargetIP)
Create an instance of Transformation. |
|
| Method Summary | |
|---|---|
private ij.ImagePlus |
applyTransformationMultiThread(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
Apply the final transformation (multi-thread version). |
private void |
build_Matrix_B(int intervals,
int K,
double[][] B,
boolean bIsReverse)
Build the matrix for the landmark interpolation. |
private double |
build_Matrix_R_computeIntegral_aa(double x0,
double xF,
double s1,
double s2,
double h,
int q1,
int q2)
Compute the following integral |
private double |
build_matrix_R_computeIntegral_BB(double x0,
double xF,
double s1,
double s2,
double h,
int n1,
int n2)
Compute the following integral |
private double |
build_matrix_R_computeIntegral_xx(double x0,
double xF,
double s1,
double s2,
int q1,
int q2)
|
private void |
build_Matrix_R_geteta(double[][] etaq1q2,
int q1,
int q2,
int dim,
int intervals)
Build matrix R, get eta. |
private boolean |
build_Matrix_R_getetaindex(int ki1,
int ki2,
int intervals,
int[] ip)
Build matrix R, get eta index. |
private void |
build_Matrix_Rq1q2(int intervals,
double weight,
int q1,
int q2,
double[][] R,
boolean bIsReverse)
Build matrix Rq1q2. |
private void |
build_Matrix_Rq1q2q3q4(int intervals,
double weight,
int q1,
int q2,
int q3,
int q4,
double[][] R,
boolean bIsReverse)
Build matrix Rq1q2q3q4. |
private void |
buildRegularizationTemporary(int intervals,
boolean bIsReverse)
Build regularization temporary. |
private double[][] |
computeAffineMatrix(boolean bIsReverse)
Compute the affine matrix. |
private void |
computeAffineResidues(double[][] affineMatrix,
double[] dx,
double[] dy,
boolean bIsReverse)
Deprecated. |
private boolean |
computeCoefficientsScale(int intervals,
double[] dx,
double[] dy,
double[][] cx,
double[][] cy,
boolean bIsReverse)
Compute the coefficients at this scale. |
private boolean |
computeCoefficientsScaleWithRegularization(int intervals,
double[] dx,
double[] dy,
double[][] cx,
double[][] cy,
boolean bIsReverse)
Compute the coefficients scale with regularization. |
private void |
computeDeformation(int intervals,
double[][] cx,
double[][] cy,
double[][] transformation_x,
double[][] transformation_y,
boolean bIsReverse)
Compute the deformation. |
private void |
computeDeformationGrid(int intervals,
double[][] cx,
double[][] cy,
ij.ImageStack is,
boolean bIsReverse)
Compute and draw the final deformation grid. |
private void |
computeDeformationVectors(int intervals,
double[][] cx,
double[][] cy,
ij.ImageStack is,
boolean bIsReverse)
Compute and draw the final deformation vectors. |
private void |
computeInitialResidues(double[] dx,
double[] dy,
boolean bIsReverse)
Deprecated. |
private double[][] |
computeRotationMatrix(boolean bIsReverse)
Compute the rotation matrix. |
private void |
computeScaleResidues(int intervals,
double[][] cx,
double[][] cy,
double[] dx,
double[] dy,
boolean bIsReverse)
Deprecated. |
private void |
computeTotalWorkload()
This code is an excerpt from doRegistration() to compute the exact number of steps. |
void |
doRegistration()
Registration method. |
void |
doUnidirectionalRegistration()
Unidirectional registration method. |
private double |
energyFunction(double[] c,
int intervals,
double[] grad,
boolean only_image,
boolean show_error)
Energy function to be minimized by the optimizer in the bidirectional case. |
private double |
evaluateConsistency(double[] c_direct,
double[] c_inverse,
int intervals,
double[] grad)
Deprecated. |
private double |
evaluateConsistency(int intervals,
double[] grad)
Deprecated. |
private double |
evaluateConsistencyMultiThread(int intervals,
double[] grad)
Calculate the geometric error between the source-target and target-source deformations. |
double |
evaluateImageSimilarity(boolean bIsReverse)
Evaluate the similarity between the images. |
private double |
evaluatePartialEnergy(double[] c,
int intervals,
double[] grad_direct,
double[] grad_inverse,
boolean only_image,
boolean show_error,
boolean bIsReverse)
Evaluate the energy function in one direction (direct or inverse) and calculates its gradient. |
private double |
evaluateSimilarity(double[] c,
int intervals,
double[] grad,
boolean only_image,
boolean show_error,
boolean bIsReverse)
Deprecated. |
private double |
evaluateSimilarityMultiThread(double[] c,
int intervals,
double[] grad,
boolean only_image,
boolean bIsReverse)
Evaluate the similarity between the source and the target images but also the transformation regularization and and landmarks energy term if necessary. |
void |
getDeformation(double[][] transformation_x,
double[][] transformation_y,
boolean bIsReverse)
Get the deformation from the corresponding coefficients. |
double[][] |
getDirectDeformationCoefficientsX()
Get the direct deformation X coefficients. |
double[][] |
getDirectDeformationCoefficientsY()
Get the direct deformation Y coefficients. |
ij.ImagePlus |
getDirectResults()
Get direct results window |
int |
getIntervals()
Get the current number of intervals between B-spline coefficients. |
double[][] |
getInverseDeformationCoefficientsX()
Get the inverse deformation X coefficients. |
double[][] |
getInverseDeformationCoefficientsY()
Get the inverse deformation Y coefficients. |
ij.ImagePlus |
getInverseResults()
Get inverse results window |
private void |
Marquardt_it(double[] x,
boolean[] optimize,
double[] gradient,
double[] Hessian,
double lambda)
In this function the system (H+lambda*Diag(H))*update=gradient is solved for update. |
private double |
optimizeCoeffs(int intervals,
double thChangef,
double[][] cxTargetToSource,
double[][] cyTargetToSource)
Optimize the B-spline coefficients (unidirectional method). |
private double |
optimizeCoeffs(int intervals,
double thChangef,
double[][] cxTargetToSource,
double[][] cyTargetToSource,
double[][] cxSourceToTarget,
double[][] cySourceToTarget)
Optimize the B-spline coefficients (bidirectional method). |
private double[][] |
propagateCoeffsToNextLevel(int intervals,
double[][] c,
double expansionFactor)
Propagate deformation coefficients to the next level. |
void |
saveDirectTransformation()
Save source transformation. |
void |
saveInverseTransformation()
Save target transformation. |
private void |
saveTransformation(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
Save the transformation. |
void |
showDirectResults()
Show the direct transformation results(multi-thread version). |
void |
showInverseResults()
Show the inverse transformation results (multi-thread version). |
private void |
showTransformation(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
Deprecated. |
private void |
showTransformationMultiThread(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
Show the transformation (multi-thread version). |
void |
transform(double u,
double v,
double[] xyF,
boolean bIsReverse)
Apply the current transformation to a given point. |
private void |
update_current_output(double[] c,
int intervals,
boolean bIsReverse)
Method to update a current output (multi-thread). |
private void |
update_outputs(double[] c,
int intervals)
Method to update both current outputs (source-target and target-source). |
private double[] |
xWeight(double x,
int xIntervals,
boolean extended,
boolean bIsReverse)
Calculate the cubic B-spline x weight. |
private double[] |
yWeight(double y,
int yIntervals,
boolean extended,
boolean bIsReverse)
Calculate the cubic B-spline y weight. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final double FLT_EPSILON
private final boolean PYRAMID
private final boolean ORIGINAL
private final int transformationSplineDegree
private ij.ImagePlus output_ip_1
private ij.ImagePlus output_ip_2
private MainDialog dialog
private ij.ImagePlus sourceImp
private ij.ImagePlus targetImp
private BSplineModel source
private BSplineModel target
private ij.process.ImageProcessor originalSourceIP
private ij.process.ImageProcessor originalTargetIP
private PointHandler sourcePh
private PointHandler targetPh
private Mask sourceMsk
private Mask targetMsk
private double[][] sourceAffineMatrix
private double[][] targetAffineMatrix
private int sourceHeight
private int sourceWidth
private int targetHeight
private int targetWidth
private int targetCurrentHeight
private int targetCurrentWidth
private int sourceCurrentHeight
private int sourceCurrentWidth
private double targetFactorHeight
private double targetFactorWidth
private double sourceFactorHeight
private double sourceFactorWidth
private double partialDirectSimilarityError
private double partialDirectRegularizationError
private double partialDirectLandmarkError
private double partialDirectConsitencyError
private double finalDirectSimilarityError
private double finalDirectRegularizationError
private double finalDirectLandmarkError
private double finalDirectConsistencyError
private double partialInverseSimilarityError
private double partialInverseRegularizationError
private double partialInverseLandmarkError
private double partialInverseConsitencyError
private double finalInverseSimilarityError
private double finalInverseRegularizationError
private double finalInverseLandmarkError
private double finalInverseConsistencyError
private int min_scale_deformation
private int max_scale_deformation
private int min_scale_image
private int outputLevel
private boolean showMarquardtOptim
private double divWeight
private double curlWeight
private double landmarkWeight
private double imageWeight
private double consistencyWeight
private double stopThreshold
private int accurate_mode
private java.lang.String fn_tnf_1
private java.lang.String fn_tnf_2
private int intervals
private double[][] cxSourceToTarget
private double[][] cySourceToTarget
private double[][] cxTargetToSource
private double[][] cyTargetToSource
private BSplineModel swxSourceToTarget
private BSplineModel swySourceToTarget
private BSplineModel swxTargetToSource
private BSplineModel swyTargetToSource
private double[][] P11_SourceToTarget
private double[][] P22_SourceToTarget
private double[][] P12_SourceToTarget
private double[][] P11_TargetToSource
private double[][] P22_TargetToSource
private double[][] P12_TargetToSource
| Constructor Detail |
|---|
public Transformation(ij.ImagePlus sourceImp,
ij.ImagePlus targetImp,
BSplineModel source,
BSplineModel target,
PointHandler sourcePh,
PointHandler targetPh,
Mask sourceMsk,
Mask targetMsk,
double[][] sourceAffineMatrix,
double[][] targetAffineMatrix,
int min_scale_deformation,
int max_scale_deformation,
int min_scale_image,
double divWeight,
double curlWeight,
double landmarkWeight,
double imageWeight,
double consistencyWeight,
double stopThreshold,
int outputLevel,
boolean showMarquardtOptim,
int accurate_mode,
java.lang.String fn_tnf_1,
java.lang.String fn_tnf_2,
ij.ImagePlus output_ip_1,
ij.ImagePlus output_ip_2,
MainDialog dialog)
sourceImp - image representation for the sourcetargetImp - image representation for the targetsource - source image modeltarget - target image modelsourcePh - point handler for the landmarks in the source imagetargetPh - point handler for the landmarks in the target imagesourceMsk - source image masktargetMsk - target image masksourceAffineMatrix - source initial affine matrixtargetAffineMatrix - source initial affine matrixmin_scale_deformation - minimum scale deformationmax_scale_deformation - maximum scale deformationmin_scale_image - minimum image scaledivWeight - divergence weightcurlWeight - curl weightlandmarkWeight - landmark weightimageWeight - weight for image similarityconsistencyWeight - weight for the deformations consistencystopThreshold - stopping thresholdoutputLevel - flag to specify the level of resolution in the outputshowMarquardtOptim - flag to show the optimizeraccurate_mode - level of accuracyfn_tnf_1 - direct transformation file namefn_tnf_2 - inverse transformation file nameoutput_ip_1 - pointer to the first output imageoutput_ip_2 - pointer to the second output imagedialog - pointer to the dialog of the bUnwarpJ interface
public Transformation(ij.ImagePlus sourceImp,
ij.ImagePlus targetImp,
BSplineModel source,
BSplineModel target,
PointHandler sourcePh,
PointHandler targetPh,
Mask sourceMsk,
Mask targetMsk,
double[][] sourceAffineMatrix,
double[][] targetAffineMatrix,
int min_scale_deformation,
int max_scale_deformation,
int min_scale_image,
double divWeight,
double curlWeight,
double landmarkWeight,
double imageWeight,
double consistencyWeight,
double stopThreshold,
int outputLevel,
boolean showMarquardtOptim,
int accurate_mode,
java.lang.String fn_tnf_1,
java.lang.String fn_tnf_2,
ij.ImagePlus output_ip_1,
ij.ImagePlus output_ip_2,
MainDialog dialog,
ij.process.ImageProcessor originalSourceIP,
ij.process.ImageProcessor originalTargetIP)
sourceImp - image representation for the sourcetargetImp - image representation for the targetsource - source image modeltarget - target image modelsourcePh - point handler for the landmarks in the source imagetargetPh - point handler for the landmarks in the target imagesourceMsk - source image masktargetMsk - target image masksourceAffineMatrix - source initial affine matrixtargetAffineMatrix - source initial affine matrixmin_scale_deformation - minimum scale deformationmax_scale_deformation - maximum scale deformationmin_scale_image - minimum image scaledivWeight - divergence weightcurlWeight - curl weightlandmarkWeight - landmark weightimageWeight - weight for image similarityconsistencyWeight - weight for the deformations consistencystopThreshold - stopping thresholdoutputLevel - flag to specify the level of resolution in the outputshowMarquardtOptim - flag to show the optimizeraccurate_mode - level of accuracyfn_tnf_1 - direct transformation file namefn_tnf_2 - inverse transformation file nameoutput_ip_1 - pointer to the first output imageoutput_ip_2 - pointer to the second output imagedialog - pointer to the dialog of the bUnwarpJ interface| Method Detail |
|---|
public void doRegistration()
public void doUnidirectionalRegistration()
public double evaluateImageSimilarity(boolean bIsReverse)
bIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
public void getDeformation(double[][] transformation_x,
double[][] transformation_y,
boolean bIsReverse)
transformation_x - matrix to store the x- transformationtransformation_y - matrix to store the y- transformationbIsReverse - flag to choose the deformation coefficients
(source-target=TRUE or target-source=FALSE)public double[][] getDirectDeformationCoefficientsX()
public double[][] getDirectDeformationCoefficientsY()
public double[][] getInverseDeformationCoefficientsX()
public double[][] getInverseDeformationCoefficientsY()
public int getIntervals()
public void transform(double u,
double v,
double[] xyF,
boolean bIsReverse)
u - input, x- point coordinatev - input, y- point coordinatexyF - output, transformed pointbIsReverse - flag to decide the transformation direction (direct-inverse)
(source-target=TRUE or target-source=FALSE)
private void build_Matrix_B(int intervals,
int K,
double[][] B,
boolean bIsReverse)
intervals - Intervals in the deformationK - Number of landmarksB - System matrix of the landmark interpolationbIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
private void build_Matrix_Rq1q2(int intervals,
double weight,
int q1,
int q2,
double[][] R,
boolean bIsReverse)
private void build_Matrix_Rq1q2q3q4(int intervals,
double weight,
int q1,
int q2,
int q3,
int q4,
double[][] R,
boolean bIsReverse)
private double build_Matrix_R_computeIntegral_aa(double x0,
double xF,
double s1,
double s2,
double h,
int q1,
int q2)
xF d^q1 3 x d^q2 3 x
integral ----- B (--- - s1) ----- B (--- - s2) dx
x0 dx^q1 h dx^q2 h
private double build_matrix_R_computeIntegral_BB(double x0,
double xF,
double s1,
double s2,
double h,
int n1,
int n2)
xF n1 x n2 x
integral B (--- - s1) B (--- - s2) dx
x0 h h
private double build_matrix_R_computeIntegral_xx(double x0,
double xF,
double s1,
double s2,
int q1,
int q2)
Computation of the integral:
xF q1 q2
integral (x-s1) (x-s2) dx
x0 + +
private void build_Matrix_R_geteta(double[][] etaq1q2,
int q1,
int q2,
int dim,
int intervals)
private boolean build_Matrix_R_getetaindex(int ki1,
int ki2,
int intervals,
int[] ip)
private void buildRegularizationTemporary(int intervals,
boolean bIsReverse)
intervals - intervals in the deformationbIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)private double[][] computeAffineMatrix(boolean bIsReverse)
bIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
private void computeAffineResidues(double[][] affineMatrix,
double[] dx,
double[] dy,
boolean bIsReverse)
NOTE: The output vectors should be already resized
affineMatrix - Inputdx - Output, difference in x for each landmarkdy - Output, difference in y for each landmarkbIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
private boolean computeCoefficientsScale(int intervals,
double[] dx,
double[] dy,
double[][] cx,
double[][] cy,
boolean bIsReverse)
intervals - input, number of intervals at this scaledx - input, x residue so fardy - input, y residue so farcx - output, x coefficients for splinescy - output, y coefficients for splinesbIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
private boolean computeCoefficientsScaleWithRegularization(int intervals,
double[] dx,
double[] dy,
double[][] cx,
double[][] cy,
boolean bIsReverse)
intervals - input, number of intervals at this scaledx - input, x residue so fardy - input, y residue so farcx - output, x coefficients for splinescy - output, y coefficients for splinesbIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
private void computeInitialResidues(double[] dx,
double[] dy,
boolean bIsReverse)
NOTE: The output vectors should be already resized
dx - output, difference in x for each landmarkdy - output, difference in y for each landmarkbIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
private void computeDeformation(int intervals,
double[][] cx,
double[][] cy,
double[][] transformation_x,
double[][] transformation_y,
boolean bIsReverse)
intervals - input, number of intervalscx - input, X B-spline coefficientscy - input, Y B-spline coefficientstransformation_x - output, X transformation maptransformation_y - output, Y transformation mapbIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)private double[][] computeRotationMatrix(boolean bIsReverse)
bIsReverse - determines the transformation direction (source-target=TRUE or target-source=FALSE)
private void computeScaleResidues(int intervals,
double[][] cx,
double[][] cy,
double[] dx,
double[] dy,
boolean bIsReverse)
NOTE: At the input dx and dy have the residues so far, at the output these residues are modified to account for the model at the new scale
intervals - input, number of intervalscx - input, X B-spline coefficientscy - input, Y B-spline coefficientsdx - input/output, X residuesdy - input/output, Y residuesbIsReverse - determines the transformation direction (target-source=FALSE or source-target=TRUE)private void computeTotalWorkload()
private double evaluateConsistency(int intervals,
double[] grad)
intervals - Input: Number of intervals for the deformationgrad - Output: Gradient of the function
private double evaluateConsistency(double[] c_direct,
double[] c_inverse,
int intervals,
double[] grad)
c_direct - Input: Direct deformation coefficientsc_inverse - Input: Inverse deformation coefficientsintervals - Input: Number of intervals for the deformationgrad - Output: Gradient of the function
private double energyFunction(double[] c,
int intervals,
double[] grad,
boolean only_image,
boolean show_error)
c - Input: Deformation coefficientsintervals - Input: Number of intervals for the deformationgrad - Output: Gradient of the functiononly_image - Input: if true, only the image term is considered and not the regularizationshow_error - Input: if true, an image is shown with the error
private double evaluateSimilarity(double[] c,
int intervals,
double[] grad,
boolean only_image,
boolean show_error,
boolean bIsReverse)
c - Input: Deformation coefficientsintervals - Input: Number of intervals for the deformationgrad - Output: Gradient of the similarityonly_image - Input: if true, only the image term is considered and not the regularizationshow_error - Input: if true, an image is shown with the errorbIsReverse - Input: flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private double evaluatePartialEnergy(double[] c,
int intervals,
double[] grad_direct,
double[] grad_inverse,
boolean only_image,
boolean show_error,
boolean bIsReverse)
Energy function:
E = w_i * E_similarity + w_l * E_landmarks + (w_r * E_rotational + w_d * E_divergence) + w_c * E_consistency
c - Input: Deformation coefficientsintervals - Input: Number of intervals for the deformationgrad_direct - Output: Gradient of the energy function (direct direction)grad_inverse - Output: Gradient of the energy function (inverse direction)only_image - Input: if true, only the image term is considered and not the regularizationshow_error - Input: if true, an image is shown with the errorbIsReverse - Input: flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private void Marquardt_it(double[] x,
boolean[] optimize,
double[] gradient,
double[] Hessian,
double lambda)
private double optimizeCoeffs(int intervals,
double thChangef,
double[][] cxTargetToSource,
double[][] cyTargetToSource,
double[][] cxSourceToTarget,
double[][] cySourceToTarget)
intervals - number of intervals in the deformationthChangef - cxTargetToSource - x- B-spline coefficients storing the target to source deformationcyTargetToSource - y- B-spline coefficients storing the target to source deformationcxSourceToTarget - x- B-spline coefficients storing the source to target deformationcySourceToTarget - y- B-spline coefficients storing the source to target deformation
private double optimizeCoeffs(int intervals,
double thChangef,
double[][] cxTargetToSource,
double[][] cyTargetToSource)
intervals - number of intervals in the deformationthChangef - cxTargetToSource - x- B-spline coefficients storing the target to source deformationcyTargetToSource - y- B-spline coefficients storing the target to source deformation
private double[][] propagateCoeffsToNextLevel(int intervals,
double[][] c,
double expansionFactor)
intervals - number of intervals in the deformationc - B-spline coefficientsexpansionFactor - due to the change of size in the represented image
public void saveDirectTransformation()
public void saveInverseTransformation()
private void saveTransformation(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
intervals - number of intervals in the deformationcx - x- deformation coefficientscy - y- deformation coefficientsbIsReverse - flat to determine the transformation direction
private void computeDeformationGrid(int intervals,
double[][] cx,
double[][] cy,
ij.ImageStack is,
boolean bIsReverse)
intervals - number of intervals in the deformationcx - x- deformation coefficientscy - y- deformation coefficientsis - image stack where we want to show the deformation gridbIsReverse - flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private void computeDeformationVectors(int intervals,
double[][] cx,
double[][] cy,
ij.ImageStack is,
boolean bIsReverse)
intervals - number of intervals in the deformationcx - x- deformation coefficientscy - y- deformation coefficientsis - image stack where we want to show the deformation vectorsbIsReverse - flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)public void showDirectResults()
public void showInverseResults()
private void showTransformationMultiThread(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
intervals - number of intervals in the deformationcx - x- deformation coefficientscy - y- deformation coefficientsbIsReverse - flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)public ij.ImagePlus getDirectResults()
public ij.ImagePlus getInverseResults()
private ij.ImagePlus applyTransformationMultiThread(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
intervals - number of intervals in the deformationcx - x- deformation coefficientscy - y- deformation coefficientsbIsReverse - flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private void showTransformation(int intervals,
double[][] cx,
double[][] cy,
boolean bIsReverse)
intervals - number of intervals in the deformationcx - x- deformation coefficientscy - y- deformation coefficientsbIsReverse - flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private void update_outputs(double[] c,
int intervals)
c - B-spline coefficientsintervals - number of intervals in the deformation
private void update_current_output(double[] c,
int intervals,
boolean bIsReverse)
c - B-spline coefficientsintervals - number of intervals in the deformationbIsReverse - flag to decide the deformation direction (source-target, target-source)
private double[] xWeight(double x,
int xIntervals,
boolean extended,
boolean bIsReverse)
x - x- valuexIntervals - x- number of intervalsextended - extended flatbIsReverse - flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private double[] yWeight(double y,
int yIntervals,
boolean extended,
boolean bIsReverse)
y - y- valueyIntervals - y- number of intervalsextended - extended flatbIsReverse - flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private double evaluateSimilarityMultiThread(double[] c,
int intervals,
double[] grad,
boolean only_image,
boolean bIsReverse)
c - Input: Deformation coefficientsintervals - Input: Number of intervals for the deformationgrad - Output: Gradient of the similarityonly_image - Input: if true, only the image term is considered and not the regularizationbIsReverse - Input: flag to determine the transformation direction (target-source=FALSE or source-target=TRUE)
private double evaluateConsistencyMultiThread(int intervals,
double[] grad)
intervals - Input: Number of intervals for the deformationgrad - Output: Gradient of the function
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||