VolumeJ
Class VJRenderView

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--VolumeJ.VJRenderView
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
VJRenderViewCine, VJRenderViewInteractive, VJRenderViewSingle, VJRenderViewStereo

public class VJRenderView
extends java.lang.Thread

VJRenderView class implements a shell for rendering one or more views of a volume with a given renderer and volume. It keeps the state of the current rendering view. It also serves as an interface to VJUserInterface and ImageJ. It manages the transformation matrix and provides entrypoints for it. This class can be subclassed to generate single, stereo or cine rendering views. These subclasses of VJRenderView have to implement the method run(), which does nothin g in the base class. Copyright (c) 2001-2003, Michael Abramoff. All rights reserved.


Field Summary
protected  java.lang.String description
           
protected  VJMatrix m
          State variables.
protected  java.lang.String message
           
protected  VJMatrix mLight
          State variables.
protected  VJRenderer renderer
          The renderer
protected  float rotx
          State variables.
protected  float roty
          State variables.
protected  float rotz
          State variables.
protected  boolean running
           
protected  float scale
          State variables.
 
Fields inherited from class java.lang.Thread
inheritableThreadLocals, MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY, threadLocals
 
Constructor Summary
VJRenderView(VJRenderer renderer, double scale, double rotx, double roty, double rotz, java.lang.String message)
          Instantiates a new rendering shell.
VJRenderView(VJRenderer renderer, java.lang.String message)
          Instantiates a new rendering shell.
 
Method Summary
protected static void center(VJMatrix m, Volume v)
          Center m around 0,0,0 by translating to the center of the volume.
protected  void computeTransformationMatrix()
          Fully calculate the transformation matrix for a view.
 void kill()
          Stops the shell.
protected  long memoryInUse()
          Compute memory usage for rendering.
protected  ij.process.ImageProcessor renderToImageProcessor()
          Render in a separate thread and make an image processor out of the resulting image.
protected  java.lang.Object renderToPixelArray()
          Render in a separate thread and return the pixels with the rendering.
protected  void report(long elapsedTime)
           
 void run()
          Overload to make functional.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

renderer

protected VJRenderer renderer
The renderer

rotx

protected float rotx
State variables. Rotation around x-axis.

roty

protected float roty
State variables. Rotation around y-axis.

rotz

protected float rotz
State variables. Rotation around z-axis.

scale

protected float scale
State variables. Scaling factor.

m

protected VJMatrix m
State variables. The transformation matrix to be set in the renderer.

mLight

protected VJMatrix mLight
State variables. The transformation matrix for the light.

message

protected java.lang.String message

description

protected java.lang.String description

running

protected boolean running
Constructor Detail

VJRenderView

public VJRenderView(VJRenderer renderer,
                    java.lang.String message)
Instantiates a new rendering shell. The renderer is set. The volume is centered at the center of the viewport.
Parameters:
renderer - a VJRenderer
scale - the amount by which to scale the volume
message - a useful message to identify the characteristics of this rendering.

VJRenderView

public VJRenderView(VJRenderer renderer,
                    double scale,
                    double rotx,
                    double roty,
                    double rotz,
                    java.lang.String message)
Instantiates a new rendering shell. The renderer is set.
Parameters:
renderer - a VJRenderer
scale - the amount by which to scale the volume
rotx, - roty, rotz the amount by which to rotate the volume in that order.
message - a useful message to identify the characteristics of this rendering.
Method Detail

computeTransformationMatrix

protected void computeTransformationMatrix()
Fully calculate the transformation matrix for a view. At instantiation of a VJRenderView, the renderer may not fully initialized, so this method can only be called when actual rendering starts. Scales, centers and rotates the volume and corrects the position of the light. After calling this method, the transformation matrix has been scaled, corrected for aspect ratio, centered relative to the volume center and rotated. The light transformation matrix has been scaled, centered relative to the volume center and rotated.

run

public void run()
Overload to make functional.
Overrides:
run in class java.lang.Thread

renderToImageProcessor

protected ij.process.ImageProcessor renderToImageProcessor()
Render in a separate thread and make an image processor out of the resulting image.
Returns:
an ImageProcessor containing the view.

renderToPixelArray

protected java.lang.Object renderToPixelArray()
Render in a separate thread and return the pixels with the rendering.
Returns:
an Object with the pixels, null if problems.

kill

public void kill()
Stops the shell. Also tries to stop the renderer.

center

protected static void center(VJMatrix m,
                             Volume v)
Center m around 0,0,0 by translating to the center of the volume.
Parameters:
m - an transformation matrix converting object to viewspace coordinates.
v - the volume to be centered.

report

protected void report(long elapsedTime)

memoryInUse

protected long memoryInUse()
Compute memory usage for rendering.
Returns:
the number of bytes used.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Thread