ini.trakem2.vector
Class VectorString2D

java.lang.Object
  extended by ini.trakem2.vector.VectorString2D
All Implemented Interfaces:
VectorString

public class VectorString2D
extends java.lang.Object
implements VectorString

String of vectors.


Field Summary
 
Fields inherited from interface ini.trakem2.vector.VectorString
X_AXIS, Y_AXIS, Z_AXIS
 
Constructor Summary
VectorString2D(double[] x, double[] y, double z, boolean closed)
          Construct a new String of Vectors from the given points and desired resampling point interdistance 'delta'.
 
Method Summary
 void calibrate(ij.measure.Calibration cal)
          Scale to match cal.pixelWidth, cal.pixelHeight and computed depth.
 java.lang.Object clone()
          Does NOT clone the vector arrays, which are initialized to NULL; only the x,y,delta,z.
static double distance(double x1, double y1, double x2, double y2)
           
 double distance(int i, VectorString vs, int j)
          Distance from point i in this to point j in vs2.
 double getAverageDelta()
           
 ij.measure.Calibration getCalibrationCopy()
           
 double getDelta()
          If not resampled, returns zero.
 double getDiffVectorLength(int i, int j, VectorString vs2)
          Subtracts vs2 vector j to this vector i and returns its length, without changing any data.
 int getDimensions()
           
 double getPoint(int dim, int i)
          Get the value at index i for dimension dim; dimensions start at 0 and go up to n-dimensions -1, for example for VectorString3D, 0=X, 1=Y, 2=Z; to get y[32] call getPoint(1, 32);
 double[] getPoints(int dim)
          Get the array at dimension dim which ranges from 0 to n-dimensions -1; 0=X, 1=Y, 2=Z, et cetera depending on how many dimensions this VectorString supports.
 double getVector(int dim, int i)
           
 double[] getVectors(int dim)
           
 boolean isCalibrated()
           
 boolean isClosed()
           
 int length()
           
 void reorder(int new_zero)
           
 void resample(double delta)
          Homogenize the average point interdistance to 'delta'.
 void resample(double delta, boolean with_source)
          Same as resample(delta).
 void reverse()
          Invert the order of points.
 VectorString subVectorString(int first, int last)
          Create a new VectorString for the given range.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorString2D

public VectorString2D(double[] x,
                      double[] y,
                      double z,
                      boolean closed)
               throws java.lang.Exception
Construct a new String of Vectors from the given points and desired resampling point interdistance 'delta'.

Throws:
java.lang.Exception
Method Detail

clone

public java.lang.Object clone()
Does NOT clone the vector arrays, which are initialized to NULL; only the x,y,delta,z.

Overrides:
clone in class java.lang.Object

length

public int length()
Specified by:
length in interface VectorString

getDelta

public double getDelta()
If not resampled, returns zero.

Specified by:
getDelta in interface VectorString

getPoints

public double[] getPoints(int dim)
Description copied from interface: VectorString
Get the array at dimension dim which ranges from 0 to n-dimensions -1; 0=X, 1=Y, 2=Z, et cetera depending on how many dimensions this VectorString supports.

Specified by:
getPoints in interface VectorString

getVectors

public double[] getVectors(int dim)
Specified by:
getVectors in interface VectorString

getPoint

public double getPoint(int dim,
                       int i)
Description copied from interface: VectorString
Get the value at index i for dimension dim; dimensions start at 0 and go up to n-dimensions -1, for example for VectorString3D, 0=X, 1=Y, 2=Z; to get y[32] call getPoint(1, 32);

Specified by:
getPoint in interface VectorString

getVector

public double getVector(int dim,
                        int i)
Specified by:
getVector in interface VectorString

isClosed

public boolean isClosed()
Specified by:
isClosed in interface VectorString

getAverageDelta

public double getAverageDelta()

resample

public void resample(double delta,
                     boolean with_source)
Same as resample(delta).

Specified by:
resample in interface VectorString

resample

public void resample(double delta)
Homogenize the average point interdistance to 'delta'.

Specified by:
resample in interface VectorString

reorder

public void reorder(int new_zero)
Specified by:
reorder in interface VectorString

getDiffVectorLength

public double getDiffVectorLength(int i,
                                  int j,
                                  VectorString vs2)
Subtracts vs2 vector j to this vector i and returns its length, without changing any data.

Specified by:
getDiffVectorLength in interface VectorString

distance

public double distance(int i,
                       VectorString vs,
                       int j)
Distance from point i in this to point j in vs2.

Specified by:
distance in interface VectorString

distance

public static double distance(double x1,
                              double y1,
                              double x2,
                              double y2)

subVectorString

public VectorString subVectorString(int first,
                                    int last)
                             throws java.lang.Exception
Create a new VectorString for the given range. If last < first, it will be created as reversed.

Specified by:
subVectorString in interface VectorString
Throws:
java.lang.Exception

reverse

public void reverse()
Invert the order of points. Will clear all vector arrays if any!

Specified by:
reverse in interface VectorString

getDimensions

public int getDimensions()
Specified by:
getDimensions in interface VectorString

calibrate

public void calibrate(ij.measure.Calibration cal)
Scale to match cal.pixelWidth, cal.pixelHeight and computed depth. If cal is null, returns immediately. Will make all vectors null, so you must call resample(delta) again after calibrating. So it brings all values to cal.units, such as microns.


isCalibrated

public boolean isCalibrated()

getCalibrationCopy

public ij.measure.Calibration getCalibrationCopy()