edu.washington.biostr.sig.brainj3d.viewvolume.colors
Class BlendFunction

java.lang.Object
  extended by edu.washington.biostr.sig.brainj3d.viewvolume.colors.BlendFunction
Direct Known Subclasses:
AlphaWeightedFunction, SmoothBlend, SpecifiedWeightFunction, StepFunction, VolumeOnlyFunction

public abstract class BlendFunction
extends Object

Base class for blend functions. Blend functions compute a new color based on a base color and the computed volume color. Because certian blend functions may require creating instances using special parameters, some Java reflection methods are included and should be overriden by subclasses that desire those abilities. The BlendFunctionFactory supports those operations. Even if default constructor instances should not be created, the BlendFunctionFactory still requires a default constructed instance to query the reflection commands upon.

Author:
Peter
See Also:
BlendFunctionFactory

Constructor Summary
protected BlendFunction()
           
 
Method Summary
 boolean allowDefaultConstructor()
          Returns true if instances of this blend function can be created using the default constructor.
 float[] calculateColor(float[] volumeColor, float[] baseColor)
          Computes a blended color using the the specified volume color and base color and returns the blended color as a new array.
abstract  void calculateColor(float[] volumeColor, float[] baseColor, float[] outColor)
          Computes a blended color using the volume color and base color and returns the blended color through the outColor parameter.
 BlendFunction createNew(Object[] parameters)
          Creates a new instance of this BlendFunction using the given parameters.
 boolean equals(Object obj)
          The default implementation of this equals comparitor returns true if the class of this BlendFunction equals the class of the other object.
 String[] getDesiredParameterNames()
          Gets an array of friendly names for each of the desired parameters for creating new instances of this BlendFunction.
 Class[] getDesiredParameters()
          Gets an array of types for the desired parameters for creating new instances of this BlendFunction.
 Object[] getDesiredParamterDefaultValues()
          Gets a new array of default values for each of the required parameters.
abstract  String getName()
          Gets the name of this blend function.
 String getParametersTitle()
          Gets a string representing the title to use when displaying an input box for entering the desired parameters for creating a new instance of this BlendFunction.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlendFunction

protected BlendFunction()
Method Detail

getName

public abstract String getName()
Gets the name of this blend function.

Returns:
the name of this blend function

calculateColor

public abstract void calculateColor(float[] volumeColor,
                                    float[] baseColor,
                                    float[] outColor)
Computes a blended color using the volume color and base color and returns the blended color through the outColor parameter.

Parameters:
volumeColor - a color in the form [r, g, b, a] representing the computed volume data color
baseColor - a color in the form [r, g, b, a] representing the base color of the surface
outColor - a preallocated color to hold the resulting blended color; output is of the form [r, g, b, a]; this array need not be zero-initialized

calculateColor

public final float[] calculateColor(float[] volumeColor,
                                    float[] baseColor)
Computes a blended color using the the specified volume color and base color and returns the blended color as a new array.

Parameters:
volumeColor - a color in the form [r, g, b, a] representing the computed volume data color
baseColor - a color in the form [r, g, b, a] representing the base color of the surface
Returns:
a color to holding the resulting blended color; output is of the form [r, g, b, a]

allowDefaultConstructor

public boolean allowDefaultConstructor()
Returns true if instances of this blend function can be created using the default constructor.

Returns:

createNew

public BlendFunction createNew(Object[] parameters)
Creates a new instance of this BlendFunction using the given parameters. The default implementation returns this BlendFunction if it allows the default constructor or null if it does not. Subclasses should override this method if they wish to support specification of initialization parameters.

Parameters:
parameters -
Returns:

getDesiredParameters

public Class[] getDesiredParameters()
Gets an array of types for the desired parameters for creating new instances of this BlendFunction. Subclasses should override this method if they wish to support specification of initialization parameters.

Returns:

toString

public String toString()
Overrides:
toString in class Object

getDesiredParameterNames

public String[] getDesiredParameterNames()
Gets an array of friendly names for each of the desired parameters for creating new instances of this BlendFunction. Subclasses should override this method if they wish to support specification of initialization parameters.

Returns:

getDesiredParamterDefaultValues

public Object[] getDesiredParamterDefaultValues()
Gets a new array of default values for each of the required parameters. Subclasses should override this method if they wish to support specification of initialization parameters.

Returns:

getParametersTitle

public String getParametersTitle()
Gets a string representing the title to use when displaying an input box for entering the desired parameters for creating a new instance of this BlendFunction. Subclasses should override this method if they wish to support specification of initialization parameters.

Returns:

equals

public boolean equals(Object obj)
The default implementation of this equals comparitor returns true if the class of this BlendFunction equals the class of the other object.

Overrides:
equals in class Object
Parameters:
obj - the object to compare this BlendFunction with
Returns:
true if the classes of this and the other object are the same, false otherwise


Copyright © 2006 University of Washington. All Rights Reserved.