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:
ImageObserver,MenuContainer,Serializable
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:
-
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 TypeFieldDescriptionprivate intDOCUMENT ME!private floatDOCUMENT ME!private ModelImageThe model image this preview image is derived from.private final intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private final PatientSlicePatientSlice interfaces with the ModelImage class to render the image w/LUT changes for this component.private MemoryImageSourceDOCUMENT ME!private StringOverlay text to show on the image.private int[]DOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private final PreviewImageContainerDOCUMENT ME!private static final longUse 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, zoomYFields 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
ConstructorsConstructorDescriptionViewJComponentPreviewImage(ModelImage _image, int[] extents, PreviewImageContainer _parent) Creates new preview image from the model image. -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateImg(int slice) Creates the Java image to be displayed from the model image.voiddispose(boolean gc) Sets buffers to null.Get source imageintGets the size of the image (width * height).Size set to object size.voidimportImage(int[] data, boolean haveFilter) Creates a Image object form an array of ints that have been formatted (packed) properly (i.e. aRGB)voidPaints the component using the previous set image width and height.voidsetImageA(ModelImage image) Sets component's image A.voidsetImgSize(int width, int height) Sets the size of the image to be painted.voidsetSliceBrightness(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, updateMethods 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, 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:
-
brightness
private int brightnessDOCUMENT ME! -
contrast
private float contrastDOCUMENT ME! -
imageSize
private final int imageSizeDOCUMENT ME! -
imgHeight
private int imgHeightDOCUMENT ME! -
imgWidth
private int imgWidthDOCUMENT ME! -
memImage
DOCUMENT ME! -
paintBuffer
private int[] paintBufferDOCUMENT ME! -
panelHeight
private int panelHeightDOCUMENT ME! -
panelWidth
private int panelWidthDOCUMENT ME! -
parent
DOCUMENT ME! -
m_kPatientSlice
PatientSlice interfaces with the ModelImage class to render the image w/LUT changes for this component. Slices are rendered in FileCoordinates. -
image
The model image this preview image is derived from. -
overlayText
Overlay text to show on the image.
-
-
Constructor Details
-
ViewJComponentPreviewImage
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 Details
-
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:
disposein 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
Size set to object size. Need to get real panel size first from the parent, then reset the image size.- Overrides:
getPreferredSizein 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
Paints the component using the previous set image width and height.- Overrides:
paintComponentin classViewJComponentBase- Parameters:
g- Graphics to draw image in.
-
getImageA
Get source image- Returns:
- ModelImage
-
setImageA
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
-