BIJ API

VolumeJ
Class VJClassifierLevoy

java.lang.Object
  |
  +--VolumeJ.VJClassifier
        |
        +--VolumeJ.VJClassifierLevoy
Direct Known Subclasses:
VJClassifierLevoyCueing, VJClassifierLinear, VJClassifierLNoIndex, VJClassifierLNotIndex0, VJClassifierRGB, VJClassifierValue

public class VJClassifierLevoy
extends VJClassifier

This class implements the Levoy tent classification function with indexing. It implements a table for the rgb and alpha lookup. It can be subclassed for variations on the indexing and lookup methods. A spectrum type color table is used for indexing color lookup.
Reference: Levoy, 1988, IEEE CGA, 5(3), 29-37
Copyright (c) 1999-2002, Michael Abramoff. All rights reserved.


Field Summary
protected  float fractionMagnitude
           
protected  byte[] lut
           
protected  int maskIndex
           
protected  int maskIntensity
           
protected  int maskMagnitude
           
protected  int maxIntensity
           
protected  int nrIndexBits
           
protected  int nrIntensityBits
           
protected  int nrMagnitudeBits
           
protected  float[] opacityTable
           
protected  float threshold
           
protected  float width
           
 
Fields inherited from class VolumeJ.VJClassifier
description, GRAYSCALE, RGB, secondaryClassifier
 
Constructor Summary
VJClassifierLevoy()
          Default instantiation.
VJClassifierLevoy(int nrIntensityBits, int nrMagnitudeBits, int nrIndexBits)
          Instantiation of new classifier.
 
Method Summary
 VJAlphaColor alphacolor(VJValue v)
          Slice view classification.
 VJAlphaColor alphacolor(VJValue v, VJGradient g)
          Classify the (interpolated) voxel value and gradient magnitude into a alpha and rgb-value.
protected  void defaultLUT()
          Make a LUT obtained from a spectrum.
 int does()
          Tell calling program that this classifier will return RGB values.
 boolean doesCutouts()
          Tells the calling program it can process cutouts (slice faces).
 boolean doesIndex()
          Tells renderer this classifier can process indices in the voxel values.
 float getThreshold()
          Get the classifier threshold.
 boolean hasLUT()
          Tell renderer that this classifier has user settable LUT.
protected  float opacityCompute(float dfxi, float intensity, float threshold, float width)
          Implements Levoy's gradient tent function for precomputation.
 boolean setLUT(byte[] reds, byte[] greens, byte[] blues)
          Set the LUT to a user-defined LUT.
 void setThreshold(float threshold)
          Set center of gradient tent function.
 void setupOpacities(float oversampling)
          Compute the opacities for a range of voxel values and gradient values.
 void setWidth(float width)
          Set width of gradient tent function.
 java.lang.String toLongString()
          This method can be overloaded as necessary
 java.lang.String toString()
          Tell calling program name of this classifier.
 boolean visible(VJValue v)
          Tells renderer that all voxels are potentially visible.
 
Methods inherited from class VolumeJ.VJClassifier
getSecondaryClassifier, setSecondaryClassifier, trace
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

opacityTable

protected float[] opacityTable

lut

protected byte[] lut

threshold

protected float threshold

width

protected float width

maxIntensity

protected int maxIntensity

maskMagnitude

protected int maskMagnitude

maskIndex

protected int maskIndex

fractionMagnitude

protected float fractionMagnitude

nrIndexBits

protected int nrIndexBits

nrMagnitudeBits

protected int nrMagnitudeBits

nrIntensityBits

protected int nrIntensityBits

maskIntensity

protected int maskIntensity
Constructor Detail

VJClassifierLevoy

public VJClassifierLevoy()
Default instantiation.

VJClassifierLevoy

public VJClassifierLevoy(int nrIntensityBits,
                         int nrMagnitudeBits,
                         int nrIndexBits)
Instantiation of new classifier.
Parameters:
nrIntensityBits: - the number of intensity bits available for the opacity table index.
nrMagnitudeBits - the number of gradient magnitude bits available for the opacity table index.
nrIndexBits - the number of bits available indexing for the opacity table index.
Method Detail

setWidth

public void setWidth(float width)
Set width of gradient tent function. Determines tolerance to voxel values != threshold.

getThreshold

public float getThreshold()
Description copied from class: VJClassifier
Get the classifier threshold.
Overrides:
getThreshold in class VJClassifier

setThreshold

public void setThreshold(float threshold)
Set center of gradient tent function. Determines voxel value that will always be rendered, no matter what the gradient value.
Parameters:
threshold - the center value.

visible

public boolean visible(VJValue v)
Tells renderer that all voxels are potentially visible. Overload as needed.
Overrides:
visible in class VJClassifier

does

public int does()
Tell calling program that this classifier will return RGB values.
Overrides:
does in class VJClassifier

hasLUT

public boolean hasLUT()
Tell renderer that this classifier has user settable LUT.
Overrides:
hasLUT in class VJClassifier

doesIndex

public boolean doesIndex()
Tells renderer this classifier can process indices in the voxel values.
Overrides:
doesIndex in class VJClassifier

doesCutouts

public boolean doesCutouts()
Tells the calling program it can process cutouts (slice faces).
Overrides:
doesCutouts in class VJClassifier

toString

public java.lang.String toString()
Tell calling program name of this classifier.
Overrides:
toString in class VJClassifier

toLongString

public java.lang.String toLongString()
Description copied from class: VJClassifier
This method can be overloaded as necessary
Overrides:
toLongString in class VJClassifier

alphacolor

public VJAlphaColor alphacolor(VJValue v,
                               VJGradient g)
Classify the (interpolated) voxel value and gradient magnitude into a alpha and rgb-value. If the voxel is RGB, use the hue and saturation of the voxel, and set the opacity from the opacity table.
Overrides:
alphacolor in class VJClassifier
Parameters:
v - the VJValue, the interpolated value at this location.
g - the gradient at this location

alphacolor

public VJAlphaColor alphacolor(VJValue v)
Slice view classification. Classify the (interpolated) voxel value for a slice view. If the index is 0, the value is rendered straight away with opacity 1. If the index > 0, the index is used to determine the color of the rendering, also with opacity 1.
Overrides:
alphacolor in class VJClassifier

setupOpacities

public void setupOpacities(float oversampling)
Compute the opacities for a range of voxel values and gradient values. nrMagnitudeBits defines the resolution for the gradientmagnitude, and maxIntensity defines the resolution for the voxel value. Correct for oversampling at oblique rays.
Parameters:
oversampling - the oversampling ratio.

defaultLUT

protected void defaultLUT()
Make a LUT obtained from a spectrum. First entry is white by default. Rest is filled with a spectrum.

setLUT

public boolean setLUT(byte[] reds,
                      byte[] greens,
                      byte[] blues)
Set the LUT to a user-defined LUT. Size of user-defined LUT must be same as classifier LUT.
Overrides:
setLUT in class VJClassifier
Parameters:
reds, - greens, blues byte[] containing the RGB values for the LUT.
Returns:
true if LUT was set, false if size of user-defined LUT did not correspond.

opacityCompute

protected float opacityCompute(float dfxi,
                               float intensity,
                               float threshold,
                               float width)
Implements Levoy's gradient tent function for precomputation.
Parameters:
dfxi[0-255] - the magnitude of the gradient.
intensity - of the voxel.
threshold - the center of the tent function.
width, - the width of the tent function.

BIJ API

Submit a bug or feature

Copyright (c) 1997-2003 Michael Abramoff
Licensing available. All Rights Reserved.