/** Set display range for each channel to min-max. */ private static void displayMinToMax(ImagePlus imp) { if (imp.isComposite()) { for (int c = 1; c <= imp.getNChannels(); c++) { double min = I1l.getStatsForChannel(imp, c).min; double max = I1l.getStatsForChannel(imp, c).max; imp.setC(c); IJ.setMinAndMax(imp, min, max); } imp.setC(1); } else { double min = imp.getStatistics().min; double max = imp.getStatistics().max; IJ.setMinAndMax(imp, min, max); } }
/** Mask central offset / low freq spike to better use display range. */ private void maskCentralRegion(ImagePlus imp) { int w = imp.getWidth(); double d = this.maskDiameter * w; if (w % 2 == 0) { d += 1; // tweak to centre the mask about zero freq stripes } // N.B. we assume the image is square! (FFT result) OvalRoi mask = new OvalRoi(w / 2 - d / 2 + 1, w / 2 - d / 2 + 1, d, d); imp.setRoi(mask); for (int c = 1; c <= imp.getNChannels(); c++) { imp.setC(c); double min = I1l.getStatsForChannel(imp, c).min; IJ.run(imp, "Set...", "value=" + min + " slice"); } imp.setC(1); imp.deleteRoi(); }