|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
Seg2Dgel.Sg2drawHistogram
public class Sg2drawHistogram
Class Sg2drawHistogram is used to draw an image intensity histogram
Refactored from Sg2showImage 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/.
| 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 | |
|---|---|
int |
activeBin
active bin idx of SCALED sHist[0:nHist-1] else -1 |
private java.awt.Color |
activeBinColor
Active bin peak on histogram color |
float |
activeBinValue
active bin data value corresponding to activeBinidx of SCALED sHist[0:nHist-1]. |
float |
binScale
sHist[] Bin width sampling or averaging distance computed as floating (nHist/nShist) to map hist[] to a sHist[] bin. |
boolean |
changeGuiFlag
flag to indicating that the GUI may have changed and that it should be rebuilt. |
private int |
cHeight
working canvas height |
private int |
cWidth
working canvas width |
private java.lang.String |
dataName
name of the data used in histogram |
private java.lang.String |
dataUnits
data units abbreviation |
java.lang.String |
dispName
Name of image to display after a segmentation |
char[] |
dispPixC
Picture buffer char[] of image to display after a segmentation. |
java.lang.String |
dispPixFile
File of image to display after a segmentation. |
int[] |
dispPixI
Picture buffer int[] of image to display after a segmentation. |
(package private) java.awt.Dimension |
frameSize
size of frame |
boolean |
hasHistFlag
Histogram exists and should be drawn. |
boolean |
hasHistGUIflag
flag to indicate that the GUI contains the Histogram sub-GUI |
static int |
HIST_HEIGHT
Height of the histogram |
static int |
HIST_WIDTH
Width of the histogram |
private java.awt.Color |
histColor
|
private java.awt.Color |
histTopColor
|
int |
histType
type of data to use with the histogram |
private java.awt.Color |
labelColor
|
private java.awt.Font |
largeFont
medium font used for labeling |
float |
maxDataValue
The maximum data value at hist[max index] |
int |
maxHistFreqValue
The maximum frequency in hist[] |
int |
maxShistFreq
max sHist Frequency in sHist value to be displayed |
int |
maxShistIdx
max non-zero bin of sHist to be displayed |
int |
meanDataGrayValue
mean non-zero data gray value of sHist to display for Image density |
float |
meanDataValue
mean non-zero data value of sHist to be displayed |
int |
meanShistIdx
mean non-zero bin of sHist to be displayed |
private java.awt.Color |
meanValueBinColor
Mean value bin peak on histogram color |
int |
medianDataGrayValue
median non-zero data gray value of sHist to display for Image density |
float |
medianDataValue
median non-zero data value of sHist to be displayed |
int |
medianShistIdx
median non-zero bin of sHist to be displayed |
private java.awt.Color |
medianValueBinColor
Median value bin peak on histogram color |
private java.awt.Font |
mediumFont
medium font used for labeling |
float |
minDataValue
The minimum data value at hist[0] |
int |
minHistFreqValue
The minimum frequency value in hist[] |
int |
minShistFreq
min sHist Frequency in sHist value to be displayed |
int |
minShistIdx
min non-zero bin of sHist to be displayed |
int |
modeDataGrayValue
mode non-zero data gray value of sHist to display for Image density |
float |
modeDataValue
mode non-zero data value of sHist to be displayed |
int |
modeShistIdx
mode non-zero bin of sHist to be displayed |
private java.awt.Color |
modeValueBinColor
Mode value bin peak on histogram color |
int |
nbrPassedFilter
# of spots passing filter |
private int |
nShist
size of input unscaled histogram[] data |
private java.awt.Color |
optBkgrdColor
|
int |
preferredHeight
preferred size of canvas |
int |
preferredWidth
preferred size of canvas |
int |
roiX1
ROI ULHC X |
int |
roiX2
ROI LRHC X |
int |
roiY1
ROI ULHC Y |
int |
roiY2
ROI LRHC Y |
float |
scaleFreq
sHist[] frequency scale factor computed as floating (maxHistFreq/nShist) |
(package private) static long |
serialVersionUID
frame id |
private Seg2Dgel |
sg2
link to global instance |
private int[] |
sHist
local SCALED histogram [0:nShist-1]data |
private int[] |
sHistDisp
local SCALED histogram [0:nShist-1] scaled to max data value of nShist |
private Sg2showImage |
ssi
|
boolean |
useFilterByBinFlag
menu CB item to filter spots by testing if the histogram active bin is selected and histogram spot feature meets the active bin test |
boolean |
useHistGUIflag
flag to use simple ImageViewer w/o histogram or full GUI with the histogram |
int |
xLRHC
lower Y right hand corner of hist. |
private int[] |
xPainted
local SCALED histogram X position |
int |
xULHC
upper X left hand corner of hist. |
int |
yLRHC
lower Y right hand corner of hist. |
int |
yULHC
upper Y left hand corner of hist. |
| 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 | |
|---|---|
Sg2drawHistogram(Sg2showImage ssi,
java.awt.Dimension frameSize,
boolean useHistGUIflag,
boolean useFilterByBinFlag)
DrawHistogram() - create a blank histogram canvas |
|
| Method Summary | |
|---|---|
private void |
drawFilledBox(java.awt.Graphics g,
int xC,
int yC,
int width,
java.awt.Color color)
drawFilledBox() - draw plus sign at the specified color. |
private void |
drawFilledRectangle(java.awt.Graphics g,
int x1,
int x2,
int y1,
int y2,
java.awt.Color color)
drawFilledRectangle() - draw plus sign at the specified color. |
private boolean |
drawHistInCanvas(java.awt.Graphics g)
drawHistInCanvas() - draw histogram of hist[]. |
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() - redraw the histogram |
boolean |
setHistData(java.lang.String title,
boolean hasHistFlag,
java.lang.String dataName,
java.lang.String dataUnits,
java.lang.String horizCaption,
java.lang.String vertCaption,
int[] hist,
float minDataValue,
float maxDataValue)
setHistData() - set the hist data, title, Horiz and Vert captions and then repaint to start drawing it. |
| 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, 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 |
|---|
static final long serialVersionUID
public static final int HIST_WIDTH
public static final int HIST_HEIGHT
private Sg2showImage ssi
private Seg2Dgel sg2
public int preferredWidth
public int preferredHeight
private java.awt.Font mediumFont
private java.awt.Font largeFont
private java.awt.Color optBkgrdColor
private java.awt.Color histColor
private java.awt.Color histTopColor
private java.awt.Color activeBinColor
private java.awt.Color meanValueBinColor
private java.awt.Color modeValueBinColor
private java.awt.Color medianValueBinColor
private java.awt.Color labelColor
java.awt.Dimension frameSize
private int cWidth
private int cHeight
private java.lang.String dataName
private java.lang.String dataUnits
private int[] sHist
private int nShist
private int[] sHistDisp
private int[] xPainted
public int activeBin
public float activeBinValue
public int xULHC
public int yULHC
public int xLRHC
public int yLRHC
public int minShistIdx
public int maxShistIdx
public int meanShistIdx
public int medianShistIdx
public int modeShistIdx
public int minShistFreq
public int maxShistFreq
public int minHistFreqValue
public int maxHistFreqValue
public float meanDataValue
public float medianDataValue
public float modeDataValue
public int meanDataGrayValue
public int medianDataGrayValue
public int modeDataGrayValue
public float minDataValue
public float maxDataValue
public float binScale
public float scaleFreq
public boolean changeGuiFlag
public boolean hasHistGUIflag
public boolean useHistGUIflag
public int roiX1
public int roiY1
public int roiX2
public int roiY2
public java.lang.String dispName
public int[] dispPixI
public char[] dispPixC
public java.lang.String dispPixFile
public int histType
public boolean useFilterByBinFlag
public int nbrPassedFilter
public boolean hasHistFlag
| Constructor Detail |
|---|
public Sg2drawHistogram(Sg2showImage ssi,
java.awt.Dimension frameSize,
boolean useHistGUIflag,
boolean useFilterByBinFlag)
ssi - is Sg2showImageframeSize - is size of canvas| Method Detail |
|---|
public boolean setHistData(java.lang.String title,
boolean hasHistFlag,
java.lang.String dataName,
java.lang.String dataUnits,
java.lang.String horizCaption,
java.lang.String vertCaption,
int[] hist,
float minDataValue,
float maxDataValue)
title - title of histograms and should be drawn.hasHistFlag - is cleared if we decide to blank out the histogram.dataName - of the type of data useddataUnits - of the type of data usedhorizCaption - horizontal captionvertCaption - vertical captionhist - is the histogram array of any sizeminDataValue - is the value the data at hist[0]maxDataValue - is the value the data at hist[max index]
private final void drawFilledBox(java.awt.Graphics g,
int xC,
int yC,
int width,
java.awt.Color color)
g - is graphics contextx - is center of objecty - is center of objectwidth - is width of objectcolor - is color to draw
private final void drawFilledRectangle(java.awt.Graphics g,
int x1,
int x2,
int y1,
int y2,
java.awt.Color color)
g - is graphics contextx1 - is Left edgex1 - is Left edgey1 - is top edgecolor - is color to drawprivate boolean drawHistInCanvas(java.awt.Graphics g)
g - is graphics contextpublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentg - is graphics contextdrawHistInCanvas(java.awt.Graphics)
public boolean mouseHandler(int x,
int y)
x - mouse positiony - mouse position
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - is mouse pressed eventpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenere - is mouse pressed eventpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||