Package gov.nih.mipav.view
Class ViewJComponentPreviewImage
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- gov.nih.mipav.view.ViewJComponentBase
-
- gov.nih.mipav.view.ViewJComponentPreviewImage
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
public class ViewJComponentPreviewImage extends ViewJComponentBase
Preview image displayed when the user clicks on an image file in the directory tree. For black and white, a default LUT is created. The image is resized if the panel holding it is resized.- Version:
- 1.0
- Author:
- Neva Cherniavsky
- See Also:
ViewImageDirectory
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
brightness
DOCUMENT ME!private float
contrast
DOCUMENT ME!private ModelImage
image
The model image this preview image is derived from.private int
imageSize
DOCUMENT ME!private int
imgHeight
DOCUMENT ME!private int
imgWidth
DOCUMENT ME!private PatientSlice
m_kPatientSlice
PatientSlice interfaces with the ModelImage class to render the image w/LUT changes for this component.private java.awt.image.MemoryImageSource
memImage
DOCUMENT ME!private java.lang.String
overlayText
Overlay text to show on the image.private int[]
paintBuffer
DOCUMENT ME!private int
panelHeight
DOCUMENT ME!private int
panelWidth
DOCUMENT ME!private PreviewImageContainer
parent
DOCUMENT ME!private static long
serialVersionUID
Use serialVersionUID for interoperability.-
Fields inherited from class gov.nih.mipav.view.ViewJComponentBase
ANNOTATION, BOTH, CENTER_VOI, CUBE_BOUNDS, DEFAULT, DELETE_POINT, DROPPER_PAINT, ELLIPSE, ERASER_PAINT, IMAGE_A, IMAGE_B, imageDim, img, imgB, interpMode, INTERPOLATE_A, INTERPOLATE_B, INTERPOLATE_BOTH, lastMouseX, lastMouseY, LEVELSET, LINE, LIVEWIRE, MAG_REGION, memImageA, memImageB, MOVE, MOVE_INTERSECTION_POINT, MOVE_POINT, MOVE_VOIPOINT, NEAREST_BOTH, NEW_POINT, NEW_VOI, OUT_OF_BOUNDS, PAINT_CAN, PAINT_VASC, PAINT_VOI, POINT_VOI, POLYLINE, POLYLINE_SLICE_VOI, PROBE, PROTRACTOR, QUICK_LUT, RECTANGLE, RECTANGLE3D, resolutionX, resolutionY, RETRACE, ROTATE, SELECT, showSliceNumber, sliceString, SMOOTH, SPLIT_VOI, textColor, TRANSLATE, VOI_3D, WAND, WIN_REGION, ZOOMING_IN, ZOOMING_OUT, zoomX, zoomY
-
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 ViewJComponentPreviewImage(ModelImage _image, int[] extents, PreviewImageContainer _parent)
Creates new preview image from the model image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
createImg(int slice)
Creates the Java image to be displayed from the model image.void
dispose(boolean gc)
Sets buffers to null.ModelImage
getImageA()
Get source imageint
getImageSize()
Gets the size of the image (width * height).java.awt.Dimension
getPreferredSize()
Size set to object size.void
importImage(int[] data, boolean haveFilter)
Creates a Image object form an array of ints that have been formatted (packed) properly (i.e. aRGB)void
paintComponent(java.awt.Graphics g)
Paints the component using the previous set image width and height.void
setImageA(ModelImage image)
Sets component's image A.void
setImgSize(int width, int height)
Sets the size of the image to be painted.void
setSliceBrightness(int brightness, float contrast)
Method to set the brightness and contrast of the animate slice.-
Methods inherited from class gov.nih.mipav.view.ViewJComponentBase
disposeLocal, finalize, getImage, getInterpMode, getLastMouseX, getLastMouseY, getResolutionX, getResolutionY, getScaledX, getScaledY, getSelectedPaintColor, getShowMagIntensityEnabled, getSize, getZoomX, getZoomY, importImage, importImageB, LocalToScreen, makePaintBitmapBorder, makePaintImage, paintCursorBoxComponent, paintWindowComponent, paintWindowComponent, ScreenToLocal, setInterpolationMode, setResolutions, setShowSliceNumber, setSliceString, setTextColor, setZoom, setZoomExact, update
-
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, 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, 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
-
brightness
private int brightness
DOCUMENT ME!
-
contrast
private float contrast
DOCUMENT ME!
-
imageSize
private final int imageSize
DOCUMENT ME!
-
imgHeight
private int imgHeight
DOCUMENT ME!
-
imgWidth
private int imgWidth
DOCUMENT ME!
-
memImage
private java.awt.image.MemoryImageSource memImage
DOCUMENT ME!
-
paintBuffer
private int[] paintBuffer
DOCUMENT ME!
-
panelHeight
private int panelHeight
DOCUMENT ME!
-
panelWidth
private int panelWidth
DOCUMENT ME!
-
parent
private final PreviewImageContainer parent
DOCUMENT ME!
-
m_kPatientSlice
private final PatientSlice m_kPatientSlice
PatientSlice interfaces with the ModelImage class to render the image w/LUT changes for this component. Slices are rendered in FileCoordinates.
-
image
private ModelImage image
The model image this preview image is derived from.
-
overlayText
private java.lang.String overlayText
Overlay text to show on the image.
-
-
Constructor Detail
-
ViewJComponentPreviewImage
public ViewJComponentPreviewImage(ModelImage _image, int[] extents, PreviewImageContainer _parent)
Creates new preview image from the model image. The extents will only be 2D. The parent is needed because of the order in which Java calls methods when a component is resized.- Parameters:
_image
- Model image to create preview image from.extents
- X and Y dimensions of image_parent
- Frame that called this
-
-
Method Detail
-
createImg
public boolean createImg(int slice)
Creates the Java image to be displayed from the model image. Makes it from the appropriate slice.- Parameters:
slice
- Slice of image to create java image from.- Returns:
- Flag indicating success or failure.
-
dispose
public void dispose(boolean gc)
Sets buffers to null.- Overrides:
dispose
in classViewJComponentBase
- Parameters:
gc
- Flag indicating if the garbage collector should be called.
-
getImageSize
public int getImageSize()
Gets the size of the image (width * height).- Returns:
- the size of the image
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
Size set to object size. Need to get real panel size first from the parent, then reset the image size.- Overrides:
getPreferredSize
in classViewJComponentBase
- Returns:
- Dimension with the size
-
importImage
public void importImage(int[] data, boolean haveFilter)
Creates a Image object form an array of ints that have been formatted (packed) properly (i.e. aRGB)- Parameters:
data
- Data (image) to be displayed that has been formatted (packed) properly (i.e. aRGB)haveFilter
- DOCUMENT ME!
-
paintComponent
public void paintComponent(java.awt.Graphics g)
Paints the component using the previous set image width and height.- Overrides:
paintComponent
in classViewJComponentBase
- Parameters:
g
- Graphics to draw image in.
-
getImageA
public ModelImage getImageA()
Get source image- Returns:
- ModelImage
-
setImageA
public void setImageA(ModelImage image)
Sets component's image A.- Parameters:
image
- Image to set to.
-
setImgSize
public void setImgSize(int width, int height)
Sets the size of the image to be painted.- Parameters:
width
- Width of panel where image will be placed.height
- Height of panel where image will be placed.
-
setSliceBrightness
public void setSliceBrightness(int brightness, float contrast)
Method to set the brightness and contrast of the animate slice.- Parameters:
brightness
- int going from -255 to 255contrast
- float scale factor
-
-