Class ViewJComponentSurface
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
gov.nih.mipav.view.ViewJComponentBase
gov.nih.mipav.view.renderer.J3D.surfaceview.plotterview.ViewJComponentSurface
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable
Component surface created from a 2D image. The intensity values are mapped like a relief map, with higher intensities
making peaks and lower intensities forming valleys. A quad mesh is used to create the three-dimensional map. The same
LUT from the image is used to colors the vertices of the quad mesh.
- Version:
- 0.1 Aug 1, 2001
- Author:
- Matthew J. McAuliffe, Ph.D., 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 int[]Vertex connection array.private javax.vecmath.Point3f[]Vertex array.private RenderViewBaseFrame where the plotted surface is displayed.private ModelImageStructure holding image.private float[]Buffer which holds the pixel data.private int[]Extents of the image.private booleanFlag indicating if the surface is currently in line mode (true) or fill mode (false).private ModelLUTLookup table for image.private int[]Used to remap the LUT appropriately.private floatMaxBox value from the parent frame.private int[]Buffer used to store ARGB images of the image presently being displayed.private javax.media.j3d.BranchGroupBranch group that is the parent of the plotted surface.private ModelQuadMeshQuad mesh.private intSample size.private static final longUse serialVersionUID for interoperability.private floatxBox, yBox and zBox values from the parent frame.private floatxBox, yBox and zBox values from the parent frame.private floatxBox, yBox and zBox values from the parent frame.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
ConstructorsConstructorDescriptionViewJComponentSurface(RenderViewBase _frame, ModelImage _imageA, ModelLUT _LUTa, int[] extents, int slice) Constructs a new component and sets up the variables. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidSets up the surface by setting the color of the material to black, setting the polygon to no cull-face and a fill mode, and allowing intersections in case we want picking ability.private voidcalcQuadSurface(boolean forceUpdate) Calculates quad surface.voiddispose(boolean gcFlag) Sets all variables to null, disposes, and garbage collects if parameter is set.protected voidfinalize()Calls dispose.getFrame()Accessor that returns the parent frame for the component.Accessor that returns the image A.getLUTa()Accessor that gets the model LUT for image A.getQMesh()Accessor that returns the quad mesh, which represents the plotted surface.intAccessor that returns the sample size that created the quad mesh.private voidInitialize the global vertext and connection arrays.voidresample(int sample) Resamples and creates a new quad mesh, detaching the parent branch group and readding the surface.voidsetImageA(ModelImage image) Sets component's image A.voidAccessor that sets the model LUT for the image A.voidsetPolygonMode(boolean line) Sets the polygon mode, if it has changed.voidsetQMesh(ModelQuadMesh quadMesh) Sets the quad mesh by detaching the parent branch group and readding the surface.voidsetSlice(int slice) sets the slice/frame # for display.private voidCreate and initialize the eight lights in the scene graph.booleanShows the surface, using the LUT to color the indices.Methods inherited from class gov.nih.mipav.view.ViewJComponentBase
disposeLocal, getImage, getInterpMode, getLastMouseX, getLastMouseY, getPreferredSize, getResolutionX, getResolutionY, getScaledX, getScaledY, getSelectedPaintColor, getShowMagIntensityEnabled, getSize, getZoomX, getZoomY, importImage, importImageB, LocalToScreen, makePaintBitmapBorder, makePaintImage, paintComponent, 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:
-
cConnect
private int[] cConnectVertex connection array. -
cVertex
private javax.vecmath.Point3f[] cVertexVertex array. -
frame
Frame where the plotted surface is displayed. -
imageA
Structure holding image. -
imageBufferA
private float[] imageBufferABuffer which holds the pixel data. -
imageExtents
private int[] imageExtentsExtents of the image. -
lineMode
private boolean lineModeFlag indicating if the surface is currently in line mode (true) or fill mode (false). -
LUTa
Lookup table for image. -
lutBufferRemapped
private int[] lutBufferRemappedUsed to remap the LUT appropriately. -
maxBox
private float maxBoxMaxBox value from the parent frame. -
pixBuffer
private int[] pixBufferBuffer used to store ARGB images of the image presently being displayed. -
plottedRoot
private javax.media.j3d.BranchGroup plottedRootBranch group that is the parent of the plotted surface. -
qMesh
Quad mesh. This is the core of the component. -
sampleSize
private int sampleSizeSample size. This determines how many triangles are used in the quad mesh. -
xBox
private float xBoxxBox, yBox and zBox values from the parent frame. -
yBox
private float yBoxxBox, yBox and zBox values from the parent frame. -
zBox
private float zBoxxBox, yBox and zBox values from the parent frame.
-
-
Constructor Details
-
ViewJComponentSurface
public ViewJComponentSurface(RenderViewBase _frame, ModelImage _imageA, ModelLUT _LUTa, int[] extents, int slice) Constructs a new component and sets up the variables.- Parameters:
_frame- Frame where image(s) will be displayed._imageA- Model of the image that will be displayed._LUTa- LUT used to display imageA.extents- Extents of image to be displayed.slice- Slice of 3D image to use, 0 if 2D image.
-
-
Method Details
-
dispose
public void dispose(boolean gcFlag) Sets all variables to null, disposes, and garbage collects if parameter is set.- Overrides:
disposein classViewJComponentBase- Parameters:
gcFlag- Iftruegarbage collector should be called.
-
getFrame
Accessor that returns the parent frame for the component.- Returns:
- The parent frame.
-
getImageA
Accessor that returns the image A.- Returns:
- imageA
-
getLUTa
Accessor that gets the model LUT for image A.- Returns:
- The model LUT.
-
getQMesh
Accessor that returns the quad mesh, which represents the plotted surface.- Returns:
- The quad mesh.
-
getSampleSize
public int getSampleSize()Accessor that returns the sample size that created the quad mesh.- Returns:
- The sample size.
-
resample
public void resample(int sample) Resamples and creates a new quad mesh, detaching the parent branch group and readding the surface.- Parameters:
sample- New sample size.
-
setImageA
Sets component's image A. Sets zoom to 1, 1.- Parameters:
image- Image to set to.
-
setLUTa
Accessor that sets the model LUT for the image A.- Parameters:
LUT- The model LUT to set to.
-
setPolygonMode
public void setPolygonMode(boolean line) Sets the polygon mode, if it has changed.- Parameters:
line-trueindicates set to line mode,falseindicates set to fill mode.
-
setQMesh
Sets the quad mesh by detaching the parent branch group and readding the surface.- Parameters:
quadMesh- Quad mesh to set to.
-
setSlice
public void setSlice(int slice) sets the slice/frame # for display.- Parameters:
slice- slice number
-
show
Shows the surface, using the LUT to color the indices.- Parameters:
_LUTa- to change to new LUT for imageA else null.forceShow- Forces this method to import image and recalculate java image._interpMode- Image interpolation method (Nearest or Smooth).- Returns:
trueindicates the show was successful.
-
finalize
Calls dispose.- Overrides:
finalizein classViewJComponentBase- Throws:
Throwable- DOCUMENT ME!
-
addSurface
private void addSurface()Sets up the surface by setting the color of the material to black, setting the polygon to no cull-face and a fill mode, and allowing intersections in case we want picking ability. -
calcQuadSurface
private void calcQuadSurface(boolean forceUpdate) Calculates quad surface. Sets up indices and connections between the indices, then sets the color of the indices based on the LUT.- Parameters:
forceUpdate-trueupdates Quad mesh,falsenot update Quad mesh.
-
initSurfaceBuffers
private void initSurfaceBuffers()Initialize the global vertext and connection arrays. -
setupLights
private void setupLights()Create and initialize the eight lights in the scene graph. The lights are positioned at the eight vertices of the cube [-maxBox,maxBox]^3. Light 0 is at (-maxBox,-maxBox,-maxBox) and light 7 is at (maxBox,maxBox,maxBox). All are enabled. The default color for all lights is white. The default intensity is 1.
-