/** * */ package analyze; import java.awt.*; import java.awt.geom.*; /** * @author John H. Krantz, Ph.D. * */ public class PlotDOG { // empty constructor public PlotDOG(){} // the painting routine public void plotDOG(Graphics2D g2d, Rectangle2D [][] rfArray, double [][] cellResp){ // determine the maximum and minimum values double maxPos = 0; double maxNeg = 0; for (int y = 0; y < cellResp.length; y ++){ for (int x = 0; x < cellResp[0].length; x ++){ if (cellResp[y][x] > maxPos) maxPos = cellResp[y][x]; if (cellResp[y][x] < maxNeg) maxNeg = cellResp[y][x]; } } maxNeg = Math.abs(maxNeg);// convert to absolute value double max = maxPos; if (maxNeg > max) max = maxNeg; // make 15 the smallest range limit if (max < 5) max = 5; // find the largest range of responses // now fill the rectangles for (int y = 0; y < cellResp.length; y ++){ for (int x = 0; x < cellResp[0].length; x ++){ int lum = 0; // luminance step // determine luminance steps lum = (int)(255.0*(Math.abs(cellResp[y][x])) /max); if (cellResp[y][x] > 0){ g2d.setPaint(new Color(lum,lum,lum)); } else { g2d.setPaint(new Color(lum,0,lum/3)); } g2d.fill(rfArray[y][x]); }// end x axis } // end y axis } // end plotDOG }