org.cybertory.MSS
Class FeatureTextureDonut

java.lang.Object
  extended byorg.cybertory.MSS.FeatureTextureDonut
All Implemented Interfaces:
FeatureTexture

public class FeatureTextureDonut
extends java.lang.Object
implements FeatureTexture

This class paints a shape as an outer donut ring of one color and the inside of the ring as another color. But, we'd like the average intensities of the shape to be true to the specified color. Below is the derivation of how to calculate the modified intensities. For convenience of conputation, the portion of the formula that is comprised of values passed into the constructor is combined into constants. This allows a simple quick calculation as a function of the particular color for each instance of shape.


Ia
average intensity that would be used for a uniform fill
Id
intensity of the donut ring (outer) portion of the feature
Ih
intensity of the donut hole (inner) portion of the feature
Ad
approximate area of the donut ring (outer) portion of the feature
Ah
approximate area of the donut hole (inner) portion of the feature
R
ratio of the donut hole (inner) intensity / donut ring (outer) intensity, the intensityRatio parameter passed into the constructor
bx
the x dimension (width) of the shape's bounding rectangle
bx
the y dimension (height) of the shape's bounding rectangle
r
estimated radius of the feature, calculated from the shape's bounding rectangle
w
width of the donut ring as a fraction of estimated radius, passed into the constructor

r = (bx + by)/4         (radius estimated from shape's bounding rectangle)
R = Ih/Id         (by definition of ratio)
Ih = R * Id         (rearrange)
Ia = (Id*Ad + Ih*Ah) / (Ad + Ah)
Ia = (Id*Ad + R*Id*Ah) / (Ad + Ah)         (substitute Ih)
Id = Ia*(Ad + Ah) / (Ad + R*Ah)         (rearrange)
Ah = Π*(r-r*w)2
Ad = Π*r2 - Ah
Kd = (Ad + Ah) / (Ad + R*Ah)
        (define for convenience)
Kh = Kd * R         (define for convenience)
Id = Kd * Ia
Ih = Kh * Ia


Constructor Summary
FeatureTextureDonut(float widthFraction, float intensityRatio)
          Constructor
 
Method Summary
 java.awt.image.RenderedImage createTexture(java.awt.Shape featureShape, int numChannels)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureTextureDonut

public FeatureTextureDonut(float widthFraction,
                           float intensityRatio)
Constructor

Parameters:
widthFraction - Width of the donut ring as a fraction of the entire radius of the feature.
intensityRatio - ratio of inside intensity / donut ring intensity
Method Detail

createTexture

public java.awt.image.RenderedImage createTexture(java.awt.Shape featureShape,
                                                  int numChannels)
Specified by:
createTexture in interface FeatureTexture