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:
ImageObserver,MenuContainer,Serializable
- Direct Known Subclasses:
ViewJComponentHistoLUT,ViewJComponentHistoRGB
Abstract class used for generating custom components, especially within images.
- Version:
- 0.1 Aug 1, 1997
- Author:
- Matthew J. McAuliffe, Ph.D.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanDOCUMENT ME!static final intMove all the channel transfer functions.static final intThe alpha channel transfer function.protected static final ColorThe default background color of JPanels (look and feel dependent).static final intThe blue channel transfer function.protected DimensionThe outer dimension of the histogram component we will be drawing.protected static final CursorCrosshair mouse cursor.static final intCT predefined tranfer function.protected DimensionThe histogram image dimension.static final intDual threshold function.static final intInverse dual threshold function.static final intThe green channel transfer function.protected static final CursorHand-shaped mouse cursor.protected ModelHistogramThe image histogram.protected int[]DOCUMENT ME!protected doubleDOCUMENT ME!protected doubleDOCUMENT ME!protected HistoLUTParentThe container of this histogram component.protected ModelImageThe image whose histo lut we are displaying.protected ImageDOCUMENT ME!protected static final intDOCUMENT ME!protected intDOCUMENT ME!static final intLinear tranfer function mode (grayscale).protected booleanWhether to transform the histogram data by log10.protected int[]DOCUMENT ME!protected intThe current mode of the histogram component.protected static final CursorMovement mouse cursor.static final intNot using a tranfer function (grayscale).protected intDOCUMENT ME!protected intDOCUMENT ME!protected int[]DOCUMENT ME!protected intDOCUMENT ME!static final intThe red channel transfer function.protected static final CursorComponent resize mouse cursor.private static final longUse serialVersionUID for interoperability.static final intStaircase transfer function.protected intDOCUMENT ME!static final intThresholded transfer function mode (grayscale).protected intThe current threshold mode (dual or dual inverse) or NO_THRESHOLD if not in theshold mode.protected float[]DOCUMENT ME!protected int[]DOCUMENT ME!protected float[]DOCUMENT ME!protected int[]DOCUMENT ME!protected float[]DOCUMENT ME!protected int[]DOCUMENT 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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionViewJComponentHLUTBase(HistoLUTParent parent, ModelHistogram histo, ModelImage image, Dimension compDim) Creates object of size defined by width & height. -
Method Summary
Modifier and TypeMethodDescriptionabstract 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 voidSwitch the histogram component to even distribution linear transfer mode.protected voidfinalize()Clean up some resources.getImage()Access the associated image.Gets minimum size equal to object size.intgetMode()Get the histogram mode (ie - RED, GREEN, BLUE ).Gets preferred size to set object size to.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).booleanDOCUMENT ME!abstract voidSwitch the histogram component to linear line mode.voidPaints the image and border.abstract voidRemove 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.voidShow 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, updateUIMethods 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, validateTreeMethods 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 Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
LINEAR
public static final int LINEARLinear tranfer function mode (grayscale).- See Also:
-
THRESHOLD
public static final int THRESHOLDThresholded transfer function mode (grayscale).- See Also:
-
NO_THRESHOLD
public static final int NO_THRESHOLDNot using a tranfer function (grayscale).- See Also:
-
DUAL_THRESHOLD
public static final int DUAL_THRESHOLDDual threshold function.- See Also:
-
DUAL_THRESHOLD_INV
public static final int DUAL_THRESHOLD_INVInverse dual threshold function.- See Also:
-
STAIRCASE
public static final int STAIRCASEStaircase transfer function.- See Also:
-
CT
public static final int CTCT predefined tranfer function.- See Also:
-
RED
public static final int REDThe red channel transfer function.- See Also:
-
GREEN
public static final int GREENThe green channel transfer function.- See Also:
-
BLUE
public static final int BLUEThe blue channel transfer function.- See Also:
-
ALPHA
public static final int ALPHAThe alpha channel transfer function.- See Also:
-
ALL
public static final int ALLMove all the channel transfer functions.- See Also:
-
INACTIVE
protected static final int INACTIVEDOCUMENT ME!- See Also:
-
backgroundColor
The default background color of JPanels (look and feel dependent). -
crosshairCursor
Crosshair mouse cursor. Should move to MipavUtil eventually. -
moveCursor
Movement mouse cursor. Should move to MipavUtil eventually. -
resizeCursor
Component resize mouse cursor. Should move to MipavUtil eventually. -
handCursor
Hand-shaped mouse cursor. Should move to MipavUtil eventually. -
addPointFlag
protected boolean addPointFlagDOCUMENT ME! -
componentDim
The outer dimension of the histogram component we will be drawing. -
dim
The histogram image dimension. -
histogram
The image histogram. -
histogramBuffer
protected int[] histogramBufferDOCUMENT ME! -
histogramMax
protected double histogramMaxDOCUMENT ME! -
histogramMaxLog
protected double histogramMaxLogDOCUMENT ME! -
histogramParent
The container of this histogram component. -
image
The image whose histo lut we are displaying. -
img
DOCUMENT ME! -
index
protected int indexDOCUMENT ME! -
logFlag
protected boolean logFlagWhether to transform the histogram data by log10. -
lutIndexBuffer
protected int[] lutIndexBufferDOCUMENT ME! -
mode
protected int modeThe current mode of the histogram component. -
offsetX
protected int offsetXDOCUMENT ME! -
offsetY
protected int offsetYDOCUMENT ME! -
pixBuffer
protected int[] pixBufferDOCUMENT ME! -
range
protected int rangeDOCUMENT ME! -
stRange
protected int stRangeDOCUMENT ME! -
thresholdMode
protected int thresholdModeThe current threshold mode (dual or dual inverse) or NO_THRESHOLD if not in theshold mode. -
x
protected float[] xDOCUMENT ME! -
xN
protected int[] xNDOCUMENT ME! -
y
protected float[] yDOCUMENT ME! -
yN
protected int[] yNDOCUMENT ME! -
z
protected float[] zDOCUMENT ME! -
zN
protected int[] zNDOCUMENT ME!
-
-
Constructor Details
-
ViewJComponentHLUTBase
public ViewJComponentHLUTBase(HistoLUTParent parent, ModelHistogram histo, ModelImage image, 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 Details
-
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
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
-
dispose
public void dispose()Abstract method to force extended classes to implement a disposal method to clean up memory. -
getImage
Access the associated image.- Returns:
- ModelImage Reference to image instance.
-
getMinimumSize
Gets minimum size equal to object size.- Overrides:
getMinimumSizein classJComponent- Returns:
- Dimension with the size
-
getMode
public int getMode()Get the histogram mode (ie - RED, GREEN, BLUE ).- Returns:
- the histogram mode
-
getPreferredSize
Gets preferred size to set object size to.- Overrides:
getPreferredSizein classJComponent- Returns:
- Dimension with the size
-
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
Paints the image and border.- Overrides:
paintComponentin classJComponent- Parameters:
g- Graphics handle
-
setHistogramInfo
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
DOCUMENT ME!- Parameters:
transFunc- VOIContour
-
finalize
Clean up some resources.
-