Class DrawPseudoImage

java.lang.Object
  |
  +--DrawPseudoImage

class DrawPseudoImage
extends java.lang.Object

Class to draw microarray data (ratio, intensity, p-value, etc) as a pseudoarray image. The image is eventually displayed using ScrollableImageCanvas. Note the Pseudoarray image size is fixed and is mae.(pWidth,pHeight). The pseudoarray image is updated when mae.updatePseudoImgFlag is set by many different processes including the PopupRegistry when the normalization, Filter.workingCL, or other state values change.

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/04/03 21:01:38 $ / $Revision: 1.13 $
Author:
P. Lemkin (NCI), G.b Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home

Field Summary
private  java.awt.Font font
          regular font
private  java.awt.Font fontHdr
          Header font
private  int guardRegion
          # pixels in target image on each edge
(package private)  java.awt.Point[] hpXYpseudoImgList
          list of HP names [mae.hps.nHP+1]
private  int iFontHdrSize
          integer header font size is 2+ regular size unless the latter is 12pt in which case the header font size is also 12 pt.
private  int iFontSize
          integer regular font size
private  MAExplorer mae
          link to global MAExplorer instance
(package private) static int MAX_COLORS
          [Dark green:dark red] - MUST BE ODD #!!!
private  int maxLeftLabelPixelsWidth
          max # pixels in left labels
(package private)  float rangeInc
          PseudoArray image color range increment
(package private)  java.awt.Color[] ratioColor
          color table used for PseudoArray image color mapping
(package private)  float[] ratioRange
          ratio range for values used in PseudoArray image color mapping
(package private)  boolean setHPXflag
          set HP-X (HP-Y) if click on sample name
(package private)  java.awt.Color[] spectrumColor
          color table used for PseudoArray image color spectrum color mapping
(package private)  float[] spectrumRange
          range of values for values used in PseudoArray image color spectrum mapping
private  boolean useRYGcolorsFlag
          flag: color for ratio data.
private  int xSpotOffset
          add to orig data coords x_textQ[]
private  int ySpotOffset
          add to orig data coords y_textQ[]
 
Constructor Summary
(package private) DrawPseudoImage(MAExplorer mae)
          DrawPseudoImage() - constructor
 
Method Summary
(package private)  java.lang.String clipStrToWidth(java.lang.String str, int maxPixelWidth, int maxSubStrLen, java.awt.Graphics g, java.awt.Font font)
          clipStrToWidth() - clip string to maxPixelWidth and font char width.
private  void drawFilledColoredCircle(java.awt.Graphics g, int x, int y, int radius, java.awt.Color color)
          drawFilledColoredCircle() - draw filled circle of specified color.
private  void drawFilledColoredCircle(java.awt.Graphics g, int x, int y, int radius, int red, int green, int blue)
          drawFilledColoredCircle() - draw filled circle of specified color Clip colors to [0:255].
private  void drawFilledGrayCircle(java.awt.Graphics g, int x, int y, int radius, int grayValue)
          drawFilledGrayCircle() - draw filled circle of specified grayvalue [0:255].
private  void drawGridLabelsInImage(MaHybridSample ms, java.awt.Graphics g, boolean isRatioPlot, boolean isDualPseudoImageFlag)
          drawGridLabelsInImage() - draw ms.textQ[] in the image at (x,y)[] locations.
private  void drawPlus(java.awt.Graphics g, int x, int y, java.awt.Color color)
          drawPlus() - draw plus sign using specified color.
(package private)  void drawPseudoImage(java.awt.Graphics gi, int piWidth, int piHeight, int plotMode, MaHybridSample ms)
          drawPseudoImage() - draw pseudoarray image of filled grayscale circles using the totC[] density values.
private  void drawScaleMap(java.awt.Graphics gi, boolean isRatioPlot, boolean useRYGcolorsFlag, float minI, float maxI)
          drawScaleMap() - draw color scale map on the left of the canvas
private  void setFontsFromState()
          setFontsFromState() - set the regular and header fonts from the state variables
private  void setPseudoColorRange()
          setPseudoColorRange() - set isZscoreLog flag and pseudocolor range.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mae

private MAExplorer mae
link to global MAExplorer instance

MAX_COLORS

static final int MAX_COLORS
[Dark green:dark red] - MUST BE ODD #!!!

useRYGcolorsFlag

private boolean useRYGcolorsFlag
flag: color for ratio data. use continuous Red-Yellow-Green color range from [min:max] else use discrete Red-Black-Green.

ratioColor

java.awt.Color[] ratioColor
color table used for PseudoArray image color mapping

rangeInc

float rangeInc
PseudoArray image color range increment

ratioRange

float[] ratioRange
ratio range for values used in PseudoArray image color mapping

spectrumColor

java.awt.Color[] spectrumColor
color table used for PseudoArray image color spectrum color mapping

spectrumRange

float[] spectrumRange
range of values for values used in PseudoArray image color spectrum mapping

maxLeftLabelPixelsWidth

private int maxLeftLabelPixelsWidth
max # pixels in left labels

xSpotOffset

private int xSpotOffset
add to orig data coords x_textQ[]

ySpotOffset

private int ySpotOffset
add to orig data coords y_textQ[]

guardRegion

private int guardRegion
# pixels in target image on each edge

iFontSize

private int iFontSize
integer regular font size

iFontHdrSize

private int iFontHdrSize
integer header font size is 2+ regular size unless the latter is 12pt in which case the header font size is also 12 pt.

font

private java.awt.Font font
regular font

fontHdr

private java.awt.Font fontHdr
Header font

setHPXflag

boolean setHPXflag
set HP-X (HP-Y) if click on sample name

hpXYpseudoImgList

java.awt.Point[] hpXYpseudoImgList
list of HP names [mae.hps.nHP+1]
Constructor Detail

DrawPseudoImage

DrawPseudoImage(MAExplorer mae)
DrawPseudoImage() - constructor
Parameters:
mae - is the MAExplorer instance
See Also:
setPseudoColorRange()
Method Detail

setPseudoColorRange

private void setPseudoColorRange()
setPseudoColorRange() - set isZscoreLog flag and pseudocolor range.
See Also:
Util.setupColorRatioRange(float, java.awt.Color[], float[], int, boolean), Util.setupColorSpectrumRange(java.awt.Color[], float[], int, boolean)

drawPlus

private void drawPlus(java.awt.Graphics g,
                      int x,
                      int y,
                      java.awt.Color color)
drawPlus() - draw plus sign using specified color.
Parameters:
g - is graphics context
x - is center of object
y - is center of object
color - is color to draw

drawFilledGrayCircle

private void drawFilledGrayCircle(java.awt.Graphics g,
                                  int x,
                                  int y,
                                  int radius,
                                  int grayValue)
drawFilledGrayCircle() - draw filled circle of specified grayvalue [0:255].
Parameters:
g - is graphics context
x - is center of object
y - is center of object
radius - of object
grayValue - is the gray value color to draw

drawFilledColoredCircle

private void drawFilledColoredCircle(java.awt.Graphics g,
                                     int x,
                                     int y,
                                     int radius,
                                     int red,
                                     int green,
                                     int blue)
drawFilledColoredCircle() - draw filled circle of specified color Clip colors to [0:255].
Parameters:
g - is graphics context
x - is center of object
y - is center of object
radius - of object
red - is the red color component
green - is the green color component
blue - is the blue color component

drawFilledColoredCircle

private void drawFilledColoredCircle(java.awt.Graphics g,
                                     int x,
                                     int y,
                                     int radius,
                                     java.awt.Color color)
drawFilledColoredCircle() - draw filled circle of specified color.
Parameters:
g - is graphics context
x - is center of object
y - is center of object
radius - of object
color - is the color to draw

clipStrToWidth

java.lang.String clipStrToWidth(java.lang.String str,
                                int maxPixelWidth,
                                int maxSubStrLen,
                                java.awt.Graphics g,
                                java.awt.Font font)
clipStrToWidth() - clip string to maxPixelWidth and font char width. If the string will not fit in the maxPixelWidth, then remove characters that exceed that length.
Parameters:
str - is the string to possibly clip
maxPixelWidth - is the maximum pixel width
maxSubStrLen - is the max substring length
g - is graphics context
font - is the current font being used
Returns:
possibly clipped string

setFontsFromState

private void setFontsFromState()
setFontsFromState() - set the regular and header fonts from the state variables

drawScaleMap

private void drawScaleMap(java.awt.Graphics gi,
                          boolean isRatioPlot,
                          boolean useRYGcolorsFlag,
                          float minI,
                          float maxI)
drawScaleMap() - draw color scale map on the left of the canvas
Parameters:
gi - is graphics context
isRatioPlot - indicates doing a ratio rather than intensity plot
useRYGcolorsFlag - using additive colors rather than lookup map
minI - minimum intensity
maxI - maximum intensity
See Also:
clipStrToWidth(java.lang.String, int, int, java.awt.Graphics, java.awt.Font)

drawGridLabelsInImage

private void drawGridLabelsInImage(MaHybridSample ms,
                                   java.awt.Graphics g,
                                   boolean isRatioPlot,
                                   boolean isDualPseudoImageFlag)
drawGridLabelsInImage() - draw ms.textQ[] in the image at (x,y)[] locations. NOTE: the data is setup in the Sample object ms.
Parameters:
ms - is sample being used
g - is graphics context
isRatioPlot - is ratio plot rather than intensity plot
isDualPseudoImageFlag - shows two arrays side by side
See Also:
SampleSets.setHPxyModStrings()

drawPseudoImage

void drawPseudoImage(java.awt.Graphics gi,
                     int piWidth,
                     int piHeight,
                     int plotMode,
                     MaHybridSample ms)
drawPseudoImage() - draw pseudoarray image of filled grayscale circles using the totC[] density values. Depending on the value of plotModePseudImage, it implements:
   PLOT_PSEUDOIMG                  -  gray value white to black
   PLOT_PSEUDO_HP_XY_P_VALUE_IMG   -  pValue[0.0:1.0] spectrum value white to black
   PLOT_PSEUDO_HP_EP_CV_VALUE_IMG  -  pValue[0.0:1.0] spectrum value white to black
   PLOT_PSEUDOCOLOR_HP_XY_RYG_IMG  -  sum Red(X)+Green(Y) is Red,yellow,green
   PLOT_PSEUDO_F1F2_RYG_IMG        -  sum Red(F2)+Green(F1) is Red,yellow,green
   PLOT_PSEUDOCOLOR_HP_XY_IMG      -  ratio X/Y is Red,black,green
   PLOT_PSEUDOCOLOR_F1F2_IMG       -  ratio F1/F2 is Red,black,green
NOTE: currently it maps data to either RGB or 0:255 grayscale.
Parameters:
gi - is graphics context
piWidth - is width of image
piHeight - is height of image
plotMode - is type of image
ms - is sample being plotted
See Also:
HPxyData.updateDataAndStat(int), MaHybridSample.computeMinMaxF1F2Data(boolean, boolean), MaHybridSample.getDataByGID(int, boolean, int), MaHybridSample.getSpotDataStatic(int, boolean), MaHybridSample.getSpotData12Static(int, int, boolean), Statistics.calcTandPvalues(int, int, double, double, double, double), Util.setRatioColor(float, java.awt.Color[], float[], int), drawFilledColoredCircle(java.awt.Graphics, int, int, int, int, int, int), drawGridLabelsInImage(MaHybridSample, java.awt.Graphics, boolean, boolean), drawScaleMap(java.awt.Graphics, boolean, boolean, float, float), setPseudoColorRange()