public void threshold(int level) { for (int i=0; i<width*height; i++) { if ((pixels[i]&0xffff)<=level) pixels[i] = 0; else pixels[i] = (short)255; } findMinAndMax(); }
/** Returns the smallest displayed pixel value. */ public double getMin() { if (!minMaxSet) findMinAndMax(); return min; }
/** Returns the smallest displayed pixel value. */ public double getMin() { if (!minMaxSet) findMinAndMax(); return min; }
public void threshold(int level) { for (int i=0; i<width*height; i++) { if ((pixels[i]&0xffff)<=level) pixels[i] = 0; else pixels[i] = (short)255; } findMinAndMax(); }
/** Returns the largest displayed pixel value. */ public double getMax() { if (!minMaxSet) findMinAndMax(); return max; }
/** Returns the largest displayed pixel value. */ public double getMax() { if (!minMaxSet) findMinAndMax(); return max; }
/** Transforms the pixel data using a 65536 entry lookup table. */ public void applyTable(int[] lut) { if (lut.length!=65536) throw new IllegalArgumentException("lut.length!=65536"); int lineStart, lineEnd, v; for (int y=roiY; y<(roiY+roiHeight); y++) { lineStart = y * width + roiX; lineEnd = lineStart + roiWidth; for (int i=lineEnd; --i>=lineStart;) { v = lut[pixels[i]&0xffff]; pixels[i] = (short)v; } } findMinAndMax(); }
/** Transforms the pixel data using a 65536 entry lookup table. */ public void applyTable(int[] lut) { if (lut.length!=65536) throw new IllegalArgumentException("lut.length!=65536"); int lineStart, lineEnd, v; for (int y=roiY; y<(roiY+roiHeight); y++) { lineStart = y * width + roiX; lineEnd = lineStart + roiWidth; for (int i=lineEnd; --i>=lineStart;) { v = lut[pixels[i]&0xffff]; pixels[i] = (short)v; } } findMinAndMax(); }
/** Recalculates the min and max values used to scale pixel values to 0-255 for display. This ensures that this ShortProcessor is set up to correctly display the image. */ public void resetMinAndMax() { fixedScale = false; findMinAndMax(); resetThreshold(); }
/** Recalculates the min and max values used to scale pixel values to 0-255 for display. This ensures that this ShortProcessor is set up to correctly display the image. */ public void resetMinAndMax() { fixedScale = false; findMinAndMax(); resetThreshold(); }
((ij.process.ShortProcessor)ip).findMinAndMax(); patch.setMinAndMax(ip.getMin(), ip.getMax()); break;