FlowJ
Class FlowJFlow

java.lang.Object
  |
  +--FlowJ.FlowJFlow

public class FlowJFlow
extends java.lang.Object

This class implements 2D flow fields and methods (including reading and writing and utility methods). Reading and writing is done in the famous Burkitt format to be compatible with other optical flow packages. The Burkitt format is defined as follows: ... ... where float = 4 byte little endian float. Originaly written in C++ by Michael Abramoff, 1997. Translated to Java, Michael Abramoff, 1999


Field Summary
 boolean[][] full
           
 VolumeFloat v
           
 
Constructor Summary
FlowJFlow()
           
FlowJFlow(int width, int height)
           
 
Method Summary
 int average(ij.gui.Roi roi)
           
 float averageAlpha()
          Return the angle of the previously computed average flow.
 float averageMagnitude()
          Return the length of the previously computed average flow.
 java.lang.String calibratedMagnitudeString(float magnitude, int significance)
           
 void createRotation(int centerX, int centerY, float angle, ij.gui.Roi roi)
           
 boolean full(int x, int y)
           
 float[] get(int x, int y)
           
 float getAlphaDeg(int x, int y)
           
 int getHeight()
           
 float getMagnitude(int x, int y)
           
 java.lang.String getTitle(int mappingChoice, float scale, float rho)
           
 int getWidth()
           
 float getX(int x, int y)
           
 float getY(int x, int y)
           
static float magnitude3D(float[] r)
          Return the magnitude of a rectangular motion vector.
 ij.process.ImageProcessor mapImage(ij.process.ImageProcessor background, int mappingChoice, int axis, float scale, float rho)
           
static float orientationxy(float[] r)
           
static float orientationxy(float vx, float vy)
          return the orientation (in radians) in the xy plane of a rectangular motion vector r
static float orientationz(float[] r)
           
static float[] polar(float[] r)
          Convert a rectangular vector r to a vector in polar coordinates p.
static void polar(float[] p, float[] r)
           
static void polar(float[] p, float rx, float ry)
           
static float[] polar(float rx, float ry)
           
static void polar3D(float[] p, float[] r)
           
static void polar3D(float[] p, float vx, float vy, float vz)
           
 boolean read(java.lang.String fileName)
          Read a flow field defined in a file.
 void set(int x, int y, float vx, float vy)
           
 void set(int x, int y, float vx, float vy, boolean fullFlow)
           
 void setCalibration(ij.measure.Calibration c)
           
static void toGrid(float[] grid, float[] polar)
          Translate to grid coordinates.
 ij.ImageStack toStack()
           
 boolean valid(int x, int y)
           
 void write(java.lang.String fileName)
          Write the full flow field in Burkitt format into a file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v

public VolumeFloat v

full

public boolean[][] full
Constructor Detail

FlowJFlow

public FlowJFlow()

FlowJFlow

public FlowJFlow(int width,
                 int height)
Method Detail

toStack

public ij.ImageStack toStack()

setCalibration

public void setCalibration(ij.measure.Calibration c)

valid

public boolean valid(int x,
                     int y)

set

public void set(int x,
                int y,
                float vx,
                float vy)

set

public void set(int x,
                int y,
                float vx,
                float vy,
                boolean fullFlow)

get

public float[] get(int x,
                   int y)

getWidth

public int getWidth()

getHeight

public int getHeight()

getX

public float getX(int x,
                  int y)

getY

public float getY(int x,
                  int y)

full

public boolean full(int x,
                    int y)

getTitle

public java.lang.String getTitle(int mappingChoice,
                                 float scale,
                                 float rho)

mapImage

public ij.process.ImageProcessor mapImage(ij.process.ImageProcessor background,
                                          int mappingChoice,
                                          int axis,
                                          float scale,
                                          float rho)

getMagnitude

public float getMagnitude(int x,
                          int y)

getAlphaDeg

public float getAlphaDeg(int x,
                         int y)

calibratedMagnitudeString

public java.lang.String calibratedMagnitudeString(float magnitude,
                                                  int significance)

average

public int average(ij.gui.Roi roi)

averageAlpha

public float averageAlpha()
Return the angle of the previously computed average flow.

averageMagnitude

public float averageMagnitude()
Return the length of the previously computed average flow.

read

public boolean read(java.lang.String fileName)
Read a flow field defined in a file. File contains a header with in (4 byte float) original width, original height, computed width, computed height, offset from edge x, offset from edge y. and then the v.v as 4 byte floats (x,y....).
Parameters:
fileName - a String with the name of the file and path to read.
Returns:
true if succesfully read from the file, false otherwise.

write

public void write(java.lang.String fileName)
Write the full flow field in Burkitt format into a file.
Parameters:
fileName - a String with the name of the file and path to write.

createRotation

public void createRotation(int centerX,
                           int centerY,
                           float angle,
                           ij.gui.Roi roi)

magnitude3D

public static float magnitude3D(float[] r)
Return the magnitude of a rectangular motion vector.

orientationxy

public static float orientationxy(float[] r)

orientationxy

public static float orientationxy(float vx,
                                  float vy)
return the orientation (in radians) in the xy plane of a rectangular motion vector r

orientationz

public static float orientationz(float[] r)

polar3D

public static void polar3D(float[] p,
                           float[] r)

polar3D

public static void polar3D(float[] p,
                           float vx,
                           float vy,
                           float vz)

polar

public static void polar(float[] p,
                         float rx,
                         float ry)

polar

public static float[] polar(float rx,
                            float ry)

polar

public static float[] polar(float[] r)
Convert a rectangular vector r to a vector in polar coordinates p.

polar

public static void polar(float[] p,
                         float[] r)

toGrid

public static void toGrid(float[] grid,
                          float[] polar)
Translate to grid coordinates. grid[0] = x, grid[1] = y.