Class JPanelSurfaceTexture
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- gov.nih.mipav.view.renderer.JPanelRendererBase
-
- gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
-
- gov.nih.mipav.view.renderer.J3D.surfaceview.JPanelSurfaceTexture
-
- All Implemented Interfaces:
ViewImageUpdateInterface,java.awt.event.ActionListener,java.awt.event.FocusListener,java.awt.event.ItemListener,java.awt.event.KeyListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible
public class JPanelSurfaceTexture extends JPanelRendererJ3D implements ViewImageUpdateInterface
JPanelSurfaceTexture. Enables texture-mapping of the ModelImage data onto a surface triangle mesh. The Texture coordinates of the mesh are calculated in the SurfaceMask class. This class creates the ImageComponent3D object that is passed to the Texture3D object when the surface display attributes (TextureUnitState) are created. The ImageComponent3D object contained within this class updates when the user changes the ModelLUT associated with the texture.The user can change the ModelLUT independently of the ModelLUT associated with the ModelImage, or if the user selects the option of using the ModelLUT associated with the ModelImage, then the texture updates as the user updates that LUT. This class implements the ViewImageUpdateInterface to capture LUT changes.
- See Also:
JPanelSurface.java,SurfaceMask.java,ModelImage.java, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private JFrameHistogrammHistogramDisplay the independent LUT for Black/White images.private ModelImagemImageAModelImage used to generate the 3D texture:.private ModelImagemImageALinkReference to ModelImage A for linking the texture to the imageA LUT.private javax.swing.JRadioButtonmImageAsTextureRadioButtonRadioButton for turing on the surface image texture:.private javax.swing.JRadioButtonmImageAsVertexColorRadioButtonRadioButton for turing on the surface image per-vertex color:.private java.lang.StringmImageDirNameStores the currently-loaded ModelImage directory name:.private java.lang.StringmImageFileNameStores the currently-loaded ModelImage file name:.private javax.swing.JLabelmImageFileNameLabelDisplay the currently-loaded ModelImage file name:.private javax.swing.JRadioButtonmImageNoneRadioButtonRadioButton for turing off the surface image:.private javax.swing.JButtonmLoadImageButtonLoad a new ModelImage:.private javax.swing.ButtonGroupmLUTButtonGroupGrouping the radio buttons:.private ModelImagemLUTImageAIndependent ModelImage for independent LUT.private ModelLUTmLUTModelThe LUT associated with the ModelImage imageA:.private ModelLUTmLUTSeparateThe LUT associated with the independent texture LUT:.private javax.swing.JRadioButtonmModelLUTRadioButtonUse the ModelImage LUT.private javax.swing.JRadioButtonmNewLUTRadioButtonUse a separate LUT.private PatientSlicemPatientSliceRenders the ModelImage data with LUT changes.private ModelRGBmRGBModelThe RGB LUT associated with the ModelImage imageA:.private ModelRGBmRGBSeparateThe RGB LUT associated with the independent texture LUT:.private javax.media.j3d.ImageComponent3DmSurfaceTextureImageThe ModelImage texture with LUT changes, used with the Texture3D.private javax.media.j3d.Texture3DmTexture3D Texture used to display the ModelImage data as a texture mapped onto the ModelTriangleMesh.private javax.swing.ButtonGroupmTextureButtonGroupGrouping the radio buttons:.private intmTextureStatusCurrently selected ModelImage display type:.private javax.media.j3d.TextureUnitState[]mTextureUnitStateTextureUnitState contains texture information for the rendered surfaces:.static intNONENo display:.private static longserialVersionUIDUse serialVersionUID for interoperability.static intTEXTUREDisplays the ModelImage with 3D Texture-mapping :.static intVERTEX_COLORDisplays the ModelImage with per-vertex colors:.-
Fields inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
rayBasedRender, renderBase
-
Fields inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
applyButton, cancelButton, cancelFlag, closeButton, helpButton, isActiveImage, mainPanel, NEW, OKButton, REPLACE, runInSeparateThread, serif12, serif12B
-
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 JPanelSurfaceTexture(SurfaceRender kView, ModelImage imageA)Constructor:
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent event)actionPerformed, listens for interface events.private voidcreateVolumeTexture()Creates a 3D Texture object for the ModelImage displayed in the SurfaceRender object.voiddispose()Removes this object from the ModelImage imageDisplayListener list.private javax.media.j3d.ImageComponent3DgenerateVolumeTexture()generates an ImageComponent3D containing the ModelImage data.booleangetEnabled()Returns whether the ModelTriangleMesh is to be displayed with the ModelImage data as a texture or not.ModelImagegetImageLink()Returns The SurfaceRender ModelImage imageA for linking to the LUT.ModelImagegetImageSeparate()Returns the ModelImage associated with the independent LUT.ModelLUTgetLUT()Return the current ModelLUT:.javax.swing.JPanelgetMainPanel()Returns the mainPanel.ModelRGBgetRGBT()Return the current ModelRGBT:.ModelImagegetTextureImage()Returns The ModelImage that is the data source for the Texture3D.intgetTextureStatus()Returns the texture status, either TEXTURE, VERTEX_COLOR, or NONE.javax.media.j3d.TextureUnitState[]getTextureUnitState()Returns the volume texture TextureUnitState.private voidinit()Initializes the interface, and generates the first default texture.private voidinitLUT()Initializes or re-initializes the Histogram LUT interface based on the currently-loaded ModelImage.private voidloadingImage()Load a new ModelImage to use for the 3D Texture display:voidsetEnabled(boolean flag)Enables or disables the interface.voidsetRGBTA(ModelRGB RGBTa)Update the ModelRGB associated with the separate texture, and regenerate the ImageComponente3D volume texture.voidsetRGBTB(ModelRGB RGBTb)Update the ModelRGB associated with the ModelImage texture, and regenerate the ImageComponente3D volume texture.voidsetSlice(int slice)ViewImageUpdateInterface, unused here.voidsetTimeSlice(int tSlice)ViewImageUpdateInterface, unused here.booleanupdateImageExtents()ViewImageUpdateInterface, unused here.booleanupdateImages()ViewImageUpdateInterface, unused here.booleanupdateImages(boolean flag)ViewImageUpdateInterface, unused here.booleanupdateImages(ModelLUT LUTa, ModelLUT LUTb, boolean flag, int interpMode)updateImages, called when the ModelLUT changes.voidupdateSurfaceTextureImage(java.util.BitSet paintMask, javax.vecmath.Color4f kColor)updateSurfaceTextureImage.private voidupdateTexture()Updaes the ImageComponent3D data if the texture display is turned on.-
Methods inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
disposeLocal, getSurfaceRender, setRayBasedRender, setSurfaceRender
-
Methods inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
buildApplyButton, buildCancelButton, buildCloseButton, buildHelpButton, buildOKButton, buildTitledBorder, finalize, focusGained, focusLost, isCancelled, itemStateChanged, keyPressed, keyReleased, keyTyped, makeString, resizePanel, setLeftHandSystem, setVisible, setVisibleStandard, setWCSystem, testParameter
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
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, 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
-
NONE
public static final int NONE
No display:.- See Also:
- Constant Field Values
-
TEXTURE
public static final int TEXTURE
Displays the ModelImage with 3D Texture-mapping :.- See Also:
- Constant Field Values
-
VERTEX_COLOR
public static final int VERTEX_COLOR
Displays the ModelImage with per-vertex colors:.- See Also:
- Constant Field Values
-
mHistogram
private JFrameHistogram mHistogram
Display the independent LUT for Black/White images.
-
mImageA
private ModelImage mImageA
ModelImage used to generate the 3D texture:.
-
mImageALink
private ModelImage mImageALink
Reference to ModelImage A for linking the texture to the imageA LUT.
-
mImageAsTextureRadioButton
private javax.swing.JRadioButton mImageAsTextureRadioButton
RadioButton for turing on the surface image texture:.
-
mImageAsVertexColorRadioButton
private javax.swing.JRadioButton mImageAsVertexColorRadioButton
RadioButton for turing on the surface image per-vertex color:.
-
mImageDirName
private java.lang.String mImageDirName
Stores the currently-loaded ModelImage directory name:.
-
mImageFileName
private java.lang.String mImageFileName
Stores the currently-loaded ModelImage file name:.
-
mImageFileNameLabel
private javax.swing.JLabel mImageFileNameLabel
Display the currently-loaded ModelImage file name:.
-
mImageNoneRadioButton
private javax.swing.JRadioButton mImageNoneRadioButton
RadioButton for turing off the surface image:.
-
mLoadImageButton
private javax.swing.JButton mLoadImageButton
Load a new ModelImage:.
-
mLUTButtonGroup
private javax.swing.ButtonGroup mLUTButtonGroup
Grouping the radio buttons:.
-
mLUTImageA
private ModelImage mLUTImageA
Independent ModelImage for independent LUT.
-
mLUTModel
private ModelLUT mLUTModel
The LUT associated with the ModelImage imageA:.
-
mLUTSeparate
private ModelLUT mLUTSeparate
The LUT associated with the independent texture LUT:.
-
mModelLUTRadioButton
private javax.swing.JRadioButton mModelLUTRadioButton
Use the ModelImage LUT.
-
mNewLUTRadioButton
private javax.swing.JRadioButton mNewLUTRadioButton
Use a separate LUT.
-
mPatientSlice
private PatientSlice mPatientSlice
Renders the ModelImage data with LUT changes.
-
mRGBModel
private ModelRGB mRGBModel
The RGB LUT associated with the ModelImage imageA:.
-
mRGBSeparate
private ModelRGB mRGBSeparate
The RGB LUT associated with the independent texture LUT:.
-
mSurfaceTextureImage
private javax.media.j3d.ImageComponent3D mSurfaceTextureImage
The ModelImage texture with LUT changes, used with the Texture3D.
-
mTexture
private javax.media.j3d.Texture3D mTexture
3D Texture used to display the ModelImage data as a texture mapped onto the ModelTriangleMesh.
-
mTextureButtonGroup
private javax.swing.ButtonGroup mTextureButtonGroup
Grouping the radio buttons:.
-
mTextureStatus
private int mTextureStatus
Currently selected ModelImage display type:.
-
mTextureUnitState
private javax.media.j3d.TextureUnitState[] mTextureUnitState
TextureUnitState contains texture information for the rendered surfaces:.
-
-
Constructor Detail
-
JPanelSurfaceTexture
public JPanelSurfaceTexture(SurfaceRender kView, ModelImage imageA)
Constructor:- Parameters:
kView- the SurfaceRender this panel is displayed withimageA- the ModelImage used to generate the volume texture.
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed, listens for interface events.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Specified by:
actionPerformedin classJPanelRendererBase- Parameters:
event- ActionEvent generated by the interface.
-
dispose
public void dispose()
Removes this object from the ModelImage imageDisplayListener list.
-
getEnabled
public boolean getEnabled()
Returns whether the ModelTriangleMesh is to be displayed with the ModelImage data as a texture or not.- Returns:
- true when the ModelImageMesh is texture-mapped, false otherwise.
-
getImageLink
public ModelImage getImageLink()
Returns The SurfaceRender ModelImage imageA for linking to the LUT.- Returns:
- mImageALink, for identifying the ModelLUT associated with mImageA.
-
getImageSeparate
public ModelImage getImageSeparate()
Returns the ModelImage associated with the independent LUT.- Returns:
- the ModelImage associated with the independent LUT
-
getLUT
public ModelLUT getLUT()
Return the current ModelLUT:.- Returns:
- the currently used ModelLUT
-
getMainPanel
public javax.swing.JPanel getMainPanel()
Returns the mainPanel.- Specified by:
getMainPanelin classJPanelRendererBase- Returns:
- mainPanel;
-
getRGBT
public ModelRGB getRGBT()
Return the current ModelRGBT:.- Returns:
- the currently used ModelRGBT
-
getTextureImage
public ModelImage getTextureImage()
Returns The ModelImage that is the data source for the Texture3D.- Returns:
- mImageA, the ModelImage used to generate the Texture3D
-
getTextureStatus
public int getTextureStatus()
Returns the texture status, either TEXTURE, VERTEX_COLOR, or NONE.- Returns:
- TEXTURE, VERTEX_COLOR, or NONE
-
getTextureUnitState
public javax.media.j3d.TextureUnitState[] getTextureUnitState()
Returns the volume texture TextureUnitState.- Returns:
- mTextureUnitState, the volume texture data.
-
setEnabled
public void setEnabled(boolean flag)
Enables or disables the interface. Called when a surface is added/removed from the JPanelSurface class.- Overrides:
setEnabledin classjavax.swing.JComponent- Parameters:
flag- when true enable the interface, when false disable the interface.
-
setRGBTA
public void setRGBTA(ModelRGB RGBTa)
Update the ModelRGB associated with the separate texture, and regenerate the ImageComponente3D volume texture.- Parameters:
RGBTa- the new ModelRGB for the separate texture.
-
setRGBTB
public void setRGBTB(ModelRGB RGBTb)
Update the ModelRGB associated with the ModelImage texture, and regenerate the ImageComponente3D volume texture.- Parameters:
RGBTb- the new ModelRGB for the ModelImage texture.
-
setSlice
public void setSlice(int slice)
ViewImageUpdateInterface, unused here.- Specified by:
setSlicein interfaceViewImageUpdateInterface- Parameters:
slice- DOCUMENT ME!
-
setTimeSlice
public void setTimeSlice(int tSlice)
ViewImageUpdateInterface, unused here.- Specified by:
setTimeSlicein interfaceViewImageUpdateInterface- Parameters:
tSlice- DOCUMENT ME!
-
updateImageExtents
public boolean updateImageExtents()
ViewImageUpdateInterface, unused here.- Specified by:
updateImageExtentsin interfaceViewImageUpdateInterface- Returns:
- DOCUMENT ME!
-
updateImages
public boolean updateImages()
ViewImageUpdateInterface, unused here.- Specified by:
updateImagesin interfaceViewImageUpdateInterface- Returns:
- DOCUMENT ME!
-
updateImages
public boolean updateImages(boolean flag)
ViewImageUpdateInterface, unused here.- Specified by:
updateImagesin interfaceViewImageUpdateInterface- Parameters:
flag- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
updateImages
public boolean updateImages(ModelLUT LUTa, ModelLUT LUTb, boolean flag, int interpMode)
updateImages, called when the ModelLUT changes. Updates the ImageComponent3D object for Texture3D updates. The ImageComponent3D object is only updated if it is currently displayed.- Specified by:
updateImagesin interfaceViewImageUpdateInterface- Parameters:
LUTa- the LUT associated with the independent textureLUTb- the LUT associated with the ModelImageflag- forces update (ignored here)interpMode- (ignored here)- Returns:
- DOCUMENT ME!
-
updateSurfaceTextureImage
public void updateSurfaceTextureImage(java.util.BitSet paintMask, javax.vecmath.Color4f kColor)updateSurfaceTextureImage. Paints the ImageComponent3D object with the paint mask.- Parameters:
paintMask- paint bit map to add to the texture.kColor- DOCUMENT ME!
-
createVolumeTexture
private void createVolumeTexture()
Creates a 3D Texture object for the ModelImage displayed in the SurfaceRender object. The Texture3D object is used for texture-mapping on any or all ModelTriangleMesh objects displayed in the SurfaceRender.
-
generateVolumeTexture
private javax.media.j3d.ImageComponent3D generateVolumeTexture()
generates an ImageComponent3D containing the ModelImage data. Uses the PatientSlice object to output the data into the ImageComponent3D, so lut changes can be applied. The ImageComponent3D is used to create a Texture3D object for texture-mapping the ModelImage data onto ModelTriangleMesh objects.- Returns:
- DOCUMENT ME!
-
init
private void init()
Initializes the interface, and generates the first default texture.
-
initLUT
private void initLUT()
Initializes or re-initializes the Histogram LUT interface based on the currently-loaded ModelImage.
-
loadingImage
private void loadingImage()
Load a new ModelImage to use for the 3D Texture display:
-
updateTexture
private void updateTexture()
Updaes the ImageComponent3D data if the texture display is turned on. Notifies the JPanelSurface object of the update.
-
-