core.postprocessing
Class Colorizer

java.lang.Object
  extended bycore.field.Vec3Field
      extended bycore.postprocessing.Colorizer

public class Colorizer
extends Vec3Field

Colorizer adds color to a given LIC image after it has been computed (post processing). It can simply add a color, or add a color and color code according to the magnituge of the field which is used to generate the LIC, in a variety of ways, or add a color which is determined by the region of the image. Colorizer does the colorization in HSV color space and then converts to RGB color space. Uses JAVA's Color class for the HSV -> RGB conversion method.

Version:
1.0
Author:
Andreas Sundquist

Field Summary
 boolean bBrighten
          Flag for doing more brightening of the image above the break point (brightening flushes out the streaks in the LIC at high field stregth to pure white).
 BaseObject emsource
          This is our emsource which we use to get the field if we color by field magnitude.
 BaseExperiment experiment
          This is the experiment which determines the colors by region via experiment.getHue() if we color by region.
 double fallOff
          Rate at which color fades to black below the break point.
 boolean flatColor
          If this flag is true we only color, if it is false we also color code the LIC to indicate the field strength of the vector field used to generate the LIC.
 Vec RegionColor
          These are the values of the colors if we color by region.
 double saturationPoint
          Break point level of the strength of the LIC field for deciding where to start color fade to black.
 double scale
          This is the scale factor.
 Vec3 symVec3
          This is the center of the image, used in reconstructing the vector position in space r if we color by region.
 double TargetHue
          Hue for the colorization of the field.
 double TargetSaturation
          Saturation for the colorization of the field.
 double TargetValue
          Value for the colorization of the field.
 Vec3 Xdir
          This is the X direction in plotting the image, used in reconstructing the vecor position in space r if we color by region.
 Vec3 Ydir
          This is the Y direction in plotting the image, used in reconstructing the vecor position in space r if we color by region.
 
Constructor Summary
Colorizer(double MyTargetHue, double MyTargetSaturation, double MyTargetValue, double MysaturationPoint, double MyfallOff, boolean MyBrighten, boolean MyflatColor)
          This constructor is used when we are not coloring by region.
Colorizer(double MyTargetHue, double MyTargetSaturation, double MyTargetValue, double MysaturationPoint, double MyfallOff, boolean MyBrighten, boolean MyflatColor, Vec RegionColor, BaseExperiment experiment, BaseObject emsource, Vec3 symVec3, Vec3 Xdir, Vec3 Ydir, double scale)
          This constructor is used when we are coloring by region.
 
Method Summary
private  double Brighten(double fieldMag, Vec3 p)
          Brightens the image if we are well above the break point.
private  Vec3 ConvertToRGB(float Hue, float Saturation, float Value)
          Converts our HSV values to RGB values.
private  double DecreaseVal(double fieldMag)
          Defines the value of V in HSV if we are below the break point in field strength.
 Vec3 get(Vec3 p, Vec2 xpos, Vec3 f)
          Takes the input p which codes the x and y field components at this point in the array and the image value, and returns an RGB color f for the pixel at this point in the array.
private  double IncreaseSat(double fieldMag)
          Defines the value of S in HSV if we are above the break point in field strength.
private static void println(java.lang.String s)
          A local way to print a string
 
Methods inherited from class core.field.Vec3Field
get
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

saturationPoint

public double saturationPoint
Break point level of the strength of the LIC field for deciding where to start color fade to black.


TargetHue

public double TargetHue
Hue for the colorization of the field.


TargetSaturation

public double TargetSaturation
Saturation for the colorization of the field.


TargetValue

public double TargetValue
Value for the colorization of the field.


fallOff

public double fallOff
Rate at which color fades to black below the break point.


bBrighten

public boolean bBrighten
Flag for doing more brightening of the image above the break point (brightening flushes out the streaks in the LIC at high field stregth to pure white). We always do some brightening, if this flag is true we do even more.


flatColor

public boolean flatColor
If this flag is true we only color, if it is false we also color code the LIC to indicate the field strength of the vector field used to generate the LIC.


RegionColor

public Vec RegionColor
These are the values of the colors if we color by region.


experiment

public BaseExperiment experiment
This is the experiment which determines the colors by region via experiment.getHue() if we color by region.


emsource

public BaseObject emsource
This is our emsource which we use to get the field if we color by field magnitude.


symVec3

public Vec3 symVec3
This is the center of the image, used in reconstructing the vector position in space r if we color by region.


Xdir

public Vec3 Xdir
This is the X direction in plotting the image, used in reconstructing the vecor position in space r if we color by region.


Ydir

public Vec3 Ydir
This is the Y direction in plotting the image, used in reconstructing the vecor position in space r if we color by region.


scale

public double scale
This is the scale factor.

Constructor Detail

Colorizer

public Colorizer(double MyTargetHue,
                 double MyTargetSaturation,
                 double MyTargetValue,
                 double MysaturationPoint,
                 double MyfallOff,
                 boolean MyBrighten,
                 boolean MyflatColor)
This constructor is used when we are not coloring by region.

Parameters:
MyTargetHue - Color hue of field.
MyTargetSaturation - Color saturation of field, only used it flatcolor = true.
MyTargetValue - Color saturation of field, only used if flatcolr = true
MysaturationPoint - Break point on field strength magnitude below which we fade to black.
MyfallOff - Rate at which field color goes to black below break point.
MyBrighten - Determines brightening algorithm.
MyflatColor - If true colors according to HSV = (MyTargetHue,MyTargetSaturatioin,MyTargetValue)

Colorizer

public Colorizer(double MyTargetHue,
                 double MyTargetSaturation,
                 double MyTargetValue,
                 double MysaturationPoint,
                 double MyfallOff,
                 boolean MyBrighten,
                 boolean MyflatColor,
                 Vec RegionColor,
                 BaseExperiment experiment,
                 BaseObject emsource,
                 Vec3 symVec3,
                 Vec3 Xdir,
                 Vec3 Ydir,
                 double scale)
This constructor is used when we are coloring by region.

Parameters:
MyTargetHue - Color hue of field.
MyTargetSaturation - Color saturation of field, only used it flatcolor = true.
MyTargetValue - Color saturation of field, only used if flatcolr = true
MysaturationPoint - Break point on field strength magnitude below which we fade to black.
MyfallOff - Rate at which field color goes to black below break point.
MyBrighten - Determines brightening algorithm.
MyflatColor - If true colors according to HSV = (MyTargetHue,MyTargetSaturatioin,MyTargetValue)
RegionColor - The values of the colors if we color by region.
experiment - The experiment which determines the colors by region via experiment.getHue() if we color by region.
emsource - The emsource which we use to get the field if we color by field magnitude.
symVec3 - The center of the image, used in reconstructing the vector position in space r if we color by region.
Xdir - The X direction in plotting the image, used in reconstructing the vecor position in space r if we color by region.
Ydir - The Y direction in plotting the image, used in reconstructing the vecor position in space r if we color by region.
scale - The scale of the image.
Method Detail

get

public Vec3 get(Vec3 p,
                Vec2 xpos,
                Vec3 f)
Takes the input p which codes the x and y field components at this point in the array and the image value, and returns an RGB color f for the pixel at this point in the array.

Specified by:
get in class Vec3Field
Parameters:
p - The Vec3 p is input. The components p.x and p.y are the x and y values of the vector field used to generate the LIC at this point in the array, and p.z is the image value of the LIC image at this point in the array (0-255).
f - The RGB values of the color that we are returning for this image value at this point in the array, based on the field magnitude given by the sqrt of the sum of the squares of p.x and p.y (for flatColor not equal to true). This method is called from RGBImage.fromScalarImageMagnitude
Returns:
The RGB color stored as a Vec3.

IncreaseSat

private double IncreaseSat(double fieldMag)
Defines the value of S in HSV if we are above the break point in field strength.

Parameters:
fieldMag - The value of magnitude of the field used to generate the LIC at this point.
Returns:
S

DecreaseVal

private double DecreaseVal(double fieldMag)
Defines the value of V in HSV if we are below the break point in field strength.

Parameters:
fieldMag - The value of magnitude of the field used to generate the LIC at this point.
Returns:
V

ConvertToRGB

private Vec3 ConvertToRGB(float Hue,
                          float Saturation,
                          float Value)
Converts our HSV values to RGB values.

Parameters:
Hue - H of HSV, as specified.
Saturation - S of HSV, computed based on the break point and fieldMag if flatColor == false.
Value - V of HSV, computed based on the break point and fieldMag if flatColor == false.
Returns:
The RGB colors stored in a Vec3.

Brighten

private double Brighten(double fieldMag,
                        Vec3 p)
Brightens the image if we are well above the break point. This flushes out the grain in the LIC.

Parameters:
fieldMag - The magnitude of the field at this point in the array.
p - The quantity p.z is the only component of p used here, and it is the image value of the LIC image at this point in the array (0-255).
Returns:
The brightened value of the image pixel.

println

private static void println(java.lang.String s)
A local way to print a string