JSci.instruments
Class PTCroquetteCross

java.lang.Object
  extended by java.awt.Polygon
      extended by JSci.instruments.PTCroquetteCross
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, Control

public class PTCroquetteCross
extends java.awt.Polygon
implements Control

Data about a cross that can be put on an image, follow the center, find the height

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Polygon
bounds, npoints, xpoints, ypoints
 
Constructor Summary
PTCroquetteCross(int l, int hw, java.awt.Point p, java.awt.Color col)
          Crates a new cross
 
Method Summary
(package private)  void addJNIToTemplate(Image f, int x0, int y0, int l, int w, double[] templ, int z)
           
 void calibrationEnd()
          call this when the calibration has been done
 void calibrationRequest(int zLevel)
          Call this when the microscope objective position is right for the calibration.
 void calibrationSendImage(Image f)
          send the image that has been acquired, so that it is used for calibration
 void calibrationStart(int zNum, double minZ, double maxZ)
          Start the calibration
 void calibrationWait()
          wait that the calibration, requested by calibrationRequest(), has been completed.
 void findXY(Image f)
          Let the cross find the best center of the bead that is pointing
 void findZ(Image f)
          Find the best position of the bead along the vertical axis
(package private)  int fromImg(byte c)
           
 java.awt.Rectangle getBounds()
          get the bounds of the cross.
 java.awt.Color getColor()
          get the color of the cross.
 java.awt.Component getControlComponent()
          get a Component that describes the Z position of the cross.
 java.awt.geom.Point2D getLocation()
          get the position of the bead
 double getZ()
          get the position of the bead along Z axis
 boolean isDragging()
          the cross is being dragged by the mouse?
 void setBBox(java.awt.Rectangle r)
          set the bounding box of the whole image.
 void setDragging(boolean v)
          call this when the mouse starts dragging the cross
 void setLocation(java.awt.geom.Point2D p)
          set the position of the cross.
 
Methods inherited from class java.awt.Polygon
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PTCroquetteCross

public PTCroquetteCross(int l,
                        int hw,
                        java.awt.Point p,
                        java.awt.Color col)
Crates a new cross

Parameters:
l - length of the arm of the cross
hw - half width of the arms of the cross
p - initial center of the cross
Method Detail

fromImg

int fromImg(byte c)

addJNIToTemplate

void addJNIToTemplate(Image f,
                      int x0,
                      int y0,
                      int l,
                      int w,
                      double[] templ,
                      int z)

findXY

public void findXY(Image f)
Let the cross find the best center of the bead that is pointing


findZ

public void findZ(Image f)
Find the best position of the bead along the vertical axis


setDragging

public void setDragging(boolean v)
call this when the mouse starts dragging the cross

Parameters:
v - is dragged - don't move automatically, even if findXY is called

isDragging

public boolean isDragging()
the cross is being dragged by the mouse?

Returns:
the cross is being dragged by the mouse?

setBBox

public void setBBox(java.awt.Rectangle r)
set the bounding box of the whole image. Ensures that the cross doesn't exit from the image.

Parameters:
r - the bounding box

setLocation

public void setLocation(java.awt.geom.Point2D p)
set the position of the cross.

Parameters:
p - the new position

getLocation

public java.awt.geom.Point2D getLocation()
get the position of the bead

Returns:
the position

getZ

public double getZ()
get the position of the bead along Z axis

Returns:
the position

getBounds

public java.awt.Rectangle getBounds()
get the bounds of the cross.

Specified by:
getBounds in interface java.awt.Shape
Overrides:
getBounds in class java.awt.Polygon
Returns:
the bounds of the cross

getColor

public java.awt.Color getColor()
get the color of the cross.

Returns:
the color of the cross

getControlComponent

public java.awt.Component getControlComponent()
get a Component that describes the Z position of the cross. It is also a ChangeListener, that can be added to a Spinner, and listens to the z-movements of the objective

Specified by:
getControlComponent in interface Control
Returns:
the Component

calibrationStart

public void calibrationStart(int zNum,
                             double minZ,
                             double maxZ)
Start the calibration

Parameters:
zNum - number of position of the microscope objective
minZ - minimum position of the microscope objective
maxZ - maximum position of the microscope objective

calibrationSendImage

public void calibrationSendImage(Image f)
send the image that has been acquired, so that it is used for calibration

Parameters:
f - the image from which data must be obtained

calibrationRequest

public void calibrationRequest(int zLevel)
Call this when the microscope objective position is right for the calibration. This method returns immediately; to wait for the processing to be done, call calibrationWait()

Parameters:
zLevel - position in the calibration image. Evaluate zNum = how many levels are in the calibration image? minZ, maxZ = the min and max levels (in micron) z = where is now the objective? So zLevel = (z-minZ)*zNum/(maxZ/minZ)

calibrationWait

public void calibrationWait()
wait that the calibration, requested by calibrationRequest(), has been completed.


calibrationEnd

public void calibrationEnd()
call this when the calibration has been done