Package gov.nih.mipav.view
Class ViewJComponentHLUTBase
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- gov.nih.mipav.view.ViewJComponentHLUTBase
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable
- Direct Known Subclasses:
ViewJComponentHistoLUT,ViewJComponentHistoRGB
public abstract class ViewJComponentHLUTBase extends javax.swing.JComponentAbstract class used for generating custom components, especially within images.- Version:
- 0.1 Aug 1, 1997
- Author:
- Matthew J. McAuliffe, Ph.D.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanaddPointFlagDOCUMENT ME!static intALLMove all the channel transfer functions.static intALPHAThe alpha channel transfer function.protected static java.awt.ColorbackgroundColorThe default background color of JPanels (look and feel dependent).static intBLUEThe blue channel transfer function.protected java.awt.DimensioncomponentDimThe outer dimension of the histogram component we will be drawing.protected static java.awt.CursorcrosshairCursorCrosshair mouse cursor.static intCTCT predefined tranfer function.protected java.awt.DimensiondimThe histogram image dimension.static intDUAL_THRESHOLDDual threshold function.static intDUAL_THRESHOLD_INVInverse dual threshold function.static intGREENThe green channel transfer function.protected static java.awt.CursorhandCursorHand-shaped mouse cursor.protected ModelHistogramhistogramThe image histogram.protected int[]histogramBufferDOCUMENT ME!protected doublehistogramMaxDOCUMENT ME!protected doublehistogramMaxLogDOCUMENT ME!protected HistoLUTParenthistogramParentThe container of this histogram component.protected ModelImageimageThe image whose histo lut we are displaying.protected java.awt.ImageimgDOCUMENT ME!protected static intINACTIVEDOCUMENT ME!protected intindexDOCUMENT ME!static intLINEARLinear tranfer function mode (grayscale).protected booleanlogFlagWhether to transform the histogram data by log10.protected int[]lutIndexBufferDOCUMENT ME!protected intmodeThe current mode of the histogram component.protected static java.awt.CursormoveCursorMovement mouse cursor.static intNO_THRESHOLDNot using a tranfer function (grayscale).protected intoffsetXDOCUMENT ME!protected intoffsetYDOCUMENT ME!protected int[]pixBufferDOCUMENT ME!protected intrangeDOCUMENT ME!static intREDThe red channel transfer function.protected static java.awt.CursorresizeCursorComponent resize mouse cursor.private static longserialVersionUIDUse serialVersionUID for interoperability.static intSTAIRCASEStaircase transfer function.protected intstRangeDOCUMENT ME!static intTHRESHOLDThresholded transfer function mode (grayscale).protected intthresholdModeThe current threshold mode (dual or dual inverse) or NO_THRESHOLD if not in theshold mode.protected float[]xDOCUMENT ME!protected int[]xNDOCUMENT ME!protected float[]yDOCUMENT ME!protected int[]yNDOCUMENT ME!protected float[]zDOCUMENT ME!protected int[]zNDOCUMENT ME!-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description ViewJComponentHLUTBase(HistoLUTParent parent, ModelHistogram histo, ModelImage image, java.awt.Dimension compDim)Creates object of size defined by width & height.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddFunctionPoint(float x, float y)Add a new function point to the current LUT transfer function.abstract voidcheckProximityToTransferFunction(float x, float y, boolean remove)Check to see if the position of the mouse is close to one of the points in the LUT transfer function or the line drawn in between the points.voiddispose()Abstract method to force extended classes to implement a disposal method to clean up memory.abstract voiddualThresholdMode(int thresholdMode)Switch the histogram component to (inverse or regular) dual threshold mode.abstract voidevenDistribution()Switch the histogram component to even distribution linear transfer mode.protected voidfinalize()Clean up some resources.ModelImagegetImage()Access the associated image.java.awt.DimensiongetMinimumSize()Gets minimum size equal to object size.intgetMode()Get the histogram mode (ie - RED, GREEN, BLUE ).java.awt.DimensiongetPreferredSize()Gets preferred size to set object size to.TransferFunctiongetTransferFunction()Get the current transfer function we are working with.voidimportImage(int[] data)Creates a Image object from an array of ints that have been formatted (packed) properly (ie, aRGB).booleanisVolOpacityChanged()DOCUMENT ME!abstract voidlinearMode()Switch the histogram component to linear line mode.voidpaintComponent(java.awt.Graphics g)Paints the image and border.abstract voidremoveClickedFunctionPoint()Remove the point of the LUT transfer function which the mouse is hovering over (determined bymouseMotion).voidsetHistogramInfo(ModelImage _image, ModelHistogram _histo)Set up the image, LUT and histogram information.voidsetLogFlag(boolean value)This flag indicates if the histogram should be displayed using a log10 scale.abstract voidsetLUT(ModelStorageBase LUT)voidsetMode(int _mode)Accessor that sets the mode.voidshowHistogram()Show the histogram without filtering it through a LUT.abstract voidshowHistogram(ModelLUT LUT)Filters the histogram through the LUT and produces an int array (aRGB) that can be converted to a java image of the histogram for display purposes.voidupdateDualThreshold(float lower, float upper)Updates the corresponding points for the threshold (transfer line).voidupdateTransFunc(VOIContour transFunc)DOCUMENT ME!-
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, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
-
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, 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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
LINEAR
public static final int LINEAR
Linear tranfer function mode (grayscale).- See Also:
- Constant Field Values
-
THRESHOLD
public static final int THRESHOLD
Thresholded transfer function mode (grayscale).- See Also:
- Constant Field Values
-
NO_THRESHOLD
public static final int NO_THRESHOLD
Not using a tranfer function (grayscale).- See Also:
- Constant Field Values
-
DUAL_THRESHOLD
public static final int DUAL_THRESHOLD
Dual threshold function.- See Also:
- Constant Field Values
-
DUAL_THRESHOLD_INV
public static final int DUAL_THRESHOLD_INV
Inverse dual threshold function.- See Also:
- Constant Field Values
-
STAIRCASE
public static final int STAIRCASE
Staircase transfer function.- See Also:
- Constant Field Values
-
CT
public static final int CT
CT predefined tranfer function.- See Also:
- Constant Field Values
-
RED
public static final int RED
The red channel transfer function.- See Also:
- Constant Field Values
-
GREEN
public static final int GREEN
The green channel transfer function.- See Also:
- Constant Field Values
-
BLUE
public static final int BLUE
The blue channel transfer function.- See Also:
- Constant Field Values
-
ALPHA
public static final int ALPHA
The alpha channel transfer function.- See Also:
- Constant Field Values
-
ALL
public static final int ALL
Move all the channel transfer functions.- See Also:
- Constant Field Values
-
INACTIVE
protected static final int INACTIVE
DOCUMENT ME!- See Also:
- Constant Field Values
-
backgroundColor
protected static final java.awt.Color backgroundColor
The default background color of JPanels (look and feel dependent).
-
crosshairCursor
protected static final java.awt.Cursor crosshairCursor
Crosshair mouse cursor. Should move to MipavUtil eventually.
-
moveCursor
protected static final java.awt.Cursor moveCursor
Movement mouse cursor. Should move to MipavUtil eventually.
-
resizeCursor
protected static final java.awt.Cursor resizeCursor
Component resize mouse cursor. Should move to MipavUtil eventually.
-
handCursor
protected static final java.awt.Cursor handCursor
Hand-shaped mouse cursor. Should move to MipavUtil eventually.
-
addPointFlag
protected boolean addPointFlag
DOCUMENT ME!
-
componentDim
protected java.awt.Dimension componentDim
The outer dimension of the histogram component we will be drawing.
-
dim
protected java.awt.Dimension dim
The histogram image dimension.
-
histogram
protected ModelHistogram histogram
The image histogram.
-
histogramBuffer
protected int[] histogramBuffer
DOCUMENT ME!
-
histogramMax
protected double histogramMax
DOCUMENT ME!
-
histogramMaxLog
protected double histogramMaxLog
DOCUMENT ME!
-
histogramParent
protected HistoLUTParent histogramParent
The container of this histogram component.
-
image
protected ModelImage image
The image whose histo lut we are displaying.
-
img
protected java.awt.Image img
DOCUMENT ME!
-
index
protected int index
DOCUMENT ME!
-
logFlag
protected boolean logFlag
Whether to transform the histogram data by log10.
-
lutIndexBuffer
protected int[] lutIndexBuffer
DOCUMENT ME!
-
mode
protected int mode
The current mode of the histogram component.
-
offsetX
protected int offsetX
DOCUMENT ME!
-
offsetY
protected int offsetY
DOCUMENT ME!
-
pixBuffer
protected int[] pixBuffer
DOCUMENT ME!
-
range
protected int range
DOCUMENT ME!
-
stRange
protected int stRange
DOCUMENT ME!
-
thresholdMode
protected int thresholdMode
The current threshold mode (dual or dual inverse) or NO_THRESHOLD if not in theshold mode.
-
x
protected float[] x
DOCUMENT ME!
-
xN
protected int[] xN
DOCUMENT ME!
-
y
protected float[] y
DOCUMENT ME!
-
yN
protected int[] yN
DOCUMENT ME!
-
z
protected float[] z
DOCUMENT ME!
-
zN
protected int[] zN
DOCUMENT ME!
-
-
Constructor Detail
-
ViewJComponentHLUTBase
public ViewJComponentHLUTBase(HistoLUTParent parent, ModelHistogram histo, ModelImage image, java.awt.Dimension compDim)
Creates object of size defined by width & height.- Parameters:
parent- DOCUMENT ME!histo- DOCUMENT ME!image- DOCUMENT ME!compDim- width and height of component
-
-
Method Detail
-
addFunctionPoint
public abstract void addFunctionPoint(float x, float y)Add a new function point to the current LUT transfer function.- Parameters:
x- the x position within the component to add the new pointy- the y position within the component to add the new point
-
checkProximityToTransferFunction
public abstract void checkProximityToTransferFunction(float x, float y, boolean remove)Check to see if the position of the mouse is close to one of the points in the LUT transfer function or the line drawn in between the points.- Parameters:
x- the x position within the componenty- the y position within the componentremove- whether we want to remove a point (assuming that we are near one)
-
dualThresholdMode
public abstract void dualThresholdMode(int thresholdMode)
Switch the histogram component to (inverse or regular) dual threshold mode.- Parameters:
thresholdMode- either DUAL_THRESHOLD, DUAL_THRESHOLD_INV, or NO_THRESHOLD
-
evenDistribution
public abstract void evenDistribution()
Switch the histogram component to even distribution linear transfer mode.
-
linearMode
public abstract void linearMode()
Switch the histogram component to linear line mode.
-
removeClickedFunctionPoint
public abstract void removeClickedFunctionPoint()
Remove the point of the LUT transfer function which the mouse is hovering over (determined bymouseMotion).
-
showHistogram
public abstract void showHistogram(ModelLUT LUT)
Filters the histogram through the LUT and produces an int array (aRGB) that can be converted to a java image of the histogram for display purposes.- Parameters:
LUT- LUT to filter with
-
setLUT
public abstract void setLUT(ModelStorageBase LUT)
-
dispose
public void dispose()
Abstract method to force extended classes to implement a disposal method to clean up memory.
-
getImage
public ModelImage getImage()
Access the associated image.- Returns:
- ModelImage Reference to image instance.
-
getMinimumSize
public java.awt.Dimension getMinimumSize()
Gets minimum size equal to object size.- Overrides:
getMinimumSizein classjavax.swing.JComponent- Returns:
- Dimension with the size
-
getMode
public int getMode()
Get the histogram mode (ie - RED, GREEN, BLUE ).- Returns:
- the histogram mode
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
Gets preferred size to set object size to.- Overrides:
getPreferredSizein classjavax.swing.JComponent- Returns:
- Dimension with the size
-
getTransferFunction
public TransferFunction getTransferFunction()
Get the current transfer function we are working with.- Returns:
- the LUT tranfer function
-
importImage
public void importImage(int[] data)
Creates a Image object from an array of ints that have been formatted (packed) properly (ie, aRGB).- Parameters:
data- Data (image) to be displayed.
-
isVolOpacityChanged
public boolean isVolOpacityChanged()
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
paintComponent
public void paintComponent(java.awt.Graphics g)
Paints the image and border.- Overrides:
paintComponentin classjavax.swing.JComponent- Parameters:
g- Graphics handle
-
setHistogramInfo
public void setHistogramInfo(ModelImage _image, ModelHistogram _histo)
Set up the image, LUT and histogram information.- Parameters:
_image- image_histo- histogram of the image
-
setLogFlag
public void setLogFlag(boolean value)
This flag indicates if the histogram should be displayed using a log10 scale.- Parameters:
value-trueuse the Log scale andfalsepaint bars in linear scale
-
setMode
public void setMode(int _mode)
Accessor that sets the mode.- Parameters:
_mode- the mode of the histogram
-
showHistogram
public void showHistogram()
Show the histogram without filtering it through a LUT.
-
updateDualThreshold
public void updateDualThreshold(float lower, float upper)Updates the corresponding points for the threshold (transfer line).- Parameters:
lower- the lower threshold valueupper- the upper threshold value
-
updateTransFunc
public void updateTransFunc(VOIContour transFunc)
DOCUMENT ME!- Parameters:
transFunc- VOIContour
-
finalize
protected void finalize() throws java.lang.ThrowableClean up some resources.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable- if there is a problem during cleanup
-
-