Package gov.nih.mipav.view
Class ViewJComponentAnimate
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
gov.nih.mipav.view.ViewJComponentBase
gov.nih.mipav.view.ViewJComponentAnimate
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable
DOCUMENT ME!
- 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 floatalphaBlending values for compositing two images.private intBorder color, red, green, and blue components:private intoffset ranging from -255 to 255 add to each scaled red, green, and blueprivate floatscale factor ranging from 0.1 to 10.0 by which to multiply each red, green, and blueprivate booleanwhether or not to dispose of imageA and imageB true unless ViewJFrameAnimate was passed an unscaled 3D imageprotected ViewJFrameBaseframe - frame where the component image is displayed.private intBorder color, red, green, and blue components:private booleanwhether or not the brightness/contrast filter has been invokedprivate boolean[]set true if deleteSlice hit in ViewJFrameAnimateprotected ModelImageimageA - model for image A.private ModelImageWhich image is currently activeprotected ModelImageimageB - model for image B.protected Image[]the image rendered in 2D graphics:private PatientSlicePatientSlice contains all the Patient Coordinate system view-specific data for rendering this component:private MediaTrackerDOCUMENT ME!private intin 4D row and column numbers for z slicesprivate intin 4D row and column numbers for z slicesprivate intnumber of voisfloatOpacity value used by the paint brush. value = 1.0 - opaque value = 0.25 - default (mostly see through)private intthe number of z slices in a 4D image equal to zDim before the JDialogAnimate 4D to 3D conversionprivate BitSetBuffer used to indicate if the pixel location is painted (true) or unpainted (false).private int[]Buffer that displays the combined paintBitmap and pixBuffer buffers.private int[]private intBorder color, red, green, and blue components:private static final longUse serialVersionUID for interoperability.private booleanwhether to number each z slice for 4Dprotected intcurrent slice for 3D images:private ViewVOIVectorDOCUMENT ME!private intimage x, y, z dimensions in FileCoordinatesprivate int[]in 4D x location of slice numbering stringprivate intimage x, y, z dimensions in FileCoordinatesprivate int[]in 4D y location of slice numbering stringprivate intimage x, y, z dimensions in FileCoordinatesprivate String[]string for displaying slice numberFields 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, 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
ConstructorsConstructorDescriptionViewJComponentAnimate(ViewJFrameBase _frame, ModelImage _imageA, ModelLUT _LUTa, float[] imgBufferA, ModelImage _imageB, ModelLUT _LUTb, float[] imgBufferB, int[] pixelBuffer, float zoom, int[] extents, boolean logMagDisplay, float alphaBl, boolean disposeImage) Constructor: ImageA and ImageB are expected to be of the same dimensionality !! -
Method Summary
Modifier and TypeMethodDescriptionbooleanbuildImageObject(int tSlice, int zSlice, ModelLUT _LUTa, ModelLUT _LUTb, boolean forceShow) Shows the image.voiddisplayNumbers(boolean showNumbers) In 4D whether to show numbers for each z slice.voiddispose(boolean gcFlag) Sets all variables to null, disposes, and garbage collects.voidClean up some resources!Accessor that returns the active image.intgetblue()Accessor that returns int blue.intgetgreen()Accessor that returns int green.getImage()Gets Java image.Accessor that returns the imageA.Accessor that returns the imageB.floatAccessor that returns float OPACITY.Accessor that returns BitSet paintBitmap.Size set to object size.intgetred()Accessor that returns int red.Gets the size of the object taking into account the zoom.floatgetZoomX()Magnification in the x - dimension.floatgetZoomY()Magnification in the y - dimension.voidMethod to ensure img[slice] is not displayed.voidimportImage(int[] data) Creates a Image object form an array of ints that have been formatted (packed) properly (i.e. aRGB)voidPaints the image and border.voidset4DSpecs(int originalZDim, int nColumn, int nRow) Specifications that are only relevant to 4D images.voidsetAlphaBlend(int value) Sets the alpha blending of parameter for two image displaying.voidsetBorderCol(Color borderCol) Sets color of the border surrounding each z slice in 4D images.voidsetBrightness(int brightness, float contrast) Method to set the brightness and contrast of the animate images.voidsetBuffers(float[] imgBufferA, float[] imgBufferB, int[] pixBuff, int[] paintBuff) The frame in which the image(s) is displayed, allocates the memory and uses this method to pass the references to the buffers.voidFor 4D sets the numbering string of each z slice and its x and y positions.voidsetlabelZ - For 3D sets the numbering string of each frame.voidSets the paintBitmap to produce colored borders for 4D images.voidsetPaintMask(BitSet mask) Accessor that sets the paint mask.voidSets the RGB table for the ARGB image A.voidSets the RGB table for the ARGB image B.voidsetSlice(int _slice) Accessor that sets the slice of the image.voidsetSliceBrightness(int brightness, float contrast) Method to set the brightness and contrast of the animate slice.voidsetZoom(float zX, float zY) Sets the magnification in both x and y directions.voidupdate()Method to call paint without erasing background this reduces flicker!voidMethod to call paint without erasing background this reduces flicker!Methods inherited from class gov.nih.mipav.view.ViewJComponentBase
disposeLocal, finalize, getInterpMode, getLastMouseX, getLastMouseY, getResolutionX, getResolutionY, getScaledX, getScaledY, getSelectedPaintColor, getShowMagIntensityEnabled, importImageB, LocalToScreen, makePaintBitmapBorder, makePaintImage, paintCursorBoxComponent, paintWindowComponent, paintWindowComponent, ScreenToLocal, setInterpolationMode, setResolutions, setShowSliceNumber, setSliceString, setTextColor, setZoomExactMethods 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:
-
OPACITY
public float OPACITYOpacity value used by the paint brush. value = 1.0 - opaque value = 0.25 - default (mostly see through) -
alphaBlend
protected float alphaBlendalphaBlending values for compositing two images. -
frame
frame - frame where the component image is displayed. -
imageA
imageA - model for image A. -
imageB
imageB - model for image B. -
img
the image rendered in 2D graphics: -
paintImageBuffer
private int[] paintImageBuffer -
slice
protected int slicecurrent slice for 3D images: -
brightness
private int brightnessoffset ranging from -255 to 255 add to each scaled red, green, and blue -
contrast
private float contrastscale factor ranging from 0.1 to 10.0 by which to multiply each red, green, and blue -
disposeImage
private boolean disposeImagewhether or not to dispose of imageA and imageB true unless ViewJFrameAnimate was passed an unscaled 3D image -
haveFiltered
private boolean haveFilteredwhether or not the brightness/contrast filter has been invoked -
ignoreSlice
private boolean[] ignoreSliceset true if deleteSlice hit in ViewJFrameAnimate -
imageActive
Which image is currently active -
mt
DOCUMENT ME! -
nRow
private int nRowin 4D row and column numbers for z slices -
nColumn
private int nColumnin 4D row and column numbers for z slices -
nVOI
private int nVOInumber of vois -
originalZDim
private int originalZDimthe number of z slices in a 4D image equal to zDim before the JDialogAnimate 4D to 3D conversion -
paintBitmap
Buffer used to indicate if the pixel location is painted (true) or unpainted (false). -
paintBuffer
private int[] paintBufferBuffer that displays the combined paintBitmap and pixBuffer buffers. -
red
private int redBorder color, red, green, and blue components: -
green
private int greenBorder color, red, green, and blue components: -
blue
private int blueBorder color, red, green, and blue components: -
showNumbers
private boolean showNumberswhether to number each z slice for 4D -
VOIs
DOCUMENT ME! -
xDim
private int xDimimage x, y, z dimensions in FileCoordinates -
yDim
private int yDimimage x, y, z dimensions in FileCoordinates -
zDim
private int zDimimage x, y, z dimensions in FileCoordinates -
xLabel
private int[] xLabelin 4D x location of slice numbering string -
yLabel
private int[] yLabelin 4D y location of slice numbering string -
zString
string for displaying slice number -
m_kPatientSlice
PatientSlice contains all the Patient Coordinate system view-specific data for rendering this component:
-
-
Constructor Details
-
ViewJComponentAnimate
public ViewJComponentAnimate(ViewJFrameBase _frame, ModelImage _imageA, ModelLUT _LUTa, float[] imgBufferA, ModelImage _imageB, ModelLUT _LUTb, float[] imgBufferB, int[] pixelBuffer, float zoom, int[] extents, boolean logMagDisplay, float alphaBl, boolean disposeImage) Constructor: ImageA and ImageB are expected to be of the same dimensionality !!- Parameters:
_frame- frame where the controls are obtained_imageA- Model of the image that will be displayed_LUTa- LUT used to display imageAimgBufferA- storage buffer used to display image A_imageB- Model of the image that will be displayed_LUTb- LUT used to display imageBimgBufferB- storage buffer used to display image BpixelBuffer- storage buffer used to build a displayable imagezoom- initial magnification of imageextents- initial display dimensions of the imagelogMagDisplay- display log magnitude of imagealphaBl- alphaBlenddisposeImage- if true dispose of imageA and imageB
-
-
Method Details
-
buildImageObject
public boolean buildImageObject(int tSlice, int zSlice, ModelLUT _LUTa, ModelLUT _LUTb, boolean forceShow) Shows the image.- Parameters:
tSlice- t (time) slice to showzSlice- z slice to show_LUTa- LUTa - to change to new LUT for imageA else null_LUTb- LUTb - to change to new LUT for imageB else nullforceShow- forces this method to import image and recalculate java image- Returns:
- boolean to indicate if the show was successful
-
displayNumbers
public void displayNumbers(boolean showNumbers) In 4D whether to show numbers for each z slice.- Parameters:
showNumbers- if true display numbers for each z slice in 4D
-
dispose
public void dispose(boolean gcFlag) Sets all variables to null, disposes, and garbage collects.- Overrides:
disposein classViewJComponentBase- Parameters:
gcFlag- if true garbage collector should be called.
-
finalizeLocal
public void finalizeLocal()Clean up some resources! -
getActiveImage
Accessor that returns the active image.- Returns:
- active image
-
getblue
public int getblue()Accessor that returns int blue.- Returns:
- blue
-
getgreen
public int getgreen()Accessor that returns int green.- Returns:
- green
-
getImage
Gets Java image.- Overrides:
getImagein classViewJComponentBase- Returns:
- Java image
- See Also:
-
getImageA
Accessor that returns the imageA.- Returns:
- imageA
-
getImageB
Accessor that returns the imageB.- Returns:
- imageB
-
getOPACITY
public float getOPACITY()Accessor that returns float OPACITY.- Returns:
- OPACITY
-
getpaintBitmap
Accessor that returns BitSet paintBitmap.- Returns:
- paintBitmap
-
getPreferredSize
Size set to object size.- Overrides:
getPreferredSizein classViewJComponentBase- Returns:
- dimension with the size
-
getred
public int getred()Accessor that returns int red.- Returns:
- red
-
getSize
Gets the size of the object taking into account the zoom.- Overrides:
getSizein classViewJComponentBase- Parameters:
wh- dimension- Returns:
- dimension with the size
-
getZoomX
public float getZoomX()Magnification in the x - dimension.- Overrides:
getZoomXin classViewJComponentBase- Returns:
- magnificaiton in the x - dimension
-
getZoomY
public float getZoomY()Magnification in the y - dimension.- Overrides:
getZoomYin classViewJComponentBase- Returns:
- magnificaiton in the y - dimension
-
ignoreSlice
public void ignoreSlice()Method to ensure img[slice] is not displayed. -
importImage
public void importImage(int[] data) Creates a Image object form an array of ints that have been formatted (packed) properly (i.e. aRGB)- Overrides:
importImagein classViewJComponentBase- Parameters:
data- Data (image) to be displayed that has been formatted (packed) properly (i.e. aRGB)
-
paintComponent
Paints the image and border.- Overrides:
paintComponentin classViewJComponentBase- Parameters:
g- Graphics handle
-
set4DSpecs
public void set4DSpecs(int originalZDim, int nColumn, int nRow) Specifications that are only relevant to 4D images.- Parameters:
originalZDim- number of z slicesnColumn- the number of columns of z slicesnRow- the number of rows of z slices
-
setAlphaBlend
public void setAlphaBlend(int value) Sets the alpha blending of parameter for two image displaying.- Parameters:
value- amount [0,100] that is the percentage of Image A to be displayed
-
setBorderCol
Sets color of the border surrounding each z slice in 4D images.- Parameters:
borderCol- border color surounding each z slice
-
setBrightness
public void setBrightness(int brightness, float contrast) Method to set the brightness and contrast of the animate images.- Parameters:
brightness- int going from -255 to 255contrast- float scale factor
-
setBuffers
public void setBuffers(float[] imgBufferA, float[] imgBufferB, int[] pixBuff, int[] paintBuff) The frame in which the image(s) is displayed, allocates the memory and uses this method to pass the references to the buffers.- Parameters:
imgBufferA- storage buffer used to display image AimgBufferB- storage buffer used to display image BpixBuff- storage buffer used to build a displayable imagepaintBuff- storage buffer used to display the combined paintBitmap and pixBuffer buffers
-
setLabelXY
public void setLabelXY()For 4D sets the numbering string of each z slice and its x and y positions. -
setLabelZ
public void setLabelZ()setlabelZ - For 3D sets the numbering string of each frame. -
setPaintMask
public void setPaintMask()Sets the paintBitmap to produce colored borders for 4D images. -
setPaintMask
Accessor that sets the paint mask.- Parameters:
mask- DOCUMENT ME!
-
setRGBTA
Sets the RGB table for the ARGB image A.- Parameters:
RGBT- RGB table
-
setRGBTB
Sets the RGB table for the ARGB image B.- Parameters:
RGBT- RGB table
-
setSlice
public void setSlice(int _slice) Accessor that sets the slice of the image.- Parameters:
_slice- image slice to be displayed
-
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
-
setZoom
public void setZoom(float zX, float zY) Sets the magnification in both x and y directions.- Overrides:
setZoomin classViewJComponentBase- Parameters:
zX- zoom in the x directionzY- zoom in the y direction
-
update
public void update()Method to call paint without erasing background this reduces flicker! -
update
Method to call paint without erasing background this reduces flicker!- Overrides:
updatein classViewJComponentBase- Parameters:
g- Graphics handle
-