/**The macro interpreter uses this method to call getImage().*/ public static ImagePlus getImage(Interpreter interpreter) { macroInterpreter = interpreter; ImagePlus imp = getImage(); macroInterpreter = null; return imp; }
/** Resets the minimum and maximum displayed pixel values of the current image to be the same as the min and max pixel values. */ public static void resetMinAndMax() { resetMinAndMax(getImage()); }
/** Returns the active image or stack slice as an ImageProcessor, or displays an error message and aborts the plugin or macro if no images are open. */ public static ImageProcessor getProcessor() { ImagePlus imp = IJ.getImage(); return imp.getProcessor(); }
/** Sets the minimum and maximum displayed pixel values on the specified RGB channels, where 4=red, 2=green and 1=blue. */ public static void setMinAndMax(double min, double max, int channels) { setMinAndMax(getImage(), min, max, channels); }
/** Sets the lower and upper threshold levels and displays the image using the specified <code>displayMode</code> ("Red", "Black & White", "Over/Under" or "No Update"). */ public static void setThreshold(double lowerThreshold, double upperThreshold, String displayMode) { setThreshold(getImage(), lowerThreshold, upperThreshold, displayMode); }
@Override public void run(String arg) { ImagePlus imp = IJ.getImage(); if(imp == null) { IJ.error("There's no image to annotate."); return; } new Points_Dialog(imp); }
/** * Returns rois if any from the overlay. * @return See above */ public static Roi[] readFromOverlays() { ImagePlus image = IJ.getImage(); Overlay overlay = image.getOverlay(); if (overlay == null) return null; return overlay.toArray(); }
/** Thread-safe method. */ public static String save(ImagePlus imp, String path, int quality) { if (imp==null) imp = IJ.getImage(); if (path==null || path.length()==0) path = SaveDialog.getPath(imp, ".jpg"); if (path==null) return null; String error = (new JpegWriter()).saveAsJpeg(imp, path, quality); return error; }
public void setFrame() { int index = preview.getCurrentSlice(); if(!IJ.getImage().getTitle().equals( stack.getPreview().getSliceLabel(index))) return; ImageProcessor ip = IJ.getImage().getProcessor(); stack.setSlice(index, ip); IJ.getImage().changes = false; IJ.getImage().close(); preview.setStack(null, stack.getPreview()); preview.setSlice(index); }
void list() { ImagePlus imp = IJ.getImage(); Overlay overlay = imp.getOverlay(); if (overlay!=null) listRois(overlay.toArray()); }
void hide() { ImagePlus imp = IJ.getImage(); imp.setHideOverlay(true); RoiManager rm = RoiManager.getInstance(); if (rm!=null) rm.runCommand("show none"); }
/** Converts the current image from RGB to YUV and stores * the results in the same RGB image R=Y, G=U, B=V. * Author: Gabriel Landini, G.Landini@bham.ac.uk */ public static void RGBtoYUV() { ImagePlus imp = IJ.getImage(); if (imp.getBitDepth()==24) { RGBtoYUV(imp.getProcessor()); imp.updateAndDraw(); } }
public void run(String path) { ImagePlus imp = IJ.getImage(); if (path==null || path.equals("")) { SaveDialog sd = new SaveDialog("Save as Gif", imp.getTitle(), ".gif"); if (sd.getFileName()==null) return; path = sd.getDirectory()+sd.getFileName(); } run(imp, path); }
public void run(String arg) { imp = IJ.getImage(); Overlay overlay = imp.getOverlay(); int index = overlay!=null?overlay.getIndex(GRID):-1; if (index>=0) gridOnEntry = overlay.get(index); if (showDialog() && !isMacro) saveSettings(); }
public void run(ImageProcessor ip) { SegmentatorModel model = new SegmentatorModel(IJ.getImage()); int currentSlice = model.data.getCurrentSlice(); ImageProcessor labelData = model.getLabelImagePlus().getStack().getProcessor(currentSlice); if(model.getCurrentMaterial() == null){ IJ.showMessage("please select a label first"); return; } close(labelData, IJ.getImage().getRoi(), (byte)model.getCurrentMaterial().id); model.updateSlice(currentSlice); }
void show() { ImagePlus imp = IJ.getImage(); imp.setHideOverlay(false); if (imp.getOverlay()==null) { RoiManager rm = RoiManager.getInstance(); if (rm!=null && rm.getCount()>1) { if (!IJ.isMacro()) rm.toFront(); rm.runCommand("show all with labels"); } } }
private void unlock() { ImagePlus imp = IJ.getImage(); boolean wasUnlocked = imp.lockSilently(); if (wasUnlocked) IJ.showStatus("\""+imp.getTitle()+"\" is not locked"); else { IJ.showStatus("\""+imp.getTitle()+"\" is now unlocked"); IJ.beep(); } imp.unlock(); }
public void run(String arg) { ImagePlus imp = IJ.getImage(); if (imp.isComposite() && imp.getNChannels()==imp.getStackSize()) { IJ.error("3D Gaussian Blur", "Composite color images not supported"); return; } if (!showDialog()) return; imp.startTiming(); blur(imp, xsigma, ysigma, zsigma); IJ.showTime(imp, imp.getStartTime(), "", imp.getStackSize()); }