Class DrawHistogram

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by DrawHistogram
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

 class DrawHistogram
extends javax.swing.JFrame
implements java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.WindowListener

The DrawHistogram class is used to draw an image intensity histogram in a popup frame. It is used for both the a) ROI region intensity histogram, and b) the ND step wedge calibraion (grayscale to OD) histogram. It is created on a per image (left or right) basis.

 NOTES:
 =====
 - The this.calibHistFlag indicates if it is a calibration or ROI
   histogram.
 - The instance lives in iData[12].dwHist and in iData[12].dwCalHist.
 - The histogram lives in iData.hist[] and is computed by 
   iData.calcHistogramROI() and iData.calcHistogram()
 - The (Quantify | Region Of Interest | Show ROI histogram (C-H))
   creates the histogram and computes the ROI data.
   i.e., (Quantify | Region of interest (ROI) | Capture measurement
   by ROI (C-R)) will also update the histogram if it exists.
 - Popup the calibration histogram from the menu
   (Quantify | Calibrate | Optical density).
 - There are different menu buttons in this popup depending on the
   functionality: either computing window ROI histogram or calibration
   (ND step wedge) histogram.
 The ND step wedge or spot-list grayscale to OD calibration procedure
============================--------------============================
 If a cal/{imageFile}.cal file exists when the image is loaded into
 flicker, it was read in at that time. Then when the Calibrate OD
 histogram was started, it uses those values in the Calibration Peaks
 table. Otherwise, the table will be null.
 NOTE: if you are using one of the four demo Leukemia gels, it will
 preload the OD values for demonstration purposes. 
 
 1. If you are using the step wedge, define a well-define ROI region 
    around the ND step wedge in the image using C-U (ULHC) and C-L
    (LRHC). Then compute the histogram using C-R.
 1.1 If instead, you are using the getPeaksByMeasFlag option, then do 
    NOT import the ROI histogram, but instead get the data from the 
    iData.spotList[] to save in a new histogram and the gray-peaks
    table as the mean spot values.
 2. If there are no OD data in the peaks table, then enter the OD 
    calibration values into the red Optical Density TextFields. [If the
    calibration was set previously and we read them in from the .cal 
    file, then preset these fields.] Also preset the corresponding 
    grayscale Gray-peak TextField values if you know what the values are.
    Special hack: If the current gel is not calibrated and the other
    gel has a calibration step list calib.ndWedgeODvalues[0:maxNDsteps-1]
    for maxNDsteps>0, then use it to save time typing it in.
 3. To force it to analyze the ROI wedge area, click on the
    "Analyze wedge ROI" button. This recomputes the histogram on
    the ROI (which may have changed) and the recomputes the calibration
    curve. 
 4. This will also update the Calibration Peak Table and generate the
    extrapolated mapGrayToOD[] calibration. The new histogram will show
    the Gray-peak values cooresponding to the OD values with red tick
    marks on the peaks. 
 4.1 It calls calib.findPeaks() to find the peaks and copies the peaks 
    into the Calibration Peak Table Gray-peak TextFields.
 4.2  It calls calib.extrapolateNDwedge() to compute calib.mapGrayToOD[] 
 4.3 It redraws the histogram plot with
     a) overlay calibration curve calib.mapGrayToOD[]
     b) Peaks table of (OD values, peak gray values)
 5. You can edit the peak list, by selecting a peak with the mouse and
    then pressing either throws "Add peak" or "Delete peak" button in 
    which case it redoes steps 4 through 4.3.
 6. When you are done editing you can save the calibration by pressing
    the "Save calibration state" button. This saves the calibration data
    in the cal/{imageFile}.cal file and copies the calib.mapGrayToOD[] 
    to the iData instance which you can then use for making calibrated
    measurements.
 7. Press "Done" to exit the calibration wizard.
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 Flicker Mozilla and Legal files are available on http://open2dprot.sourceforge.net/Flicker.

Version:
$Date$ $Revision$
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
Flicker Home, ShowHistPopup

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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
(package private)  int activeBin
          active bin idx [0:nHist-1] else -1
private  java.lang.String activeImage
          active image name is "left" or "right"
(package private) static int CAL_POPUP_HEIGHT
          default frame size height of popup
(package private) static int CAL_POPUP_WIDTH
          default frame size width of popup
private  CalibrateOD calib
          link to working data related CalibrateOD instance
private  CalibrateOD calibBKUP
          Backup copy of the initial CalibrateOD instance that can be used for restoring the calibration.
private  boolean calibChangedFlag
          The calibration peak table changed
private  boolean calibHistFlag
          The histogram is a calibration histogram
private  java.awt.Color calibPeakColor
          calibration peaks on histogram color
private  int cHeight
          working canvas height
private  int cWidth
          working canvas width
private  boolean drawIntoImageFlag
          set if draw plot to GIF file
private  java.awt.Panel editPanel
          Array of TextFields used in constructing the editable Peak Calibration Table.
private static Flicker flk
          link to global Flicker instance
private  java.lang.String fontFamily
          Font family
(package private)  java.awt.Dimension frameSize
          size of frame
private  boolean getPeaksByMeasFlag
          Get the peaks from the circular mask measurement spot list using the mean circle measurement grayscale values not corrected for background (since we do not know what background is).
private  int[] hist
          freq hist[0:nHist-1].
private  java.awt.Color histColor
           
private  int histMode
          The histogram mode is either: MODE_CW_ROI_HIST, MODE_CALIB_ND_ROI_HIST, or MODE_CALIB_SPOTLIST_HIST
private  java.awt.Color histTopColor
           
private  java.lang.String horizCaption
          horizontal caption
private  ImageData iData
          link to data related ImageData instance
private  java.lang.String imageFile
          current image file name
 boolean isVisibleFlag
          If the Histogram is visible
private  java.awt.Color labelColor
           
private  java.awt.Font largeFont
          medium font used for labeling
private  java.awt.Color lightWhite
           
(package private) static int MAX_GRAY
          # gray values in a pixel
(package private) static int MAX_ND_STEPS
          default # of peak wedge calibration table steps
(package private) static int MAXBINS
          # of histogram into bins
private  java.awt.Font mediumFont
          medium font used for labeling
(package private) static int MODE_CALIB_ND_ROI_HIST
          Draw histogram mode - draw calibration ND wedge histogram based on ND ROI region.
(package private) static int MODE_CALIB_SPOTLIST_HIST
          Draw histogram mode - draw calibration histogram based on spot list data.
(package private) static int MODE_CW_ROI_HIST
          Draw histogram mode - draw CW ROI histogram
(package private) static int N_PCT_PROLOGUE
          default # of initial rows in the peak wedge calibration table
private  java.awt.Color odColor
           
private  java.lang.String oGifFileName
          full Gif file path name
private  java.awt.Color optBkgrdColor
           
(package private) static int PEAK_CAL_TBL_COLS
          default # of editPanel cols
(package private) static int PEAK_CAL_TBL_ROWS
          default # of editPanel rows
private  java.awt.TextField[][] peakCalTblTF
          Array of TextFields used in constructing the Peak Calibration Table editPanel.
private  java.awt.Color peakNbrColor
          peak number color
private  int peakNbrFontSize
          font size for peak number labels
(package private)  java.lang.String r1
          extra sample data
(package private)  java.lang.String r2
          extra sample data
(package private)  java.lang.String r3
          extra sample data
(package private) static int ROI_POPUP_HEIGHT
          default frame size height of popup
(package private) static int ROI_POPUP_WIDTH
          default frame size width of popup
private  int[] sHist
          modified freq sHist[0:nHist-1].
private  java.awt.Font smallFont
          small font used for labeling
private  java.awt.Label statusLabel
          status Label
private  java.awt.Color textInputColor
           
private  java.lang.String title
          current canvas title
private static Util util
          link to global CalibrateOD instance
private  java.lang.String vertCaption
          vertical caption
private static int[] xPainted
          active hit coordinates
private static int[] yPainted
          active y hit coordinates
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DrawHistogram(Flicker flk, java.lang.String title, java.lang.String horizCaption, java.lang.String vertCaption, int histMode)
          DrawHistogram() - create a histogram plot for left or right selected image.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          actionPerformed() - Handle Control panel button clicks
private  void buildHistGUI()
          buildHistGUI() - build the histogram GUI
 void close()
          close() - close this popup and reset flags if needed [TODO] If they edited the calibration and peak calibration table, and they did not save the calibration (i.e.
private static void drawFilledBox(java.awt.Graphics g, int xC, int yC, int width, java.awt.Color color)
          drawFilledBox() - draw plus sign at the specified color.
(package private)  boolean drawGifFile(java.lang.String oGifFileName)
          drawGifFile() - draw plot into Gif image file if in stand-alone mode.
private  boolean drawHistInCanvas(java.awt.Graphics g)
          drawHistInCanvas() - draw histogram of hist[].
private static void drawPlus(java.awt.Graphics g, int x, int y, java.awt.Color color)
          drawPlus() - draw plus sign at the specified color.
 boolean genPeaksFromMeasSpotList()
          genPeaksFromMeasSpotList() - get the peak list from the circular mask measurement spot list using the mean circle measurement grayscale values.
 java.awt.Dimension getMinimumSize()
          getMinimumSize() - get the minimum preferred size
 java.awt.Dimension getPreferredSize()
          getPreferredSize() - getPreferredSize, needed for sizing frame correctly.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
          mouseDragged() - process mouse event
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 boolean mouseHandler(int x, int y)
          mouseHandler() - search for the active bin if any
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
          mouseReleased() - process mouse event
 void paint(java.awt.Graphics g)
          paint() - draw the histogram
private  void positionHistWindow()
          positionHistWindow() - position histogram window on the screen
private  boolean reExtrapolateCalibration()
          reExtrapolateCalibration() - regenerate the mapGrayToOD[] from the peak table
 boolean refreshPeakTable(boolean updateMapFlag)
          refreshPeakTable() - refresh the peak table from the TextFields...
 void setExtraInfo(java.lang.String r1, java.lang.String r2, java.lang.String r3)
          setExtraInfo() - set the extra info fields (r1,r2,f3)
 void setHorizCaption(java.lang.String horizCaption)
          setHorizCaption() - set the horizontal caption
 void setStatusMsg(java.lang.String msg)
          setStatusMsg() - set the status msg
 void setStatusMsg(java.lang.String msg, java.awt.Color color)
          setStatusMsg() - set the status msg
 void setTitleHist(java.lang.String title)
          setTitleHist() - set the title
 void setVertCaption(java.lang.String vertCaption)
          setVertCaption() - set the vertical caption
 void setVisible(boolean isVisibleFlag, boolean redoROIhistFlag)
          setVisible() - set the histogram as visible or not
 void updateHistogramPlot(boolean redoROIhistFlag)
          updateHistogramPlot() - set hist state and do repaint to draw it.
private  void updatePeakCalTable()
          updatePeakCalTable() - update the peak calibration table with new data from the calib od and gray value arrays.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
          windowClosing() - close down the window.
 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.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

MAX_GRAY

static final int MAX_GRAY
# gray values in a pixel

See Also:
Constant Field Values

MAXBINS

static final int MAXBINS
# of histogram into bins

See Also:
Constant Field Values

MODE_CW_ROI_HIST

static final int MODE_CW_ROI_HIST
Draw histogram mode - draw CW ROI histogram

See Also:
Constant Field Values

MODE_CALIB_ND_ROI_HIST

static final int MODE_CALIB_ND_ROI_HIST
Draw histogram mode - draw calibration ND wedge histogram based on ND ROI region.

See Also:
Constant Field Values

MODE_CALIB_SPOTLIST_HIST

static final int MODE_CALIB_SPOTLIST_HIST
Draw histogram mode - draw calibration histogram based on spot list data.

See Also:
Constant Field Values

ROI_POPUP_WIDTH

static final int ROI_POPUP_WIDTH
default frame size width of popup

See Also:
Constant Field Values

ROI_POPUP_HEIGHT

static final int ROI_POPUP_HEIGHT
default frame size height of popup

See Also:
Constant Field Values

CAL_POPUP_WIDTH

static final int CAL_POPUP_WIDTH
default frame size width of popup

See Also:
Constant Field Values

CAL_POPUP_HEIGHT

static final int CAL_POPUP_HEIGHT
default frame size height of popup

See Also:
Constant Field Values

N_PCT_PROLOGUE

static final int N_PCT_PROLOGUE
default # of initial rows in the peak wedge calibration table

See Also:
Constant Field Values

MAX_ND_STEPS

static final int MAX_ND_STEPS
default # of peak wedge calibration table steps

See Also:
Constant Field Values

PEAK_CAL_TBL_ROWS

static final int PEAK_CAL_TBL_ROWS
default # of editPanel rows

See Also:
Constant Field Values

PEAK_CAL_TBL_COLS

static final int PEAK_CAL_TBL_COLS
default # of editPanel cols

See Also:
Constant Field Values

flk

private static Flicker flk
link to global Flicker instance


util

private static Util util
link to global CalibrateOD instance


calib

private CalibrateOD calib
link to working data related CalibrateOD instance


calibBKUP

private CalibrateOD calibBKUP
Backup copy of the initial CalibrateOD instance that can be used for restoring the calibration.


iData

private ImageData iData
link to data related ImageData instance


imageFile

private java.lang.String imageFile
current image file name


activeImage

private java.lang.String activeImage
active image name is "left" or "right"


histMode

private int histMode
The histogram mode is either: MODE_CW_ROI_HIST, MODE_CALIB_ND_ROI_HIST, or MODE_CALIB_SPOTLIST_HIST


calibHistFlag

private boolean calibHistFlag
The histogram is a calibration histogram


calibChangedFlag

private boolean calibChangedFlag
The calibration peak table changed


getPeaksByMeasFlag

private boolean getPeaksByMeasFlag
Get the peaks from the circular mask measurement spot list using the mean circle measurement grayscale values not corrected for background (since we do not know what background is). Otherwise the ND step wedge histogram peak analysis is used.


frameSize

java.awt.Dimension frameSize
size of frame


cWidth

private int cWidth
working canvas width


cHeight

private int cHeight
working canvas height


oGifFileName

private java.lang.String oGifFileName
full Gif file path name


title

private java.lang.String title
current canvas title


vertCaption

private java.lang.String vertCaption
vertical caption


horizCaption

private java.lang.String horizCaption
horizontal caption


r1

java.lang.String r1
extra sample data


r2

java.lang.String r2
extra sample data


r3

java.lang.String r3
extra sample data


activeBin

int activeBin
active bin idx [0:nHist-1] else -1


hist

private int[] hist
freq hist[0:nHist-1].


sHist

private int[] sHist
modified freq sHist[0:nHist-1].


drawIntoImageFlag

private boolean drawIntoImageFlag
set if draw plot to GIF file


smallFont

private java.awt.Font smallFont
small font used for labeling


mediumFont

private java.awt.Font mediumFont
medium font used for labeling


largeFont

private java.awt.Font largeFont
medium font used for labeling


fontFamily

private java.lang.String fontFamily
Font family


peakNbrFontSize

private int peakNbrFontSize
font size for peak number labels


lightWhite

private java.awt.Color lightWhite

optBkgrdColor

private java.awt.Color optBkgrdColor

textInputColor

private java.awt.Color textInputColor

histColor

private java.awt.Color histColor

histTopColor

private java.awt.Color histTopColor

odColor

private java.awt.Color odColor

calibPeakColor

private java.awt.Color calibPeakColor
calibration peaks on histogram color


labelColor

private java.awt.Color labelColor

peakNbrColor

private java.awt.Color peakNbrColor
peak number color


editPanel

private java.awt.Panel editPanel
Array of TextFields used in constructing the editable Peak Calibration Table.


peakCalTblTF

private java.awt.TextField[][] peakCalTblTF
Array of TextFields used in constructing the Peak Calibration Table editPanel. Not all entries are used. It is of size [0:PEAK_CAL_TBL_ROWS-1][0:PEAK_CAL_TBL_COLS-1].


statusLabel

private java.awt.Label statusLabel
status Label


xPainted

private static int[] xPainted
active hit coordinates


yPainted

private static int[] yPainted
active y hit coordinates


isVisibleFlag

public boolean isVisibleFlag
If the Histogram is visible

Constructor Detail

DrawHistogram

public DrawHistogram(Flicker flk,
                     java.lang.String title,
                     java.lang.String horizCaption,
                     java.lang.String vertCaption,
                     int histMode)
DrawHistogram() - create a histogram plot for left or right selected image. If the image is not selected, it is not valid and the this.activeImage is set to null. The histogram data is in iData.hist[] and depends on the left or right image being selected. If calibHistFlag is set, then present a calibration histogram GUI.

Parameters:
flk - is the Flicker instance
title - is window title
horizCaption - is horizontal caption
vertCaption - is vertical caption (generally frequency)
histMode - is either MODE_CW_ROI_HIST, MODE_CALIB_ND_ROI_HIST, or MODE_CALIB_SPOTLIST_HIST
Method Detail

buildHistGUI

private void buildHistGUI()
buildHistGUI() - build the histogram GUI


getPreferredSize

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

Overrides:
getPreferredSize in class java.awt.Container
Returns:
frame size

positionHistWindow

private void positionHistWindow()
positionHistWindow() - position histogram window on the screen


setStatusMsg

public void setStatusMsg(java.lang.String msg)
setStatusMsg() - set the status msg

Parameters:
msg - is the status window msg

setStatusMsg

public void setStatusMsg(java.lang.String msg,
                         java.awt.Color color)
setStatusMsg() - set the status msg

Parameters:
msg - is the status window msg
color - to draw it

setTitleHist

public void setTitleHist(java.lang.String title)
setTitleHist() - set the title

Parameters:
title - is window title

setHorizCaption

public void setHorizCaption(java.lang.String horizCaption)
setHorizCaption() - set the horizontal caption

Parameters:
horizCaption - is horizontal caption

setVertCaption

public void setVertCaption(java.lang.String vertCaption)
setVertCaption() - set the vertical caption

Parameters:
vertCaption - is vertical caption (generally frequency)

setVisible

public void setVisible(boolean isVisibleFlag,
                       boolean redoROIhistFlag)
setVisible() - set the histogram as visible or not

Parameters:
redoROIhistFlag - will reompute thie iData.hist[] from the ROI window in the image.

drawGifFile

boolean drawGifFile(java.lang.String oGifFileName)
drawGifFile() - draw plot into Gif image file if in stand-alone mode. This sets it up and lets paint() to the heavy lifting...

Parameters:
oGifFileName - is the full path GIF output file
Returns:
true if successful

setExtraInfo

public void setExtraInfo(java.lang.String r1,
                         java.lang.String r2,
                         java.lang.String r3)
setExtraInfo() - set the extra info fields (r1,r2,f3)


getMinimumSize

public java.awt.Dimension getMinimumSize()
getMinimumSize() - get the minimum preferred size

Overrides:
getMinimumSize in class java.awt.Container
Returns:
window size

updatePeakCalTable

private void updatePeakCalTable()
updatePeakCalTable() - update the peak calibration table with new data from the calib od and gray value arrays.
 Array of TextFields used in constructing the editable
 Peak Calibration Table.
 It is of size [0:PEAK_CAL_TBL_ROWS-1][0:PEAK_CAL_TBL_COLS-1].
 holding the N_PCT_PROLOGUE rows plus the MAX_ND_STEPS.
  -------------------------------------------------------------
  col #0             col #1      col #2     col #3
  -------------------------------------------------------------
 0  Calibration units ["optical density" / "Grayvalue" / "CPM", etc.]
 1  Wedge window      [ndcwx1 : ndcwx2, ndcwy1 : ndcwy2] - set by ROI
 2  Wedge identifier  ["manufacturer and part #"]
 3  Step #1 OD        [od value] Gray peak [gray value]
    Step #2 OD        [od value] Gray peak [gray value]
           . . .
 n  Step #n OD        [od value] Gray peak [gray value]
  -------------------------------------------------------------  


refreshPeakTable

public boolean refreshPeakTable(boolean updateMapFlag)
refreshPeakTable() - refresh the peak table from the TextFields...

Parameters:
updateMapFlag - to apply the new table to updating mapGrayToOD[].
Returns:
true if succeed

reExtrapolateCalibration

private boolean reExtrapolateCalibration()
reExtrapolateCalibration() - regenerate the mapGrayToOD[] from the peak table

Returns:
true if the extrapolate succeeds

genPeaksFromMeasSpotList

public boolean genPeaksFromMeasSpotList()
genPeaksFromMeasSpotList() - get the peak list from the circular mask measurement spot list using the mean circle measurement grayscale values. These values are not corrected for background (since we do not know what background is).


updateHistogramPlot

public void updateHistogramPlot(boolean redoROIhistFlag)
updateHistogramPlot() - set hist state and do repaint to draw it.

Parameters:
redoROIhistFlag - will reompute thie iData.hist[] from the ROI window in the image.

drawPlus

private static final void drawPlus(java.awt.Graphics g,
                                   int x,
                                   int y,
                                   java.awt.Color color)
drawPlus() - draw plus sign at the specified color.

Parameters:
g - is graphics context
x - is center of object
y - is center of object
color - is color to draw

drawFilledBox

private static final void drawFilledBox(java.awt.Graphics g,
                                        int xC,
                                        int yC,
                                        int width,
                                        java.awt.Color color)
drawFilledBox() - draw plus sign at the specified color.

Parameters:
g - is graphics context
x - is center of object
y - is center of object
width - is width of object
color - is color to draw

drawHistInCanvas

private boolean drawHistInCanvas(java.awt.Graphics g)
drawHistInCanvas() - draw histogram of hist[].

Parameters:
g - is graphics context

paint

public void paint(java.awt.Graphics g)
paint() - draw the histogram

Overrides:
paint in class java.awt.Container
Parameters:
g - is graphics context
See Also:
drawHistInCanvas(java.awt.Graphics)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed() - Handle Control panel button clicks

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - is ActionEvent for buttons in control panel

mouseHandler

public boolean mouseHandler(int x,
                            int y)
mouseHandler() - search for the active bin if any

Parameters:
x - mouse position
y - mouse position
Returns:
true if found it in the xPainted[] list and set activeBin to the index i in [0:255] else set activeBin to -1.

close

public void close()
close() - close this popup and reset flags if needed [TODO] If they edited the calibration and peak calibration table, and they did not save the calibration (i.e. calibChangedFlag is true), then ask them here and save it if they say yes. If not, then restore the previous calibration.


mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged() - process mouse event

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

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased() - process mouse event

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - is mouse pressed event

mousePressed

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

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

mouseMoved

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

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
windowClosing() - close down the window.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
e - is window closing event
See Also:
close()

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener