/** Returns the display's FakeImagePlus. */ public ImagePlus getImagePlus() { return super.getImagePlus(); }
static boolean isDuplicateName(String name) { int n = imageList.size(); for (int i=0; i<n; i++) { ImageWindow win = (ImageWindow)imageList.get(i); String name2 = win.getImagePlus().getTitle(); if (name.equals(name2)) return true; } return false; }
protected void checkWindow(Component window) { if (!(window instanceof ImageWindow)) return; check(((ImageWindow)window).getImagePlus()); }
/** Returns the active ImagePlus. */ private static ImagePlus getActiveImage() { if (currentWindow!=null) return currentWindow.getImagePlus(); else if (frontWindow!=null && (frontWindow instanceof ImageWindow)) return frontWindow!=null?((ImageWindow)frontWindow).getImagePlus():null; else if (imageList.size()>0) { ImagePlus imp = getFocusManagerActiveImage(); if (imp!=null) return imp; ImageWindow win = (ImageWindow)imageList.get(imageList.size()-1); return win.getImagePlus(); } else return Interpreter.getLastBatchModeImage(); }
/** Returns the active ImagePlus. */ private static ImagePlus getActiveImage() { if (currentWindow!=null) return currentWindow.getImagePlus(); else if (frontWindow!=null && (frontWindow instanceof ImageWindow)) return frontWindow!=null?((ImageWindow)frontWindow).getImagePlus():null; else if (imageList.size()>0) { ImagePlus imp = getFocusManagerActiveImage(); if (imp!=null) return imp; ImageWindow win = (ImageWindow)imageList.get(imageList.size()-1); return win.getImagePlus(); } else return Interpreter.getLastBatchModeImage(); }
static boolean isDuplicateName(String name) { int n = imageList.size(); for (int i=0; i<n; i++) { ImageWindow win = (ImageWindow)imageList.get(i); String name2 = win.getImagePlus().getTitle(); if (name.equals(name2)) return true; } return false; }
private boolean synced(ImageWindow source) { if (source==null || vwins==null) return false; ImagePlus imp = source.getImagePlus(); if (imp==null) return false; return vwins.contains(new Integer(imp.getID())); }
private boolean synced(ImageWindow source) { if (source==null || vwins==null) return false; ImagePlus imp = source.getImagePlus(); if (imp==null) return false; return vwins.contains(new Integer(imp.getID())); }
/** Returns a list of the IDs of open images. Returns null if no image windows are open. */ public synchronized static int[] getIDList() { int nWindows = imageList.size(); int[] batchModeImages = Interpreter.getBatchModeImageIDs(); int nBatchImages = batchModeImages.length; if ((nWindows+nBatchImages)==0) return null; int[] list = new int[nWindows+nBatchImages]; for (int i=0; i<nBatchImages; i++) list[i] = batchModeImages[i]; int index = 0; for (int i=nBatchImages; i<nBatchImages+nWindows; i++) { ImageWindow win = (ImageWindow)imageList.get(index++); list[i] = win.getImagePlus().getID(); } return list; }
/** Returns a list of the IDs of open images. Returns null if no image windows are open. */ public synchronized static int[] getIDList() { int nWindows = imageList.size(); int[] batchModeImages = Interpreter.getBatchModeImageIDs(); int nBatchImages = batchModeImages.length; if ((nWindows+nBatchImages)==0) return null; int[] list = new int[nWindows+nBatchImages]; for (int i=0; i<nBatchImages; i++) list[i] = batchModeImages[i]; int index = 0; for (int i=nBatchImages; i<nBatchImages+nWindows; i++) { ImageWindow win = (ImageWindow)imageList.get(index++); list[i] = win.getImagePlus().getID(); } return list; }
/** Activates the next image window on the window list. */ public static void putBehind() { if (IJ.debugMode) IJ.log("putBehind"); if (imageList.size()<1 || currentWindow==null) return; int index = imageList.indexOf(currentWindow); ImageWindow win = null; int count = 0; do { index--; if (index<0) index = imageList.size()-1; win = (ImageWindow)imageList.get(index); if (++count==imageList.size()) return; } while (win instanceof HistogramWindow || win instanceof PlotWindow); if (win==null) return; ImagePlus imp = win.getImagePlus(); if (imp!=null) IJ.selectWindow(imp.getID()); }
private static void addImageWindow(ImageWindow win) { ImagePlus imp = win.getImagePlus(); if (imp==null) return; checkForDuplicateName(imp); imageList.add(win); Menus.addWindowMenuItem(imp); setCurrentWindow(win); }
private static void addImageWindow(ImageWindow win) { ImagePlus imp = win.getImagePlus(); if (imp==null) return; checkForDuplicateName(imp); imageList.add(win); Menus.addWindowMenuItem(imp); setCurrentWindow(win); }
/** Returns the ID of the Nth open image. Returns zero if n<=0 or n greater than the number of open image windows. */ public synchronized static int getNthImageID(int n) { if (n<=0) return 0; if (Interpreter.isBatchMode()) { int[] list = getIDList(); if (n>list.length) return 0; else return list[n-1]; } else { if (n>imageList.size()) return 0; ImageWindow win = (ImageWindow)imageList.get(n-1); if (win!=null) return win.getImagePlus().getID(); else return 0; } }
public static void showList() { for (int i=0; i<imageList.size(); i++) { ImageWindow win = (ImageWindow)imageList.get(i); ImagePlus imp = win.getImagePlus(); IJ.log(i + " " + imp.getTitle() + (win==currentWindow?"*":"")+" "+imp.getID()); } for (int i=0; i<activations.size(); i++) { ImageWindow win = (ImageWindow)activations.get(i); ImagePlus imp = win.getImagePlus(); IJ.log(i + " " + imp.getTitle() + " " + imp.getID()); } if (imageList.size()==0) IJ.log("imageList is empty"); if (activations.size()==0) IJ.log("activations list is empty"); IJ.log(" "); }
/** Returns the ID of the Nth open image. Returns zero if n<=0 or n greater than the number of open image windows. */ public synchronized static int getNthImageID(int n) { if (n<=0) return 0; if (Interpreter.isBatchMode()) { int[] list = getIDList(); if (n>list.length) return 0; else return list[n-1]; } else { if (n>imageList.size()) return 0; ImageWindow win = (ImageWindow)imageList.get(n-1); if (win!=null) return win.getImagePlus().getID(); else return 0; } }
private static ImagePlus getFocusManagerActiveImage() { if (IJ.isMacro()) return null; KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Window win = kfm.getActiveWindow(); ImagePlus imp = null; if (win!=null && (win instanceof ImageWindow)) imp = ((ImageWindow)win).getImagePlus(); return imp; }
private static ImagePlus getFocusManagerActiveImage() { if (IJ.isMacro()) return null; KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Window win = kfm.getActiveWindow(); ImagePlus imp = null; if (win!=null && (win instanceof ImageWindow)) imp = ((ImageWindow)win).getImagePlus(); return imp; }
public static void showList() { for (int i=0; i<imageList.size(); i++) { ImageWindow win = (ImageWindow)imageList.get(i); ImagePlus imp = win.getImagePlus(); IJ.log(i + " " + imp.getTitle() + (win==currentWindow?"*":"")+" "+imp.getID()); } for (int i=0; i<activations.size(); i++) { ImageWindow win = (ImageWindow)activations.get(i); ImagePlus imp = win.getImagePlus(); IJ.log(i + " " + imp.getTitle() + " " + imp.getID()); } if (imageList.size()==0) IJ.log("imageList is empty"); if (activations.size()==0) IJ.log("activations list is empty"); IJ.log(" "); }
/** Get Screen Coordinates for ImageCanvas ic matching * the OffScreen Coordinates of the current ImageCanvas. * (srcRect and magnification stored after each received event.) * Input: The target ImageCanvas, the current ImageCanvas, * x-ScreenCoordinate for current Canvas, y-ScreenCoordinate for current Canvas * If the "ImageScaling" checkbox is selected, Scaling and Offset * of the images are taken into account. */ protected Point getMatchingCoords(ImageCanvas ic, ImageCanvas icc, int x, int y) { double xOffScreen = currentSrcRect.x + (x/currentMag); double yOffScreen = currentSrcRect.y + (y/currentMag); if (cScaling.getState()) { Calibration cal = ((ImageWindow)ic.getParent()).getImagePlus().getCalibration(); Calibration curCal = ((ImageWindow)icc.getParent()).getImagePlus().getCalibration(); xOffScreen = ((xOffScreen-curCal.xOrigin)*curCal.pixelWidth)/cal.pixelWidth+cal.xOrigin; yOffScreen = ((yOffScreen-curCal.yOrigin)*curCal.pixelHeight)/cal.pixelHeight+cal.yOrigin; } int xnew = ic.screenXD(xOffScreen); int ynew = ic.screenYD(yOffScreen); return new Point(xnew, ynew); }