void selectImage(String title) { if (Interpreter.isBatchMode()) { if (Interpreter.imageTable!=null) { for (Enumeration en=Interpreter.imageTable.elements(); en.hasMoreElements();) { ImagePlus imp = (ImagePlus)en.nextElement(); if (imp!=null) { if (imp.getTitle().equals(title)) { ImagePlus imp2 = WindowManager.getCurrentImage(); if (imp2!=null && imp2!=imp) imp2.saveRoi(); WindowManager.setTempCurrentImage(imp); Interpreter.activateImage(imp); return; } } } } selectWindowManagerImage(title); } else selectWindowManagerImage(title); }
void selectImage(String title) { if (Interpreter.isBatchMode()) { if (Interpreter.imageTable!=null) { for (Enumeration en=Interpreter.imageTable.elements(); en.hasMoreElements();) { ImagePlus imp = (ImagePlus)en.nextElement(); if (imp!=null) { if (imp.getTitle().equals(title)) { ImagePlus imp2 = WindowManager.getCurrentImage(); if (imp2!=null && imp2!=imp) imp2.saveRoi(); WindowManager.setTempCurrentImage(imp); Interpreter.activateImage(imp); return; } } } } selectWindowManagerImage(title); } else selectWindowManagerImage(title); }
/** Makes the image contained in the specified window the active image. */ public static void setCurrentWindow(ImageWindow win) { if (win==null || win.isClosed() || win.getImagePlus()==null) // deadlock-"wait to lock" return; //IJ.log("setCurrentWindow: "+win.getImagePlus().getTitle()+" ("+(currentWindow!=null?currentWindow.getImagePlus().getTitle():"null") + ")"); setWindow(win); tempImageTable.remove(Thread.currentThread()); if (win==currentWindow || imageList.size()==0) return; if (currentWindow!=null) { // free up pixel buffers used by current window ImagePlus imp = currentWindow.getImagePlus(); if (imp!=null ) { if (!Prefs.keepUndoBuffers) imp.trimProcessor(); imp.saveRoi(); } } Undo.reset(); currentWindow = win; activations.remove(win); activations.add(win); Menus.updateMenus(); if (Recorder.record && !IJ.isMacro()) Recorder.record("selectWindow", win.getImagePlus().getTitle()); }
/** Makes the image contained in the specified window the active image. */ public static void setCurrentWindow(ImageWindow win) { if (win==null || win.isClosed() || win.getImagePlus()==null) // deadlock-"wait to lock" return; //IJ.log("setCurrentWindow: "+win.getImagePlus().getTitle()+" ("+(currentWindow!=null?currentWindow.getImagePlus().getTitle():"null") + ")"); setWindow(win); tempImageTable.remove(Thread.currentThread()); if (win==currentWindow || imageList.size()==0) return; if (currentWindow!=null) { // free up pixel buffers used by current window ImagePlus imp = currentWindow.getImagePlus(); if (imp!=null ) { if (!Prefs.keepUndoBuffers) imp.trimProcessor(); imp.saveRoi(); } } Undo.reset(); currentWindow = win; activations.remove(win); activations.add(win); Menus.updateMenus(); if (Recorder.record && !IJ.isMacro()) Recorder.record("selectWindow", win.getImagePlus().getTitle()); }
private void makePolygon() { int max = 200; int[] x = new int[max]; int[] y = new int[max]; x[0] = (int)Math.round(getFirstArg()); y[0] = (int)Math.round(getNextArg()); interp.getToken(); int n = 1; while (interp.token==',' && n<max) { x[n] = (int)Math.round(interp.getExpression()); interp.getComma(); y[n] = (int)Math.round(interp.getExpression()); interp.getToken(); n++; } if (n<3) interp.error("Fewer than 3 points"); if (n==max && interp.token!=')') interp.error("More than "+max+" points"); ImagePlus imp = getImage(); Roi previousRoi = imp.getRoi(); if (shiftKeyDown||altKeyDown) imp.saveRoi(); imp.setRoi(new PolygonRoi(x, y, n, Roi.POLYGON)); Roi roi = imp.getRoi(); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; }
ImagePlus impC = WindowManager.getCurrentImage(); if (impC!=null && impC!=imp && impT!=null) impC.saveRoi(); WindowManager.setTempCurrentImage(imp); Interpreter.activateImage(imp);
private void makePolygon() { int max = 200; int[] x = new int[max]; int[] y = new int[max]; x[0] = (int)Math.round(getFirstArg()); y[0] = (int)Math.round(getNextArg()); interp.getToken(); int n = 1; while (interp.token==',' && n<max) { x[n] = (int)Math.round(interp.getExpression()); interp.getComma(); y[n] = (int)Math.round(interp.getExpression()); interp.getToken(); n++; } if (n<3) interp.error("Fewer than 3 points"); if (n==max && interp.token!=')') interp.error("More than "+max+" points"); ImagePlus imp = getImage(); Roi previousRoi = imp.getRoi(); if (shiftKeyDown||altKeyDown) imp.saveRoi(); imp.setRoi(new PolygonRoi(x, y, n, Roi.POLYGON)); Roi roi = imp.getRoi(); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; }
ImagePlus impC = WindowManager.getCurrentImage(); if (impC!=null && impC!=imp && impT!=null) impC.saveRoi(); WindowManager.setTempCurrentImage(imp); Interpreter.activateImage(imp);
/** Deletes the current region of interest. Makes a copy of the ROI so it can be recovered by Edit/Selection/Restore Selection. */ public void deleteRoi() { if (roi!=null) { saveRoi(); if (!(IJ.altKeyDown()||IJ.shiftKeyDown())) { RoiManager rm = RoiManager.getRawInstance(); if (rm!=null) rm.deselect(roi); } if (roi!=null) { roi.notifyListeners(RoiListener.DELETED); if (roi instanceof PointRoi) ((PointRoi)roi).resetCounters(); } roi = null; if (ip!=null) ip.resetRoi(); draw(); } }
/** Deletes the current region of interest. Makes a copy of the ROI so it can be recovered by Edit/Selection/Restore Selection. */ public void deleteRoi() { if (roi!=null) { saveRoi(); if (!(IJ.altKeyDown()||IJ.shiftKeyDown())) { RoiManager rm = RoiManager.getRawInstance(); if (rm!=null) rm.deselect(roi); } if (roi!=null) { roi.notifyListeners(RoiListener.DELETED); if (roi instanceof PointRoi) ((PointRoi)roi).resetCounters(); } roi = null; if (ip!=null) ip.resetRoi(); draw(); } }
void makeEllipse() { ImagePlus imp = getImage(); Roi previousRoi = imp.getRoi(); if (shiftKeyDown||altKeyDown) imp.saveRoi(); double x1 = getFirstArg(); double y1 = getNextArg(); double x2 = getNextArg(); double y2 = getNextArg(); double aspectRatio = getLastArg(); Roi roi = new EllipseRoi(x1,y1,x2,y2,aspectRatio); imp.setRoi(roi); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; }
void makeOval() { Roi previousRoi = getImage().getRoi(); if (shiftKeyDown||altKeyDown) getImage().saveRoi(); IJ.makeOval(getFirstArg(), getNextArg(), getNextArg(), getLastArg()); Roi roi = getImage().getRoi(); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; IJ.setKeyUp(IJ.ALL_KEYS); }
void makeOval() { Roi previousRoi = getImage().getRoi(); if (shiftKeyDown||altKeyDown) getImage().saveRoi(); IJ.makeOval(getFirstArg(), getNextArg(), getNextArg(), getLastArg()); Roi roi = getImage().getRoi(); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; IJ.setKeyUp(IJ.ALL_KEYS); }
void makeEllipse() { ImagePlus imp = getImage(); Roi previousRoi = imp.getRoi(); if (shiftKeyDown||altKeyDown) imp.saveRoi(); double x1 = getFirstArg(); double y1 = getNextArg(); double x2 = getNextArg(); double y2 = getNextArg(); double aspectRatio = getLastArg(); Roi roi = new EllipseRoi(x1,y1,x2,y2,aspectRatio); imp.setRoi(roi); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; }
void makeRectangle() { Roi previousRoi = getImage().getRoi(); if (shiftKeyDown||altKeyDown) getImage().saveRoi(); double x = getFirstArg(); double y = getNextArg(); double w = getNextArg(); double h = getNextArg(); int arcSize = 0; if (interp.nextToken()==',') { interp.getComma(); arcSize = (int)interp.getExpression(); } interp.getRightParen(); if (arcSize<1) IJ.makeRectangle(x, y, w, h); else { ImagePlus imp = getImage(); imp.setRoi(new Roi(x,y,w,h,arcSize)); } Roi roi = getImage().getRoi(); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; IJ.setKeyUp(IJ.ALL_KEYS); }
void makeRectangle() { Roi previousRoi = getImage().getRoi(); if (shiftKeyDown||altKeyDown) getImage().saveRoi(); double x = getFirstArg(); double y = getNextArg(); double w = getNextArg(); double h = getNextArg(); int arcSize = 0; if (interp.nextToken()==',') { interp.getComma(); arcSize = (int)interp.getExpression(); } interp.getRightParen(); if (arcSize<1) IJ.makeRectangle(x, y, w, h); else { ImagePlus imp = getImage(); imp.setRoi(new Roi(x,y,w,h,arcSize)); } Roi roi = getImage().getRoi(); if (previousRoi!=null && roi!=null) updateRoi(roi); resetImage(); shiftKeyDown = altKeyDown = false; IJ.setKeyUp(IJ.ALL_KEYS); }
if (isComposite()) ((CompositeImage)this).reset(); ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) imp.saveRoi(); WindowManager.setTempCurrentImage(this); Interpreter.addBatchModeImage(this);
Roi roi = imp.getRoi(); if (outputType == POINT_SELECTION && !roiSaved) { imp.saveRoi(); // save previous selection so user can restore it roiSaved = true;
Roi roi = imp.getRoi(); if (outputType == POINT_SELECTION && !roiSaved) { imp.saveRoi(); // save previous selection so user can restore it roiSaved = true;
Roi roi = imp.getRoi(); if (outputType == POINT_SELECTION && !roiSaved) { imp.saveRoi(); // save previous selection so user can restore it roiSaved = true;