Class Volume3DRenderer

java.lang.Object
mgui.interfaces.shapes.volume.Volume3DRenderer
All Implemented Interfaces:
InterfaceGraphicListener, Camera3DListener
Direct Known Subclasses:
Volume4DRenderer

public class Volume3DRenderer
extends java.lang.Object
implements Camera3DListener, InterfaceGraphicListener
Class providing functions for rendering a Volume3DInt object. Based on the rendering code provided in the VolRend package: org.jscience.medicine.volumetric
Author:
Andrew Reid
  • Field Details

  • Constructor Details

    • Volume3DRenderer

      public Volume3DRenderer​(Volume3DInt volume)
  • Method Details

    • getRenderModes

      public static java.util.ArrayList<java.lang.String> getRenderModes()
    • setReferenceCamera

      public void setReferenceCamera​(Camera3D camera)
      Sets the reference camera for this renderer. This is used to determine the correct axis for 3D volume rendering.
      Parameters:
      camera -
    • setRenderMode

      public void setRenderMode​(java.lang.String mode)
    • setRenderMode

      public void setRenderMode​(Volume3DRenderer.Mode mode)
    • getRenderModeStr

      public java.lang.String getRenderModeStr()
    • setTexture

      public void setTexture()
      Sets the current texture for this volume's renderer.
    • setTexture

      public void setTexture​(ColourMap cmap)
      Sets a Volume3DTexture object from the current grid and data size
    • getTexture

      public Volume3DTexture getTexture()
    • getImageComponent

      public org.jogamp.java3d.ImageComponent3D getImageComponent()
    • setVolume

      public void setVolume​(Volume3DInt volume)
    • setTransparency

      public boolean setTransparency​(float alpha)
    • getNode

      public org.jogamp.java3d.BranchGroup getNode()
      Sets and returns a Java3D node from the given Grid3D and Texture3D
      Returns:
      Shape3D node
    • getNodeAsVolume

      public org.jogamp.java3d.BranchGroup getNodeAsVolume()
      Sets and returns a Java3D node from the given Grid3D and Texture3D; node will be a 3D volume texture
      Returns:
      Shape3D node
    • getNodeAsSections

      public org.jogamp.java3d.BranchGroup getNodeAsSections()
      Sets and returns a Java3D node from the given Grid3D and Texture3D; node will be a set of 2D planes corresponding the the section sets in the volume's parent set
      Returns:
      Shape3D node
    • updateSection

      protected void updateSection​(InterfaceGraphic2D window)
    • getTexCoordsForPoly

      protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsForPoly​(java.util.ArrayList<org.jogamp.vecmath.Point3f> nodes)
    • graphicUpdated

      public void graphicUpdated​(GraphicEvent e)
      Respond to a window event; this is relevant for section nodes
      Specified by:
      graphicUpdated in interface InterfaceGraphicListener
      Parameters:
      g -
    • destroySectionNode

      public void destroySectionNode​(InterfaceGraphic2D window)
    • removeSectionNode

      public void removeSectionNode​(InterfaceGraphic2D window)
    • getTexCoord

      protected org.jogamp.vecmath.TexCoord3f getTexCoord​(org.jogamp.vecmath.Point3f p)
    • flipCoords

      protected org.jogamp.vecmath.Point3f[] flipCoords​(org.jogamp.vecmath.Point3f[] coords)
    • flipCoords

      protected void flipCoords​(org.jogamp.vecmath.TexCoord3f[] coords)
    • getOrderedGroup

      protected org.jogamp.java3d.OrderedGroup getOrderedGroup()
    • getTexCoords

      protected org.jogamp.vecmath.TexCoord3f[] getTexCoords​(java.lang.String coords, int i, float scale)
    • getTexCoordsX

      protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsX​(int i, float scale)
    • getTexCoordsY

      protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsY​(int i, float scale)
    • getTexCoordsZ

      protected org.jogamp.vecmath.TexCoord3f[] getTexCoordsZ​(int i, float scale)
    • cameraChanged

      public void cameraChanged​(CameraEvent e)
      Specified by:
      cameraChanged in interface Camera3DListener
    • cameraAngleChanged

      public void cameraAngleChanged​(CameraEvent e)
      Specified by:
      cameraAngleChanged in interface Camera3DListener
    • updateAxis

      public void updateAxis()
      Update the rendering planes of this renderer, based on the reference camera angle, if one is set.
    • updateAxis

      public void updateAxis​(Camera3D camera)
      Update the rendering planes of this renderer, based on the current camera angle
    • getAxisVector

      protected org.jogamp.vecmath.Vector3d getAxisVector​(int axis)
    • getNearestAxis

      protected int getNearestAxis​(org.jogamp.vecmath.Vector3d v)
    • getNearestAxis

      protected int getNearestAxis​(org.jogamp.vecmath.Vector3d v, boolean buffer)
    • setAxis

      protected void setAxis()
    • powerOfTwo

      protected int powerOfTwo​(int value)
    • updateData

      public void updateData​(Grid3D grid, int index, int x, int y, int width, int height)
    • graphicSourceChanged

      public void graphicSourceChanged​(GraphicEvent e)
      Specified by:
      graphicSourceChanged in interface InterfaceGraphicListener