bunwarpj.trakem2.transform
Class CubicBSplineTransform

java.lang.Object
  extended by mpicbg.models.AbstractModel<CubicBSplineTransform>
      extended by bunwarpj.trakem2.transform.CubicBSplineTransform
All Implemented Interfaces:
mpicbg.models.CoordinateTransform, mpicbg.models.Model<CubicBSplineTransform>

public class CubicBSplineTransform
extends mpicbg.models.AbstractModel<CubicBSplineTransform>
implements CoordinateTransform

Class to implement elastic transforms based on cubic B-splines.


Field Summary
 
Fields inherited from class mpicbg.models.AbstractModel
cost, rnd
 
Constructor Summary
CubicBSplineTransform()
          Empty constructor
CubicBSplineTransform(int intervals, bunwarpj.BSplineModel swx, bunwarpj.BSplineModel swy, int width, int height)
          Cubic B-spline transform constructor
CubicBSplineTransform(int intervals, double[][] cx, double[][] cy, int width, int height)
          Cubic B-spline transform constructor
 
Method Summary
 float[] apply(float[] l)
           
 void applyInPlace(float[] l)
           
 CubicBSplineTransform copy()
          Clone method
<P extends mpicbg.models.PointMatch>
void
fit(java.util.Collection<P> matches)
           
 int getMinNumMatches()
           
 void init(java.lang.String dataString)
          Initialize cubic B-spline transform from the parameters of a string
 void scale(double xScale, double yScale)
           
 void set(CubicBSplineTransform m)
           
 void set(int intervals, bunwarpj.BSplineModel swx, bunwarpj.BSplineModel swy, int width, int height)
          Set cubic B-spline transform values
 void set(int intervals, double[][] cx, double[][] cy, int width, int height)
          Set cubic B-spline transform constructor
 void set(bunwarpj.Param p, int sourceWidth, int sourceHeight, int targetWidth, int targetHeight)
           
 java.lang.String toDataString()
          Save cubic B-spline transform information into String
 java.lang.String toString()
           
 java.lang.String toXML(java.lang.String indent)
          Create an XML-export of the CoordinateTransform for use in TrakEM2.
 
Methods inherited from class mpicbg.models.AbstractModel
betterThan, filter, filter, filter, filterRansac, filterRansac, filterRansac, filterRansac, getCost, getError, getMinSetSize, icp, ransac, ransac, setCost, setError, test, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CubicBSplineTransform

public CubicBSplineTransform()
Empty constructor


CubicBSplineTransform

public CubicBSplineTransform(int intervals,
                             double[][] cx,
                             double[][] cy,
                             int width,
                             int height)
Cubic B-spline transform constructor

Parameters:
intervals - intervals between B-spline coefficients
cx - B-spline coefficients for transformation in the x axis
cy - B-spline coefficients for transformation in the y axis
width - width of the target image
height - height of the target image

CubicBSplineTransform

public CubicBSplineTransform(int intervals,
                             bunwarpj.BSplineModel swx,
                             bunwarpj.BSplineModel swy,
                             int width,
                             int height)
Cubic B-spline transform constructor

Parameters:
intervals - intervals between B-spline coefficients
swx - B-spline model for transformation in the x axis
swy - B-spline model for transformation in the y axis
width - width of the target image
height - height of the target image
Method Detail

set

public void set(int intervals,
                bunwarpj.BSplineModel swx,
                bunwarpj.BSplineModel swy,
                int width,
                int height)
Set cubic B-spline transform values

Parameters:
intervals - intervals between B-spline coefficients
swx - B-spline model for transformation in the x axis
swy - B-spline model for transformation in the y axis
width - width of the target image
height - height of the target image

set

public void set(int intervals,
                double[][] cx,
                double[][] cy,
                int width,
                int height)
Set cubic B-spline transform constructor

Parameters:
intervals - intervals between B-spline coefficients
cx - B-spline coefficients for transformation in the x axis
cy - B-spline coefficients for transformation in the y axis
width - width of the target image
height - height of the target image

apply

public float[] apply(float[] l)
Specified by:
apply in interface mpicbg.models.CoordinateTransform

applyInPlace

public void applyInPlace(float[] l)
Specified by:
applyInPlace in interface mpicbg.models.CoordinateTransform

init

public void init(java.lang.String dataString)
          throws java.lang.NumberFormatException
Initialize cubic B-spline transform from the parameters of a string

Parameters:
dataString - basic cubic B-spline transform parameters
Throws:
java.lang.NumberFormatException

toDataString

public java.lang.String toDataString()
Save cubic B-spline transform information into String

Returns:

toXML

public final java.lang.String toXML(java.lang.String indent)
Description copied from interface: CoordinateTransform
Create an XML-export of the CoordinateTransform for use in TrakEM2.

Returns:
TrakEM2-readable XML

copy

public final CubicBSplineTransform copy()
Clone method

Specified by:
copy in interface mpicbg.models.Model<CubicBSplineTransform>

fit

public <P extends mpicbg.models.PointMatch> void fit(java.util.Collection<P> matches)
         throws mpicbg.models.NotEnoughDataPointsException,
                mpicbg.models.IllDefinedDataPointsException
Specified by:
fit in interface mpicbg.models.Model<CubicBSplineTransform>
Throws:
mpicbg.models.NotEnoughDataPointsException
mpicbg.models.IllDefinedDataPointsException

scale

public void scale(double xScale,
                  double yScale)

set

public void set(bunwarpj.Param p,
                int sourceWidth,
                int sourceHeight,
                int targetWidth,
                int targetHeight)

getMinNumMatches

public int getMinNumMatches()
Specified by:
getMinNumMatches in interface mpicbg.models.Model<CubicBSplineTransform>

set

public void set(CubicBSplineTransform m)
Specified by:
set in interface mpicbg.models.Model<CubicBSplineTransform>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object