bunwarpj
Class PointAction

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by ij.gui.ImageCanvas
              extended by bunwarpj.PointAction
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.accessibility.Accessible

public class PointAction
extends ij.gui.ImageCanvas
implements java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Class for all actions related with points in the bUnwarpJ interface: moving, adding and deleting landmarks, and painting the masks. The points are stored and handle in the PointHandler class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int ADD_CROSS
          constant to identify the add cross tool
private  MainDialog dialog
          pointer to the interface dialog
static int FILE
          constant to identify the input/output menu tool
static int INVERTMASK
          constant to identify the outer mask tool
static int MAGNIFIER
          constant to identify the magnifier tool
private  ij.ImagePlus mainImp
          main image plus (active image)
private  PointHandler mainPh
          main point handler (set of points of the active image)
static int MASK
          constant to identify the inner mask tool
private  long mouseDownTime
          time the mouse is down
static int MOVE_CROSS
          constant to identify the move cross tool
static int REMOVE_CROSS
          constant to identify the remove cross tool
private  ij.ImagePlus secondaryImp
          secondary image plus (the other image involved in the registration)
private  PointHandler secondaryPh
          secondary point handler (set of point of the other image)
static int STOP
          constant to identify the stop tool
private  PointToolbar tb
          pointer to the toolbar
 
Fields inherited from class ij.gui.ImageCanvas
crosshairCursor, defaultCursor, dstHeight, dstWidth, flags, handCursor, ij, imageHeight, imageUpdated, imageWidth, imp, magnification, moveCursor, srcRect, usePointer, xMouse, xMouseStart, xSrcStart, yMouse, yMouseStart, ySrcStart
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PointAction(ij.ImagePlus imp, PointHandler ph, PointToolbar tb, MainDialog dialog)
          Create an instance of PointAction.
 
Method Summary
private  java.lang.String getValueAsString(int x, int y)
          Get a pixel value as string.
 void keyPressed(java.awt.event.KeyEvent e)
          Method key pressed.
 void keyReleased(java.awt.event.KeyEvent e)
          Method key released.
 void keyTyped(java.awt.event.KeyEvent e)
          Method key typed.
 void mouseClicked(java.awt.event.MouseEvent e)
          Method mouse clicked.
 void mouseDragged(java.awt.event.MouseEvent e)
          Method mouse dragged, applied move the cross.
 void mouseEntered(java.awt.event.MouseEvent e)
          Method mouse entered, applied to set the main window.
 void mouseExited(java.awt.event.MouseEvent e)
          Method mouse exited.
 void mouseMoved(java.awt.event.MouseEvent e)
          Method mouse moved, show the coordinates of the mouse pointer.
 void mousePressed(java.awt.event.MouseEvent e)
          Method mouse pressed, allow all the different option over the images.
 void mouseReleased(java.awt.event.MouseEvent e)
          Method mouse released.
private  int positionX(ij.ImagePlus imp1, ij.ImagePlus imp2, int x)
          Get a common x- position between two images.
private  int positionY(ij.ImagePlus imp1, ij.ImagePlus imp2, int y)
          Get a common y- position between two images.
private  void setControl()
          Set control.
 void setSecondaryPointHandler(ij.ImagePlus secondaryImp, PointHandler secondaryPh)
          Set the secondary point handler.
private  void updateAndDraw()
          Update the region of interest of the main and secondary images.
 
Methods inherited from class ij.gui.ImageCanvas
canEnlarge, disablePopupMenu, fitToWindow, getCursorLoc, getDisplayList, getHigherZoomLevel, getLowerZoomLevel, getMagnification, getModifiers, getPreferredSize, getShowAllColor, getShowAllROIs, getSliceNumber, getSrcRect, handlePopupMenu, handleRoiMouseDown, offScreenX, offScreenXD, offScreenY, offScreenYD, paint, screenX, screenXD, screenY, screenYD, scroll, setCursor, setCustomRoi, setDisplayList, setDisplayList, setDisplayList, setDrawingColor, setDrawingSize, setImageUpdated, setMagnification, setShowAllColor, setShowAllROIs, setShowCursorStatus, setSourceRect, setupScroll, unzoom, update, zoom100Percent, zoomIn, zoomOut
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD_CROSS

public static final int ADD_CROSS
constant to identify the add cross tool

See Also:
Constant Field Values

MOVE_CROSS

public static final int MOVE_CROSS
constant to identify the move cross tool

See Also:
Constant Field Values

REMOVE_CROSS

public static final int REMOVE_CROSS
constant to identify the remove cross tool

See Also:
Constant Field Values

MASK

public static final int MASK
constant to identify the inner mask tool

See Also:
Constant Field Values

INVERTMASK

public static final int INVERTMASK
constant to identify the outer mask tool

See Also:
Constant Field Values

FILE

public static final int FILE
constant to identify the input/output menu tool

See Also:
Constant Field Values

STOP

public static final int STOP
constant to identify the stop tool

See Also:
Constant Field Values

MAGNIFIER

public static final int MAGNIFIER
constant to identify the magnifier tool

See Also:
Constant Field Values

mainImp

private ij.ImagePlus mainImp
main image plus (active image)


secondaryImp

private ij.ImagePlus secondaryImp
secondary image plus (the other image involved in the registration)


mainPh

private PointHandler mainPh
main point handler (set of points of the active image)


secondaryPh

private PointHandler secondaryPh
secondary point handler (set of point of the other image)


tb

private PointToolbar tb
pointer to the toolbar


dialog

private MainDialog dialog
pointer to the interface dialog


mouseDownTime

private long mouseDownTime
time the mouse is down

Constructor Detail

PointAction

public PointAction(ij.ImagePlus imp,
                   PointHandler ph,
                   PointToolbar tb,
                   MainDialog dialog)
Create an instance of PointAction.

Parameters:
imp - input image
ph - point handler
tb - point toolbar
dialog - pointer to the main bUnwarpJ dialog
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Method key pressed.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
e - key event

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Method key released.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
e - key event

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Method key typed.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
e - key event

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Method mouse clicked.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class ij.gui.ImageCanvas
Parameters:
e - mouse event

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Method mouse dragged, applied move the cross.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class ij.gui.ImageCanvas
Parameters:
e - mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Method mouse entered, applied to set the main window.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Overrides:
mouseEntered in class ij.gui.ImageCanvas
Parameters:
e - mouse event

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Method mouse exited.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Overrides:
mouseExited in class ij.gui.ImageCanvas
Parameters:
e - mouse event

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Method mouse moved, show the coordinates of the mouse pointer.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class ij.gui.ImageCanvas
Parameters:
e - mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Method mouse pressed, allow all the different option over the images.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class ij.gui.ImageCanvas
Parameters:
e - mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Method mouse released.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class ij.gui.ImageCanvas
Parameters:
e - mouse event

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

getValueAsString

private java.lang.String getValueAsString(int x,
                                          int y)
Get a pixel value as string.

Parameters:
x - x- coordinate of the pixel
y - y- coordinate of the pixel
Returns:
pixel value in string form

positionX

private int positionX(ij.ImagePlus imp1,
                      ij.ImagePlus imp2,
                      int x)
Get a common x- position between two images.

Parameters:
imp1 - first image
imp2 - second image
x - x-coordinate
Returns:
common position

positionY

private int positionY(ij.ImagePlus imp1,
                      ij.ImagePlus imp2,
                      int y)
Get a common y- position between two images.

Parameters:
imp1 - first image
imp2 - second image
y - y-coordinate
Returns:
common position

setControl

private void setControl()
Set control.


updateAndDraw

private void updateAndDraw()
Update the region of interest of the main and secondary images.