public void stretchHistogram(ImageProcessor ip, double saturated) { useStackHistogram = false; stretchHistogram(new ImagePlus("", ip), saturated); }
ImagePlus im = new ImagePlus(imagePathHere); ContrastEnhancer enh = new ContrastEnhancer(); enh.stretchHistogram(plus, i);
public void stretchHistogram(ImageProcessor ip, double saturated) { useStackHistogram = false; stretchHistogram(new ImagePlus("", ip), saturated); }
@Override public ImageProcessor process(ImageProcessor ip) { // Will not alter ip, no need to duplicate new ContrastEnhancer().stretchHistogram(ip, s, ImageStatistics.getStatistics(ip, Measurements.MIN_MAX, null)); return ip; }
new ContrastEnhancer().stretchHistogram(imp.getProcessor(), 0.5); } else if (arg.equals("masks")) { showMasks();
new ContrastEnhancer().stretchHistogram(imp.getProcessor(), 0.5); } else if (arg.equals("masks")) { showMasks();
ImageProcessor ip3 = new FloatProcessor(maxN, maxN, fht, null); ImagePlus imp2 = new ImagePlus("FHT of "+FFT.fileName, ip3.duplicate()); (new ContrastEnhancer()).stretchHistogram(imp2, 0.1); imp2.show(); ImageStack ct = getComplexTransform(); ImagePlus imp2 = new ImagePlus("Complex of "+FFT.fileName, ct); (new ContrastEnhancer()).stretchHistogram(imp2, 0.1); imp2.setProperty("FFT width", ""+originalWidth); imp2.setProperty("FFT height", ""+originalHeight);
ImageProcessor ip3 = new FloatProcessor(maxN, maxN, fht, null); ImagePlus imp2 = new ImagePlus("FHT of "+FFT.fileName, ip3.duplicate()); (new ContrastEnhancer()).stretchHistogram(imp2, 0.1); imp2.show(); ImageStack ct = getComplexTransform(); ImagePlus imp2 = new ImagePlus("Complex of "+FFT.fileName, ct); (new ContrastEnhancer()).stretchHistogram(imp2, 0.1); imp2.setProperty("FFT width", ""+originalWidth); imp2.setProperty("FFT height", ""+originalHeight);
public void stretchHistogram(ImagePlus imp, double saturated) { ImageStatistics stats = null; if (useStackHistogram) stats = new StackStatistics(imp); if (processStack) { ImageStack stack = imp.getStack(); for (int i=1; i<=stackSize; i++) { IJ.showProgress(i, stackSize); ImageProcessor ip = stack.getProcessor(i); ip.setRoi(imp.getRoi()); if (!useStackHistogram) stats = ImageStatistics.getStatistics(ip, MIN_MAX, null); stretchHistogram(ip, saturated, stats); } } else { ImageProcessor ip = imp.getProcessor(); ip.setRoi(imp.getRoi()); if (stats==null) stats = ImageStatistics.getStatistics(ip, MIN_MAX, null); if (imp.isComposite()) stretchCompositeImageHistogram((CompositeImage)imp, saturated, stats); else stretchHistogram(ip, saturated, stats); } }
public void stretchHistogram(ImagePlus imp, double saturated) { ImageStatistics stats = null; if (useStackHistogram) stats = new StackStatistics(imp); if (processStack) { ImageStack stack = imp.getStack(); for (int i=1; i<=stackSize; i++) { IJ.showProgress(i, stackSize); ImageProcessor ip = stack.getProcessor(i); ip.setRoi(imp.getRoi()); if (!useStackHistogram) stats = ImageStatistics.getStatistics(ip, MIN_MAX, null); stretchHistogram(ip, saturated, stats); } } else { ImageProcessor ip = imp.getProcessor(); ip.setRoi(imp.getRoi()); if (stats==null) stats = ImageStatistics.getStatistics(ip, MIN_MAX, null); if (imp.isComposite()) stretchCompositeImageHistogram((CompositeImage)imp, saturated, stats); else stretchHistogram(ip, saturated, stats); } }
public Object process(final Patch p) { if (Thread.currentThread().isInterrupted()) return null; p.getProject().getLoader().releaseToFit(p.getOWidth(), p.getOHeight(), p.getType(), 3); ImageProcessor ip = p.getImageProcessor().duplicate(); // a throw-away copy if (ContrastEnhancerWrapper.this.from_existing_min_and_max) { ip.setMinAndMax(p.getMin(), p.getMax()); } ImageStatistics st = stats; if (null == stats) { Utils.log2("Null stats, using image's self"); st = ImageStatistics.getStatistics(ip, Measurements.MIN_MAX, cal); } ce.stretchHistogram(ip, saturated, st); // This is all we care about from stretching the histogram: p.setMinAndMax(ip.getMin(), ip.getMax()); regenerateMipMaps(p); return null; } });
ContrastEnhancer ce = new ContrastEnhancer(); ce.setNormalize(true); // Needs to be true for correct normalization ce.stretchHistogram(Meanimp, 0.0); ImageConverter ic = new ImageConverter(Meanimp); ic.convertToGray32(); ce.stretchHistogram(Orimp, 0.0); ic = new ImageConverter(Orimp); ic.convertToGray32(); ce.stretchHistogram(Varimp, 0.0); ic = new ImageConverter(Varimp); ic.convertToGray32();
public void run(ImageProcessor ip) { slice++; if (done) return; FHT fht = newFHT(ip); if (slice==1) { filter = getFilter(fht.getWidth()); if (filter==null) { done = true; return; } } ((FHT)fht).transform(); customFilter(fht); doInverseTransform(fht, ip); if (slice==1) ip.resetMinAndMax(); if (slice==stackSize) { new ContrastEnhancer().stretchHistogram(imp, 0.0); imp.updateAndDraw(); } IJ.showProgress(1.0); if (Recorder.record && slice==1) Recorder.recordCall("FFT.filter(imp,filter); //see Help/Examples/JavaScript/FFT Filter"); }
public void run(ImageProcessor ip) { slice++; if (done) return; FHT fht = newFHT(ip); if (slice==1) { filter = getFilter(fht.getWidth()); if (filter==null) { done = true; return; } } ((FHT)fht).transform(); customFilter(fht); doInverseTransform(fht, ip); if (slice==1) ip.resetMinAndMax(); if (slice==stackSize) { new ContrastEnhancer().stretchHistogram(imp, 0.0); imp.updateAndDraw(); } IJ.showProgress(1.0); if (Recorder.record && slice==1) Recorder.recordCall("FFT.filter(imp,filter); //see Help/Examples/JavaScript/FFT Filter"); }
public void run(String arg) { ImagePlus imp = IJ.getImage(); stackSize = imp.getStackSize(); imp.trimProcessor(); if (!showDialog(imp)) return; Roi roi = imp.getRoi(); if (roi!=null) roi.endPaste(); if (stackSize==1) Undo.setup(Undo.TRANSFORM, imp); else Undo.reset(); if (equalize) equalize(imp); else stretchHistogram(imp, saturated); if (normalize) { ImageProcessor ip = imp.getProcessor(); ip.setMinAndMax(0,ip.getBitDepth()==32?1.0:ip.maxValue()); } imp.updateAndDraw(); }
public void run(String arg) { ImagePlus imp = IJ.getImage(); stackSize = imp.getStackSize(); imp.trimProcessor(); if (!showDialog(imp)) return; Roi roi = imp.getRoi(); if (roi!=null) roi.endPaste(); if (stackSize==1) Undo.setup(Undo.TRANSFORM, imp); else Undo.reset(); if (equalize) equalize(imp); else stretchHistogram(imp, saturated); if (normalize) { ImageProcessor ip = imp.getProcessor(); ip.setMinAndMax(0,ip.getBitDepth()==32?1.0:ip.maxValue()); } imp.updateAndDraw(); }
if (doScaling) { ImagePlus imp2 = new ImagePlus(imp.getTitle()+"-filtered", ip2); new ContrastEnhancer().stretchHistogram(imp2, saturate?1.0:0.0); ip2 = imp2.getProcessor();
if (doScaling) { ImagePlus imp2 = new ImagePlus(imp.getTitle()+"-filtered", ip2); new ContrastEnhancer().stretchHistogram(imp2, saturate?1.0:0.0); ip2 = imp2.getProcessor();
((StackWindow)win).updateSliceSelector(); if (Prefs.autoContrast && nChannels==1 && imageType!=COLOR_RGB) { (new ContrastEnhancer()).stretchHistogram(ip,0.35,ip.getStats()); ContrastAdjuster.update();
((StackWindow)win).updateSliceSelector(); if (Prefs.autoContrast && nChannels==1 && imageType!=COLOR_RGB) { (new ContrastEnhancer()).stretchHistogram(ip,0.35,ip.getStats()); ContrastAdjuster.update();