(ImageProcessor ip, int x, int y)
| 314 | } |
| 315 | |
| 316 | void drawText(ImageProcessor ip, int x, int y) { |
| 317 | ip.setFont(font); |
| 318 | ip.setAntialiasedText(true); |
| 319 | double hmin = cal.getCValue(stats.histMin); |
| 320 | double hmax = cal.getCValue(stats.histMax); |
| 321 | ip.drawString(d2s(hmin), x - 4, y); |
| 322 | ip.drawString(d2s(hmax), x + HIST_WIDTH - getWidth(hmax, ip) + 10, y); |
| 323 | if (rgbMode>=INTENSITY1) { |
| 324 | x += HIST_WIDTH/2; |
| 325 | y += 1; |
| 326 | ip.setJustification(ImageProcessor.CENTER_JUSTIFY); |
| 327 | boolean weighted = ((ColorProcessor)ip).weightedHistogram(); |
| 328 | switch (rgbMode) { |
| 329 | case INTENSITY1: ip.drawString((weighted?"Intensity (weighted)":"Intensity (unweighted)"), x, y); break; |
| 330 | case INTENSITY2: ip.drawString((weighted?"Intensity (unweighted)":"Intensity (weighted)"), x, y); break; |
| 331 | case RGB: ip.drawString("R+G+B", x, y); break; |
| 332 | case RED: ip.drawString("Red", x, y); break; |
| 333 | case GREEN: ip.drawString("Green", x, y); break; |
| 334 | case BLUE: ip.drawString("Blue", x, y); break; |
| 335 | } |
| 336 | ip.setJustification(ImageProcessor.LEFT_JUSTIFY); |
| 337 | } |
| 338 | //double range = hmax-hmin; |
| 339 | //if (fixedRange&&!cal.calibrated()&&hmin==0&&hmax==255) |
| 340 | // range = 256; |
| 341 | double binWidth = stats.binSize; |
| 342 | binWidth = Math.abs(binWidth); |
| 343 | showBins = binWidth!=1.0; |
| 344 | col1 = XMARGIN + 5; |
| 345 | col2 = XMARGIN + HIST_WIDTH/2; |
| 346 | row1 = y+(int)(25*SCALE); |
| 347 | if (showBins) row1 -= (int)(8*SCALE); |
| 348 | row2 = row1 + (int)(15*SCALE); |
| 349 | row3 = row2 + (int)(15*SCALE); |
| 350 | row4 = row3 + (int)(15*SCALE); |
| 351 | row5 = row4 + (int)(15*SCALE); |
| 352 | long count = stats.longPixelCount>0?stats.longPixelCount:stats.pixelCount; |
| 353 | String modeCount = " (" + stats.maxCount + ")"; |
| 354 | if (histogram!=null) {// Add '*' if multi-modal histogram |
| 355 | int mcount = 0;; |
| 356 | for (int i=0; i<histogram.length; i++) { |
| 357 | if (histogram[i]==stats.maxCount) mcount++; |
| 358 | if (mcount>1) break; |
| 359 | } |
| 360 | if (mcount>1) modeCount=modeCount+"*"; |
| 361 | } |
| 362 | if (modeCount.length()>12) modeCount = ""; |
| 363 | ip.drawString("N: " + count, col1, row1); |
| 364 | ip.drawString("Min: " + d2s(stats.min), col2, row1); |
| 365 | ip.drawString("Mean: " + d2s(stats.mean), col1, row2); |
| 366 | ip.drawString("Max: " + d2s(stats.max), col2, row2); |
| 367 | ip.drawString("StdDev: " + d2s(stats.stdDev), col1, row3); |
| 368 | ip.drawString("Mode: " + d2s(stats.dmode) + modeCount, col2, row3); |
| 369 | if (showBins) { |
| 370 | ip.drawString("Bins: " + d2s(stats.nBins), col1, row4); |
| 371 | ip.drawString("Bin Width: " + d2s(binWidth), col2, row4); |
| 372 | } |
| 373 | } |
no test coverage detected