Class pointHandler

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

 class pointHandler
extends ij.gui.PolygonRoi

This class is responsible for dealing with the list of point coordinates and for their visual appearance.


Field Summary
private static int CROSS_HALFSIZE
           
private  int currentPoint
           
protected static int GAMUT
           
private static int ID
           
private  ij.ImagePlus imp
           
private  java.util.Vector<java.lang.Integer> listColors
           
private  java.util.Vector<java.lang.Integer> listIDs
           
private  java.util.Vector<java.awt.Point> listPoints
           
protected static int MONOCHROME
           
private  int nextColor
           
private  int numPoints
           
private  pointAction pa
           
protected static int RAINBOW
           
private static long serialVersionUID
           
private  java.awt.Color[] spectrum
           
private  boolean started
           
private  pointToolbar tb
           
private  boolean[] usedColor
           
 
Fields inherited from class ij.gui.PolygonRoi
maxPoints, nPoints, splinePoints, xp, xp2, xpf, xSpline, yp, yp2, ypf, ySpline
 
Fields inherited from class ij.gui.Roi
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, defaultFillColor, fillColor, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, ignoreClipRect, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, onePixelWide, OVAL, overlay, pasteMode, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, strokeColor, TRACED_ROI, type, updateFullWindow, wideLine, xMax, yMax
 
Constructor Summary
protected pointHandler(ij.ImagePlus imp, pointToolbar tb)
          This constructor stores a local copy of its parameters and initializes the current spectrum.
 
Method Summary
protected  void addPoint(int x, int y)
          This method adds a new point to the list, with a color that is as different as possible from all those that are already in use.
protected  void addPoint(int x, int y, int color)
          This method adds a new point to the list, with a specific color.
 void draw(java.awt.Graphics g)
          Draw the landmarks and outline the current point if there is one.
protected  void findClosest(int x, int y)
          Let the point that is closest to the given coordinates become the current landmark.
protected  java.util.Vector<java.lang.Integer> getColors()
          Return the list of colors.
protected  java.lang.Integer getCurrentColor()
          Return the color of the current object.
protected  java.util.Vector<java.lang.Integer> getIDs()
          Return the list of IDs.
protected  java.awt.Point getPoint()
          Return the current point as a Point object.
protected  java.util.Vector<java.awt.Point> getPoints()
          Return the list of points.
protected  boolean isUsedColor(int color)
          Return true if color is free.
protected  void movePoint(int x, int y)
          Modify the location of the current point.
protected  void movePoint(int x, int y, java.lang.Integer color)
          Modify the location of the current point.
protected  void removePoint()
          Remove the current point.
protected  void removePoint(java.lang.Integer color)
          Remove a point of a given index.
protected  void removePoints()
          Remove all points and make every color available.
protected  void setPointAction(pointAction pa)
          Stores a local copy of its parameter and allows the graphical operations to proceed.
protected  void setSpectrum(int colorization)
          Setup the color scheme.
private  int stirColor(int color)
           
 
Methods inherited from class ij.gui.PolygonRoi
addOffset, clipRectMargin, clone, contains, deleteHandle, drawPixels, exitConstructingMode, fitSpline, fitSpline, fitSplineForStraightening, getAngle, getConvexHull, getDrawOffset, getFloatPolygon, getInterpolatedPolygon, getLength, getMask, getNCoordinates, getNonSplineCoordinates, getNonSplineFloatCoordinates, getPolygon, getUncalibratedLength, getXCoordinates, getYCoordinates, grow, handleMouseUp, isHandle, isSplineFit, mouseDownInHandle, moveHandle, removeSplineFit, setDrawOffset, subPixelResolution, updatePolygon
 
Methods inherited from class ij.gui.Roi
abortPaste, copyAttributes, drawOverlay, drawPixels, endPaste, equals, getAngle, getBoundingRect, getBounds, getColor, getCornerDiameter, getCPosition, getCurrentPasteMode, getDefaultFillColor, getFeretsDiameter, getFeretValues, getFillColor, getFloatAngle, getFloatBounds, getImage, getImageID, getInterpolatedPolygon, getInterpolatedPolygon, getMagnification, getName, getPasteMode, getPosition, getPrototypeOverlay, getRoundRectArcSize, getScaledStroke, getState, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getZPosition, handleMouseDown, handleMouseDrag, isActiveOverlayRoi, isArea, isDrawingTool, isLine, isVisible, mouseDragged, mouseReleased, nudge, nudgeCorner, screenX, screenXD, screenY, screenYD, setColor, setCornerDiameter, setDefaultFillColor, setFillColor, setIgnoreClipRect, setImage, setInstanceColor, setLineWidth, setLocation, setName, setNonScalable, setPasteMode, setPosition, setPosition, setPrototypeOverlay, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, setStrokeWidth, showStatus, startPaste, temporarilyHide, toFloat, toInt, toInt, toIntR, toString, update, updateClipRect, updateWideLine
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RAINBOW

protected static final int RAINBOW
See Also:
Constant Field Values

MONOCHROME

protected static final int MONOCHROME
See Also:
Constant Field Values

GAMUT

protected static final int GAMUT
See Also:
Constant Field Values

CROSS_HALFSIZE

private static final int CROSS_HALFSIZE
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

ID

private static int ID

spectrum

private final java.awt.Color[] spectrum

usedColor

private final boolean[] usedColor

listColors

private final java.util.Vector<java.lang.Integer> listColors

listIDs

private final java.util.Vector<java.lang.Integer> listIDs

listPoints

private final java.util.Vector<java.awt.Point> listPoints

imp

private ij.ImagePlus imp

pa

private pointAction pa

tb

private pointToolbar tb

nextColor

private int nextColor

currentPoint

private int currentPoint

numPoints

private int numPoints

started

private boolean started
Constructor Detail

pointHandler

protected pointHandler(ij.ImagePlus imp,
                       pointToolbar tb)
This constructor stores a local copy of its parameters and initializes the current spectrum. It also creates the object that takes care of the interactive work.

Parameters:
imp - ImagePlus object where points are being picked.
tb - pointToolbar object that handles the toolbar.
Method Detail

draw

public void draw(java.awt.Graphics g)
Draw the landmarks and outline the current point if there is one.

Overrides:
draw in class ij.gui.PolygonRoi
Parameters:
g - Graphics environment.

addPoint

protected void addPoint(int x,
                        int y)
This method adds a new point to the list, with a color that is as different as possible from all those that are already in use. The points are stored in pixel units rather than canvas units to cope for different zooming factors.

Parameters:
x - Horizontal coordinate, in canvas units.
y - Vertical coordinate, in canvas units.

addPoint

protected void addPoint(int x,
                        int y,
                        int color)
This method adds a new point to the list, with a specific color. The points are stored in pixel units rather than canvas units to cope for different zooming factors.

Parameters:
x - Horizontal coordinate, in canvas units.
y - Vertical coordinate, in canvas units.
color - Specific color.

findClosest

protected void findClosest(int x,
                           int y)
Let the point that is closest to the given coordinates become the current landmark.

Parameters:
x - Horizontal coordinate, in canvas units.
y - Vertical coordinate, in canvas units.

getColors

protected java.util.Vector<java.lang.Integer> getColors()
Return the list of colors.


getCurrentColor

protected java.lang.Integer getCurrentColor()
Return the color of the current object. Return -1 if there is none.


getIDs

protected java.util.Vector<java.lang.Integer> getIDs()
Return the list of IDs.


getPoint

protected java.awt.Point getPoint()
Return the current point as a Point object.


getPoints

protected java.util.Vector<java.awt.Point> getPoints()
Return the list of points.


isUsedColor

protected boolean isUsedColor(int color)
Return true if color is free. Return false if color is in use.


movePoint

protected void movePoint(int x,
                         int y)
Modify the location of the current point. Clip the admissible range to the image size.

Parameters:
x - Desired new horizontal coordinate in canvas units.
y - Desired new vertical coordinate in canvas units.

movePoint

protected void movePoint(int x,
                         int y,
                         java.lang.Integer color)
Modify the location of the current point. Clip the admissible range to the image size.

Parameters:
x - Desired new horizontal coordinate in canvas units.
y - Desired new vertical coordinate in canvas units.
color - Color index of the point to move.

removePoint

protected void removePoint()
Remove the current point. Make its color available again.


removePoint

protected void removePoint(java.lang.Integer color)
Remove a point of a given index. Make its color available again.

Parameters:
color - Color index of the point to remove.

removePoints

protected void removePoints()
Remove all points and make every color available.


setPointAction

protected void setPointAction(pointAction pa)
Stores a local copy of its parameter and allows the graphical operations to proceed. The present class is now fully initialized.

Parameters:
pa - pointAction object.

setSpectrum

protected void setSpectrum(int colorization)
Setup the color scheme.

Parameters:
colorization - Colorization code. Admissible values are {RAINBOW, MONOCHROME}.

stirColor

private int stirColor(int color)