bunwarpj
Class PointHandler

java.lang.Object
  extended by ij.gui.Roi
      extended by bunwarpj.PointHandler
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class PointHandler
extends ij.gui.Roi

Class to deal with handle points in bUnwarpJ: here we have the methods to paint the landmarks and the masks.

See Also:
Serialized Form

Field Summary
private static int CROSS_HALFSIZE
          constant to keep half of the cross size
private  int currentPoint
          current point
private  MainDialog dialog
          pointer to the main bUnwarpJ dialog
private  float hue
          hue for assigning new color ([0.0-1.0])
private  ij.ImagePlus imp
          pointer to the image representation
private  java.util.Vector<java.awt.Color> listColors
           
private  java.util.Vector<java.awt.Point> listMaskPoints
          list of points in the mask
private  java.util.Vector<java.awt.Point> listPoints
          list of points
private  Mask mask
          pointer to the mask
private  boolean maskClosed
          flat to check if the mask is closed or not
private  int numPoints
          number of points
private  PointAction pa
          pointer to the point actions
private  float saturation
          saturation for assigning new color ([0.5-1.0])
private  boolean started
          start flag
private  PointToolbar tb
          pointer to the point toolbar
 
Fields inherited from class ij.gui.Roi
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultFillColor, displayList, fillColor, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, name, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, outlineColor, OVAL, pasteMode, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, TRACED_ROI, type, updateFullWindow, xMax, yMax
 
Constructor Summary
PointHandler(ij.ImagePlus imp)
          Constructor without graphical capabilities, create an instance of PointHandler.
PointHandler(ij.ImagePlus imp, PointToolbar tb, Mask mask, MainDialog dialog)
          Constructor with graphical capabilities, create an instance of PointHandler.
 
Method Summary
 void addMaskPoint(int x, int y)
          Add a point to the mask.
 void addPoint(int x, int y)
          Add a point to the list of points.
 boolean canAddMaskPoints()
          Check if it is possible to add points to the mask.
 void clearMask()
          Remove all the elements of the mask.
 void closeMask(int tool)
          Close mask.
 void draw(java.awt.Graphics g)
          Draw the landmarks and mask.
 int findClosest(int x, int y)
          Find the the closest point to a certain point from the list of points.
 int getCurrentPoint()
          Get current point index.
 java.awt.Point getPoint()
          Get the current point in the list of points.
 PointAction getPointAction()
          Get point action.
 java.util.Vector<java.awt.Point> getPoints()
          Get the list of points.
 void killListeners()
          Kill listeners.
 void movePoint(int x, int y)
          Move the current point into a new position.
 void nextPoint()
          Increase the current point index one position in the list.
 void removePoint()
          Remove the current point.
 void removePoint(int k)
          Remove one specific point.
 void removePoints()
          Remove all points in the mask.
 void setCurrentPoint(int currentPoint)
          Set the current point.
 void setSecondaryPointHandler(ij.ImagePlus secondaryImp, PointHandler secondaryPh)
          Set the secondary point handler.
 void setTestSourceSet(int set)
          Set the set of test for the source.
 void setTestTargetSet(int set)
          Set the set of test for the target.
 
Methods inherited from class ij.gui.Roi
abortPaste, clone, contains, copyAttributes, drawDisplayList, drawPixels, drawPixels, endPaste, equals, getAngle, getBoundingRect, getBounds, getColor, getConvexHull, getCurrentPasteMode, getDefaultFillColor, getFeretsDiameter, getFeretValues, getFillColor, getFloatPolygon, getLength, getLineColor, getLineWidth, getMask, getName, getPasteMode, getPolygon, getState, getStroke, getType, getTypeAsString, grow, handleMouseDown, handleMouseDrag, handleMouseUp, isArea, isHandle, isLine, isVisible, mouseDownInHandle, moveHandle, nudge, nudgeCorner, setColor, setDefaultFillColor, setFillColor, setImage, setInstanceColor, setLineColor, setLineWidth, setLocation, setName, setNonScalable, setPasteMode, setStroke, showStatus, startPaste, toString, update, updateClipRect
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CROSS_HALFSIZE

private static final int CROSS_HALFSIZE
constant to keep half of the cross size

See Also:
Constant Field Values

listColors

private final java.util.Vector<java.awt.Color> listColors

listPoints

private final java.util.Vector<java.awt.Point> listPoints
list of points


currentPoint

private int currentPoint
current point


numPoints

private int numPoints
number of points


started

private boolean started
start flag


listMaskPoints

private final java.util.Vector<java.awt.Point> listMaskPoints
list of points in the mask


maskClosed

private boolean maskClosed
flat to check if the mask is closed or not


imp

private ij.ImagePlus imp
pointer to the image representation


pa

private PointAction pa
pointer to the point actions


tb

private PointToolbar tb
pointer to the point toolbar


mask

private Mask mask
pointer to the mask


dialog

private MainDialog dialog
pointer to the main bUnwarpJ dialog


hue

private float hue
hue for assigning new color ([0.0-1.0])


saturation

private float saturation
saturation for assigning new color ([0.5-1.0])

Constructor Detail

PointHandler

public PointHandler(ij.ImagePlus imp,
                    PointToolbar tb,
                    Mask mask,
                    MainDialog dialog)
Constructor with graphical capabilities, create an instance of PointHandler.

Parameters:
imp - pointer to the image
tb - pointer to the toolbar
mask - pointer to the mask
dialog - pointer to the bUnwarpJ dialog

PointHandler

public PointHandler(ij.ImagePlus imp)
Constructor without graphical capabilities, create an instance of PointHandler.

Parameters:
imp - image
Method Detail

addMaskPoint

public void addMaskPoint(int x,
                         int y)
Add a point to the mask.

Parameters:
x - x- point coordinate
y - y- point coordinate

addPoint

public void addPoint(int x,
                     int y)
Add a point to the list of points.

Parameters:
x - x- point coordinate
y - y- point coordinate

canAddMaskPoints

public boolean canAddMaskPoints()
Check if it is possible to add points to the mask.

Returns:
false if the image is coming from a stack

clearMask

public void clearMask()
Remove all the elements of the mask.


closeMask

public void closeMask(int tool)
Close mask.

Parameters:
tool - option to invert or not the mask

draw

public void draw(java.awt.Graphics g)
Draw the landmarks and mask.

Overrides:
draw in class ij.gui.Roi
Parameters:
g - graphic element

findClosest

public int findClosest(int x,
                       int y)
Find the the closest point to a certain point from the list of points.

Parameters:
x - x- point coordinate
y - y- point coordinate
Returns:
point index in the list of points

getPoint

public java.awt.Point getPoint()
Get the current point in the list of points.

Returns:
current point

getPointAction

public PointAction getPointAction()
Get point action.

Returns:
point action

getCurrentPoint

public int getCurrentPoint()
Get current point index.

Returns:
index of current point

getPoints

public java.util.Vector<java.awt.Point> getPoints()
Get the list of points.

Returns:
list of points

killListeners

public void killListeners()
Kill listeners.


movePoint

public void movePoint(int x,
                      int y)
Move the current point into a new position.

Parameters:
x - x-coordinate of the new position
y - y-coordinate of the new position

nextPoint

public void nextPoint()
Increase the current point index one position in the list.


removePoint

public void removePoint()
Remove the current point.


removePoint

public void removePoint(int k)
Remove one specific point.

Parameters:
k - index of the point to be removed

removePoints

public void removePoints()
Remove all points in the mask.


setCurrentPoint

public void setCurrentPoint(int currentPoint)
Set the current point.

Parameters:
currentPoint - new current point index

setTestSourceSet

public void setTestSourceSet(int set)
Set the set of test for the source.

Parameters:
set - number of source set

setTestTargetSet

public void setTestTargetSet(int set)
Set the set of test for the target.

Parameters:
set - number of target set

setSecondaryPointHandler

public void setSecondaryPointHandler(ij.ImagePlus secondaryImp,
                                     PointHandler secondaryPh)
Set the secondary point handler.

Parameters:
secondaryImp - pointer to the secondary image
secondaryPh - secondary point handler