|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbunwarpj.BSplineModel
public class BSplineModel
Class for representing the images and the deformations by cubic B-splines:
startPyramids.
| Field Summary | |
|---|---|
private boolean |
bSubsampledOutput
flag for using subsampled output image |
private double[] |
coefficient
image spline coefficients |
private boolean |
coefficientsAreMirrored
flag to check if the coefficients are mirrored |
private java.util.Stack |
cpyramid
stack of coefficients pyramid |
private double[] |
currentCoefficient
current image spline coefficients |
private int |
currentDepth
current pyramid depth |
private int |
currentHeight
current image height |
private double[] |
currentImage
current image (at the current resolution level) |
private int |
currentWidth
current image width |
private double[] |
d2xWeight
x component of the weight of second derivative spline |
private double[] |
d2yWeight
y component of the weight of second derivative spline |
private double[] |
dxWeight
x component of the weight of derivative spline |
private double[] |
dyWeight
y component of the weight of derivative spline |
private boolean |
fromCurrent
Interpolation source (current or original) |
private int |
height
working image height (after scaling) |
private int |
heightToUse
height of the image used for the interpolation |
private double[] |
image
working image at maximum resolution (after scaling) |
private java.util.Stack |
imgpyramid
stack of image pyramid |
private ij.process.ImageProcessor |
ip
image information (after corresponding scaling) |
private boolean |
isTarget
flag to check target image |
static int |
MAX_OUTPUT_SIZE
maximum output window dimensions |
private int |
maxImageSubsamplingFactor
sub-sampling factor at highest image resolution level (always a power of 2) |
private static int |
min_image_size
minimum image size |
private double[] |
original_image
original image, full-size without scaling |
private int |
originalHeight
original image height (at full-resolution, without scaling) |
private int |
originalWidth
original image width (at full-resolution, without scaling) |
private double[][] |
prec_d2xWeight
precomputed x component of the weight of second derivative spline |
private double[][] |
prec_d2yWeight
precomputed y component of the weight of second derivative spline |
private double[][] |
prec_dxWeight
precomputed x component of the weight of derivative spline |
private double[][] |
prec_dyWeight
precomputed y component of the weight of derivative spline |
int[][] |
prec_xIndex
precomputed x index |
private double[][] |
prec_xWeight
precomputed x component of the weight of the spline |
int[][] |
prec_yIndex
precomputed y index |
private double[][] |
prec_yWeight
precomputed y component of the weight of the spline |
private int |
pyramidDepth
resolution pyramid depth |
private int |
smallestHeight
smallest image height |
private int |
smallestWidth
smallest image width |
private double[] |
subCoeffs
subsampled output image B-spline coefficients |
private int |
subHeight
height of the subsampled output image |
private double[] |
subImage
subsampled output image |
private int |
subWidth
width of the subsampled output image |
private java.lang.Thread |
t
thread to create the model |
private int |
width
working image width (after scaling) |
private int |
widthToUse
width of the image used for the interpolation |
int[] |
xIndex
x index |
private double[] |
xWeight
x component of the weight of the spline |
int[] |
yIndex
y index |
private double[] |
yWeight
y component of the weight of the spline |
| Constructor Summary | |
|---|---|
BSplineModel(double[][] c)
Initialize the model from a set of coefficients. |
|
BSplineModel(double[][] img,
boolean isTarget)
The same as before, but take the image from an array. |
|
BSplineModel(double[] c,
int Ydim,
int Xdim,
int offset)
Initialize the model from a set of coefficients. |
|
BSplineModel(ij.process.ImageProcessor ip,
boolean isTarget,
int maxImageSubsamplingFactor)
Create image model for image processor: image and coefficient pyramid. |
|
| Method Summary | |
|---|---|
private void |
antiSymmetricFirMirrorOffBounds1D(double[] h,
double[] c,
double[] s)
|
private void |
basicToCardinal2D(double[] basic,
double[] cardinal,
int width,
int height,
int degree)
Pass from basic to cardinal. |
private void |
buildCoefficientPyramid()
Build the coefficients pyramid. |
private void |
buildImagePyramid()
Build the image pyramid. |
private void |
cardinalToDual2D(double[] cardinal,
double[] dual,
int width,
int height,
int degree)
Passes from cardinal to dual (2D). |
void |
clearPyramids()
Clear the pyramid. |
private void |
coefficientToGradient1D(double[] c)
Pass coefficients to gradient (1D). |
private void |
coefficientToSamples1D(double[] c)
Pass coefficients to samples. |
private void |
coefficientToXYGradient2D(double[] basic,
double[] xGradient,
double[] yGradient,
int width,
int height)
Pass coefficients to x,y gradient 2D |
private void |
dualToCardinal2D(double[] dual,
double[] cardinal,
int width,
int height,
int degree)
Pass from dual to cardinal (2D). |
private void |
extractColumn(double[] array,
int width,
int x,
double[] column)
Extract a column from the array. |
private void |
extractRow(double[] array,
int y,
double[] row)
Extract a row from the array . |
private double[] |
getBasicFromCardinal2D()
Get basic from cardinal: convert the 2D image from regular samples to standard B-spline coefficients. |
private double[] |
getBasicFromCardinal2D(double[] cardinal,
int width,
int height,
int degree)
Get basic from cardinal (2D): convert a 2D signal from regular samples to standard B-spline coefficients. |
double[] |
getCoefficients()
Get b-spline coefficients. |
int |
getCurrentDepth()
Get current depth. |
int |
getCurrentHeight()
Get current height. |
double[] |
getCurrentImage()
Get current image. |
int |
getCurrentWidth()
Get current width. |
double |
getFactorHeight()
Get factor height. |
double |
getFactorWidth()
Get fact or width. |
private double[] |
getHalfDual2D(double[] fullDual,
int fullWidth,
int fullHeight)
Get half dual (2D). |
int |
getHeight()
Get height. |
double[] |
getImage()
Get image (at the maximum resolution size determined by the scaling). |
private double |
getInitialAntiCausalCoefficientMirrorOffBounds(double[] c,
double z,
double tolerance)
Get initial anti-causal coefficients mirror of bounds. |
private double |
getInitialCausalCoefficientMirrorOffBounds(double[] c,
double z,
double tolerance)
Get initial causal coefficients mirror of bounds. |
double[] |
getOriginalImage()
Get original image. |
int |
getOriginalImageHeight()
Get original image height. |
int |
getOriginalImageWidth()
Get original image width. |
double |
getPixelValFromPyramid(int x,
int y)
Get the pixel value from the image pyramid. |
int |
getPyramidDepth()
Get pyramid depth. |
int |
getSmallestHeight()
Get smallest height. |
int |
getSmallestWidth()
Get smallest width. |
(package private) int |
getSubHeight()
Get subsampled output height |
double[] |
getSubImage()
Get subsampled output image. |
(package private) int |
getSubWidth()
Get subsampled output width |
java.lang.Thread |
getThread()
Get thread. |
double |
getWeightDx(int l,
int m)
Get weight dx. |
double |
getWeightDxDx(int l,
int m)
Get weight dxdx. |
double |
getWeightDxDy(int l,
int m)
Get weight dxdy. |
double |
getWeightDy(int l,
int m)
Get weight dy. |
double |
getWeightDyDy(int l,
int m)
Get weight dydy. |
double |
getWeightI(int l,
int m)
Get image coefficient weight. |
int |
getWidth()
Get width. |
void |
interpolateD(double[] D)
Interpolate the X and Y derivatives of the image at a given point. |
void |
interpolateD2(double[] D2)
Interpolate the XY, XX and YY derivatives of the image at a given point. |
double |
interpolateDx()
Interpolate the X derivative of the image at a given point. |
double |
interpolateDxDx()
Interpolate the X derivative of the image at a given point. |
double |
interpolateDxDy()
Interpolate the X derivative of the image at a given point. |
double |
interpolateDy()
Interpolate the Y derivative of the image at a given point. |
double |
interpolateDyDy()
Interpolate the X derivative of the image at a given point. |
double |
interpolateI()
Interpolate the image at a given point. |
boolean |
isFinest()
Check if the coefficients pyramid is empty. |
(package private) boolean |
isSubOutput()
Get subsampled output flag |
void |
popFromPyramid()
Pop one element from the coefficients and image pyramids. |
double |
precomputed_getWeightDx(int l,
int m,
int u,
int v)
Get precomputed weight dx. |
double |
precomputed_getWeightDxDx(int l,
int m,
int u,
int v)
Get precomputed weight dxdx |
double |
precomputed_getWeightDxDy(int l,
int m,
int u,
int v)
Get precomputed weight dxdy |
double |
precomputed_getWeightDy(int l,
int m,
int u,
int v)
Get precomputed weight dy |
double |
precomputed_getWeightDyDy(int l,
int m,
int u,
int v)
Get precomputed weight dydy |
double |
precomputed_getWeightI(int l,
int m,
int u,
int v)
Get precomputed weight of coefficient l,m |
int |
precomputed_getWidth()
Get width of precomputed vectors. |
void |
precomputed_interpolateD(double[] D,
int u,
int v)
Interpolate the X and Y derivatives of the image at a given point. |
void |
precomputed_interpolateD2(double[] D2,
int u,
int v)
Interpolate the XY, XX and YY derivatives of the image at a given point. |
double |
precomputed_interpolateI(int u,
int v)
Interpolate the image (or deformation) at a given point using the precomputed weights. |
void |
precomputed_prepareForInterpolation(int Ydim,
int Xdim,
int intervals)
Prepare precomputations for a given image size. |
void |
prepareForInterpolation(double x,
double y,
boolean fromCurrent)
fromCurrent=true --> The interpolation is prepared to be done from the current image in the pyramid. |
double |
prepareForInterpolationAndInterpolateI(double x,
double y,
boolean fromSub,
boolean fromCurrent)
Prepare for interpolation and interpolate fromSub = true --> The interpolation is done from the subsampled version of the image else: fromCurrent=true --> The interpolation is done from the current image in the pyramid. |
double |
prepareForInterpolationAndInterpolateIAndD(double x,
double y,
double[] D,
boolean fromSub,
boolean fromCurrent)
Prepare for interpolation and interpolate the image value and its derivatives fromSub = true --> The interpolation is done from the subsampled version of the image else: fromCurrent=true --> The interpolation is done from the current image in the pyramid. |
private void |
putColumn(double[] array,
int width,
int x,
double[] column)
Put a column in the array. |
private void |
putRow(double[] array,
int y,
double[] row)
Put a row in the array. |
double[] |
reduceCoeffsBy2(double[] c,
int width,
int height)
Reduce coefficients by a factor of 2 (beta) |
private void |
reduceDual1D(double[] c,
double[] s)
Reduce dual (1D). |
void |
run()
Start the image pre-computations. |
private void |
samplesToInterpolationCoefficient1D(double[] c,
int degree,
double tolerance)
Samples to interpolation coefficient (1D). |
void |
setCoefficients(double[] c,
int Ydim,
int Xdim,
int offset)
Set spline coefficients. |
void |
setPyramidDepth(int pyramidDepth)
Sets the depth up to which the pyramids should be computed. |
(package private) void |
setSubOutput(boolean b)
Set subsampled output flag |
void |
setSubsamplingFactor(int maxImageSubsamplingFactor)
Set maximum sub-sampling factor |
void |
startPyramids()
Start coefficient and image pyramids |
private void |
symmetricFirMirrorOffBounds1D(double[] h,
double[] c,
double[] s)
Symmetric FIR filter with mirror off bounds (1D) conditions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int MAX_OUTPUT_SIZE
private static int min_image_size
private ij.process.ImageProcessor ip
private java.lang.Thread t
private final java.util.Stack cpyramid
private final java.util.Stack imgpyramid
private double[] original_image
private double[] image
private double[] coefficient
private double[] currentImage
private double[] currentCoefficient
private int currentWidth
private int currentHeight
private int width
private int height
private int pyramidDepth
private int currentDepth
private int smallestWidth
private int smallestHeight
private boolean isTarget
private boolean coefficientsAreMirrored
private int maxImageSubsamplingFactor
public int[] xIndex
public int[] yIndex
private double[] xWeight
private double[] yWeight
private double[] dxWeight
private double[] dyWeight
private double[] d2xWeight
private double[] d2yWeight
private boolean fromCurrent
private int widthToUse
private int heightToUse
private boolean bSubsampledOutput
private int subWidth
private int subHeight
private double[] subCoeffs
private double[] subImage
public int[][] prec_xIndex
public int[][] prec_yIndex
private double[][] prec_xWeight
private double[][] prec_yWeight
private double[][] prec_dxWeight
private double[][] prec_dyWeight
private double[][] prec_d2xWeight
private double[][] prec_d2yWeight
private int originalWidth
private int originalHeight
| Constructor Detail |
|---|
public BSplineModel(ij.process.ImageProcessor ip,
boolean isTarget,
int maxImageSubsamplingFactor)
ip - image in pixel arrayisTarget - enables the computation of the derivative or notmaxImageSubsamplingFactor - subsampling factor at highest resolution level
public BSplineModel(double[][] img,
boolean isTarget)
img - image in a double arrayisTarget - enables the computation of the derivative or notpublic BSplineModel(double[][] c)
c - Set of B-spline coefficients
public BSplineModel(double[] c,
int Ydim,
int Xdim,
int offset)
c - Set of B-spline coefficientsYdim - Y-dimension of the set of coefficientsXdim - X-dimension of the set of coefficientsoffset - Offset of the beginning of the array with respect to the origin of c| Method Detail |
|---|
public void startPyramids()
public void clearPyramids()
public int getCurrentHeight()
public double[] getCurrentImage()
public int getCurrentWidth()
public double getFactorHeight()
public double getFactorWidth()
public int getCurrentDepth()
public int getHeight()
public double[] getImage()
public double[] getOriginalImage()
public int getOriginalImageWidth()
public int getOriginalImageHeight()
public double[] getSubImage()
public double[] getCoefficients()
public double getPixelValFromPyramid(int x,
int y)
x - x-coordinate of the pixely - y-coordinate of the pixel
public int getPyramidDepth()
public int getSmallestHeight()
public int getSmallestWidth()
public java.lang.Thread getThread()
public int getWidth()
public double getWeightDx(int l,
int m)
public double getWeightDxDx(int l,
int m)
public double getWeightDxDy(int l,
int m)
public double getWeightDy(int l,
int m)
public double getWeightDyDy(int l,
int m)
public double getWeightI(int l,
int m)
public void interpolateD(double[] D)
D - output, interpolation the X and Y derivatives of the imagepublic void interpolateD2(double[] D2)
D2 - output, interpolation of the XY, XX and YY derivatives of the imagepublic double interpolateDx()
public double interpolateDxDx()
public double interpolateDxDy()
public double interpolateDy()
public double interpolateDyDy()
public double interpolateI()
public boolean isFinest()
public void popFromPyramid()
public void prepareForInterpolation(double x,
double y,
boolean fromCurrent)
x - x- point coordinatey - y- point coordinatefromCurrent - flag to determine the image to do the interpolation from
public double prepareForInterpolationAndInterpolateI(double x,
double y,
boolean fromSub,
boolean fromCurrent)
x - x- point coordinatey - y- point coordinatefromSub - flat to determine to do the interpolation from the subsampled version of the imagefromCurrent - flag to determine the image to do the interpolation from
interpolated value
public double prepareForInterpolationAndInterpolateIAndD(double x,
double y,
double[] D,
boolean fromSub,
boolean fromCurrent)
x - x- point coordinatey - y- point coordinateD - output, interpolation the X and Y derivatives of the imagefromSub - flat to determine to do the interpolation from the subsampled version of the imagefromCurrent - flag to determine the image to do the interpolation from
interpolated valuepublic int precomputed_getWidth()
public double precomputed_getWeightDx(int l,
int m,
int u,
int v)
l - m - u - v -
public double precomputed_getWeightDxDx(int l,
int m,
int u,
int v)
l - m - u - v -
public double precomputed_getWeightDxDy(int l,
int m,
int u,
int v)
l - m - u - v -
public double precomputed_getWeightDy(int l,
int m,
int u,
int v)
l - m - u - v -
public double precomputed_getWeightDyDy(int l,
int m,
int u,
int v)
l - m - u - v -
public double precomputed_getWeightI(int l,
int m,
int u,
int v)
l - m - u - v -
public void precomputed_interpolateD(double[] D,
int u,
int v)
D - output, X and Y derivatives of the imageu - x- point coordinatev - y- point coordinate
public void precomputed_interpolateD2(double[] D2,
int u,
int v)
D2 - output, XY, XX and YY derivatives of the imageu - x- point coordinatev - y- point coordinate
public double precomputed_interpolateI(int u,
int v)
u - x- point coordinatev - y- point coordinate
public void precomputed_prepareForInterpolation(int Ydim,
int Xdim,
int intervals)
Ydim - y- image dimensionXdim - x- image dimensionintervals - intervals in the deformationpublic void run()
run in interface java.lang.Runnable
public void setCoefficients(double[] c,
int Ydim,
int Xdim,
int offset)
c - Set of B-spline coefficientsYdim - Y-dimension of the set of coefficientsXdim - X-dimension of the set of coefficientsoffset - Offset of the beginning of the array with respect to the origin of cpublic void setPyramidDepth(int pyramidDepth)
pyramidDepth - pyramid depth to be setboolean isSubOutput()
void setSubOutput(boolean b)
b - new subsampled output flagint getSubHeight()
int getSubWidth()
private void antiSymmetricFirMirrorOffBounds1D(double[] h,
double[] c,
double[] s)
h - c - s -
private void basicToCardinal2D(double[] basic,
double[] cardinal,
int width,
int height,
int degree)
basic - basic (standard B-splines) 2D arraycardinal - cardinal (sampled signal) 2D arraywidth - 2D signal widthheight - 2D signal heightdegree - B-splines degreeprivate void buildCoefficientPyramid()
private void buildImagePyramid()
private void cardinalToDual2D(double[] cardinal,
double[] dual,
int width,
int height,
int degree)
cardinal - dual - width - height - degree - private void coefficientToGradient1D(double[] c)
c - coefficientsprivate void coefficientToSamples1D(double[] c)
c - coefficients
private void coefficientToXYGradient2D(double[] basic,
double[] xGradient,
double[] yGradient,
int width,
int height)
basic - xGradient - yGradient - width - height -
private void dualToCardinal2D(double[] dual,
double[] cardinal,
int width,
int height,
int degree)
dual - cardinal - width - height - degree -
private void extractColumn(double[] array,
int width,
int x,
double[] column)
array - width - of the position of the column in the arrayx - column position in the arraycolumn - output, extracted column
private void extractRow(double[] array,
int y,
double[] row)
array - y - row position in the arrayrow - output, extracted rowprivate double[] getBasicFromCardinal2D()
private double[] getBasicFromCardinal2D(double[] cardinal,
int width,
int height,
int degree)
cardinal - sampled 2D signalwidth - signal widthheight - signal heightdegree - B-spline degree
private double[] getHalfDual2D(double[] fullDual,
int fullWidth,
int fullHeight)
fullDual - full coefficientsfullWidth - full coefficients widthfullHeight - full coefficients height
private double getInitialAntiCausalCoefficientMirrorOffBounds(double[] c,
double z,
double tolerance)
c - coefficientsz - tolerance -
private double getInitialCausalCoefficientMirrorOffBounds(double[] c,
double z,
double tolerance)
c - coefficientsz - tolerance -
private void putColumn(double[] array,
int width,
int x,
double[] column)
array - width - of the position of the column in the arrayx - column position in the arraycolumn - column to be put
private void putRow(double[] array,
int y,
double[] row)
array - y - row position in the arrayrow - row to be put
private void reduceDual1D(double[] c,
double[] s)
c - s -
private void samplesToInterpolationCoefficient1D(double[] c,
int degree,
double tolerance)
c - coefficientsdegree - tolerance -
private void symmetricFirMirrorOffBounds1D(double[] h,
double[] c,
double[] s)
h - c - s -
public double[] reduceCoeffsBy2(double[] c,
int width,
int height)
c - width - height - public void setSubsamplingFactor(int maxImageSubsamplingFactor)
maxImageSubsamplingFactor -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||