Seg2Dgel
Class Sg2viewImage

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by Seg2Dgel.Sg2viewImage
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class Sg2viewImage
extends javax.swing.JPanel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Class Sg2viewImage implements a popup GUI to show images used in the 2D Gel Spot Segmenter and an associated histogram GUI.

Refactored from Sg2viewImage By Greg Thornwall, SAIC.

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The Open2Dprot Mozilla and Legal files are available on http://Open2Dprot.sourceforge.net/.

Version:
$Date: 2005/10/23 12:44:55 $ $Revision: 1.9 $
Author:
P. Lemkin, NCI-Frederick, Frederick, MD, 21702
See Also:
Open2Dprot Home, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 CalibrateOD cal
          instance of calibrate
(package private)  int cHeight
          canvas height
(package private)  int cWidth
          canvas width
 Roi cwRoi
          ROI for computing window
 Roi dbRoi
          Debugging window for -debug: window
 DbSample dbSample
          instance of current sample
(package private) static int DIST_THR
          Distance threshold in pixels from mouse (x,y) to spot centroid to find spot
 DrawOverlays dol
          instance of DrawOverlays
 Roi dpRoi
          Debugging window for -pixdump: window
static boolean ENABLE_ZOOM
          Enable zoom of images
static int HIST_HEIGHT
          Height of the histogram
static int HIST_WIDTH
          Width of the histogram
static int IS_HEIGHT
          Height of the img scroller
static int IS_WIDTH
          Width of the img scroller
 int MAX_ROI
          max roi
 int maxRoi
           
(package private) static int NCOLS
           
 int nPixels
          The pixWidth*pixHeight
(package private) static int NROWS
          size of the text area in characters
 int paintCtr
          for debugging
 int pixHeight
          pixel height
 int pixWidth
          pixel width
 int ROI_CW
           
 int ROI_DBUG
           
 int ROI_ND
           
 int ROI_NONE
           
 int ROI_PIXDUMP
           
 int roiCode
          code for specific ROI overlays
 RoiList roiList
          list of ROIs for drawing
 java.lang.String roiName
          name for show ROI CW overlay
 Roi roiND
          ""ND",ROI_ND instance
(package private) static long serialVersionUID
          frame id
 Seg2Dgel sg2
          instance of main class
 ScrollableImage si
          scroller for image display
 Sg2showImage sig
          popup Image viewer GUI
 int VIEW_HEIGHT
          Height of the frame with and without histogram
 int viewHeight
           
 int viewWidth
           
 int xImg
          image address (x,y)+(xBase,yBase)
 int yImg
          image address (x,y)+(xBase,yBase)
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
Sg2viewImage(Seg2Dgel sg2, java.awt.Image img, int cWidth, int cHeight, Roi cwRoi, Roi roiND, Roi dbRoi, Roi dpRoi, int roiCode)
          Sg2viewImage() - Constructor
 
Method Summary
 boolean checkHistActiveBinFilter(DbSpot s)
          checkHistActiveBinFilter() - test if the histogram active bin is selected and histogram spot filtering is enabled.
 void close()
          close() - close this popup and reset flags
 void createRoi(Roi cwRoi, Roi dbRoi, Roi dpRoi, Roi roiND, int roiCode)
          createRoi() - Setup a list of ROIs to pass down to ScrollableImage The ROI assignments are:
 void drawOverLays(java.awt.Graphics g, java.awt.Image imgToDraw, int w, int h)
          drawOverLays() - paint the scrollable image canvas which includes the image, optional ROI's, overlay spots, optional histogram that is repainted in another class.
 java.awt.Dimension getPreferredSize()
          getPreferredSize() - getPreferredSize, needed for sizing frame and ScrollPane correctly.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
          mouseDragged() - display data
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
          mousePressed() - display data,
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paintComponent(java.awt.Graphics g)
          paintComponent() - paint the scrollable image
 boolean resetImage(java.awt.Image img)
          resetImage() - set or reset images
 void resetRoiList(RoiList roiList)
          resetRoiList() - set or reset roi list
 void setInternalCanvas(java.awt.Image pImage, int w, int h)
          setInternalCanvas() -
 void setSingleROItoDisplay(int code)
          setSingleROItoDisplay() - set one ROI to be displayed
 void setZoom(int zoomValue)
          setZoom() - set the image size/zoom and create a new internalCanvas
(package private)  java.lang.String showImageMousePositions(int x, int y, java.awt.event.MouseEvent e, java.lang.String msgs)
          showImageMousePositions() - show the image mouse positions Only report if debugging...
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
          windowClosing() - closing down the window, get rid of the frame.
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
frame id

See Also:
Constant Field Values

ENABLE_ZOOM

public static final boolean ENABLE_ZOOM
Enable zoom of images

See Also:
Constant Field Values

ROI_NONE

public final int ROI_NONE
See Also:
Constant Field Values

ROI_CW

public final int ROI_CW
See Also:
Constant Field Values

ROI_ND

public final int ROI_ND
See Also:
Constant Field Values

ROI_DBUG

public final int ROI_DBUG
See Also:
Constant Field Values

ROI_PIXDUMP

public final int ROI_PIXDUMP
See Also:
Constant Field Values

MAX_ROI

public final int MAX_ROI
max roi

See Also:
Constant Field Values

VIEW_HEIGHT

public final int VIEW_HEIGHT
Height of the frame with and without histogram

See Also:
Constant Field Values

HIST_WIDTH

public static final int HIST_WIDTH
Width of the histogram

See Also:
Constant Field Values

HIST_HEIGHT

public static final int HIST_HEIGHT
Height of the histogram

See Also:
Constant Field Values

IS_WIDTH

public static final int IS_WIDTH
Width of the img scroller

See Also:
Constant Field Values

IS_HEIGHT

public static final int IS_HEIGHT
Height of the img scroller

See Also:
Constant Field Values

NROWS

static final int NROWS
size of the text area in characters

See Also:
Constant Field Values

NCOLS

static final int NCOLS
See Also:
Constant Field Values

DIST_THR

static final int DIST_THR
Distance threshold in pixels from mouse (x,y) to spot centroid to find spot

See Also:
Constant Field Values

cwRoi

public Roi cwRoi
ROI for computing window


roiND

public Roi roiND
""ND",ROI_ND instance


dbRoi

public Roi dbRoi
Debugging window for -debug: window


dpRoi

public Roi dpRoi
Debugging window for -pixdump: window


roiName

public java.lang.String roiName
name for show ROI CW overlay


roiCode

public int roiCode
code for specific ROI overlays


sg2

public Seg2Dgel sg2
instance of main class


sig

public Sg2showImage sig
popup Image viewer GUI


cal

public CalibrateOD cal
instance of calibrate


dbSample

public DbSample dbSample
instance of current sample


si

public ScrollableImage si
scroller for image display


dol

public DrawOverlays dol
instance of DrawOverlays


viewWidth

public int viewWidth

viewHeight

public int viewHeight

nPixels

public int nPixels
The pixWidth*pixHeight


cWidth

int cWidth
canvas width


cHeight

int cHeight
canvas height


paintCtr

public int paintCtr
for debugging


pixHeight

public int pixHeight
pixel height


pixWidth

public int pixWidth
pixel width


xImg

public int xImg
image address (x,y)+(xBase,yBase)


yImg

public int yImg
image address (x,y)+(xBase,yBase)


roiList

public RoiList roiList
list of ROIs for drawing


maxRoi

public int maxRoi
Constructor Detail

Sg2viewImage

public Sg2viewImage(Seg2Dgel sg2,
                    java.awt.Image img,
                    int cWidth,
                    int cHeight,
                    Roi cwRoi,
                    Roi roiND,
                    Roi dbRoi,
                    Roi dpRoi,
                    int roiCode)
Sg2viewImage() - Constructor

Parameters:
img - image to be displayed
cWidth - canvas width
cHeight - canvas height
sg2 - instance of Seg2Dgel
cwRoi - computing window ROI
calCWroi - calibration wedge computing window ULHC coordinate x
dbRoi - Debugging window for -debug: window
dpRoi - Debugging window for -pixdump: window
roiCode - code for specific ROI overlays
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
getPreferredSize() - getPreferredSize, needed for sizing frame and ScrollPane correctly.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
frame size

setSingleROItoDisplay

public void setSingleROItoDisplay(int code)
setSingleROItoDisplay() - set one ROI to be displayed

Parameters:
code - is the ROI_xxxx code found in Sg2showImage class

resetRoiList

public void resetRoiList(RoiList roiList)
resetRoiList() - set or reset roi list

Parameters:
roiList - roiList to set

createRoi

public void createRoi(Roi cwRoi,
                      Roi dbRoi,
                      Roi dpRoi,
                      Roi roiND,
                      int roiCode)
createRoi() - Setup a list of ROIs to pass down to ScrollableImage The ROI assignments are:
   No ROI code:                  ROI_NONE= 0
   computing Window ROI code:    ROI_CW= 1
   Step Wedge ROI code:          ROI_ND= 2
   Debugging region ROI code:    ROI_DBUG= 3
   Picture dump region ROI code: ROI_PIXDUMP= 4
   Working ROI code:             ROI_WORKING= 5

 The ROI_WORKING may then be copied to the CW, DBUG or
 PIXDUMP ROIs

Parameters:
cwRoi - computing window ROI
calCWroi - calibration wedge computing window ULHC coordinate x
dbRoi - Debugging window for -debug: window
dpRoi - Debugging window for -pixdump: window
roiCode - which one to store for display

resetImage

public boolean resetImage(java.awt.Image img)
resetImage() - set or reset images

Parameters:
new - image to use

setInternalCanvas

public void setInternalCanvas(java.awt.Image pImage,
                              int w,
                              int h)
setInternalCanvas() -

Parameters:
pImage - to use
image - with
w - pixel width
h - pixel height

setZoom

public void setZoom(int zoomValue)
setZoom() - set the image size/zoom and create a new internalCanvas

Parameters:
zoomValue -

close

public void close()
close() - close this popup and reset flags


windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
windowClosing() - closing down the window, get rid of the frame.

Parameters:
e - is window closing event
See Also:
close()

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)

checkHistActiveBinFilter

public boolean checkHistActiveBinFilter(DbSpot s)
checkHistActiveBinFilter() - test if the histogram active bin is selected and histogram spot filtering is enabled. If not testing !useFilterByBinFlag), then return true. We test for filterGEQactiveBinFlag for GEQ activeBin value, else it is LEQ activeBin value. If testing GEQ activeBin and histType spot feature GEQ activeBinValue else if testing LEQ activeBin and the histType spot feature is LEQ activeBinValue, then return true, else false.

Parameters:
s - is spot to test
Returns:
true if spot meets filter criteria. If activeBin is not selected then return true. Otherwise return false.

drawOverLays

public void drawOverLays(java.awt.Graphics g,
                         java.awt.Image imgToDraw,
                         int w,
                         int h)
drawOverLays() - paint the scrollable image canvas which includes the image, optional ROI's, overlay spots, optional histogram that is repainted in another class.

Parameters:
g - is graphics context.

paintComponent

public void paintComponent(java.awt.Graphics g)
paintComponent() - paint the scrollable image

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - is graphics context.

showImageMousePositions

final java.lang.String showImageMousePositions(int x,
                                               int y,
                                               java.awt.event.MouseEvent e,
                                               java.lang.String msgs)
showImageMousePositions() - show the image mouse positions Only report if debugging...

Parameters:
e - is mouse event
msgs - is message to display
x - is image object position
y - is image object position

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged() - display data

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - is MouseEvent

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
mousePressed() - display data,

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - is MouseEvent

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener