/** * Saves statistics for one particle in a results table. This is a method subclasses may want to * override. */ protected void saveResults(ImageStatistics stats, Roi roi) { analyzer.saveResults(stats, roi); if (recordStarts) { rt.addValue("XStart", stats.xstart); rt.addValue("YStart", stats.ystart); } if (addToManager) { if (roiManager == null) { if (Macro.getOptions() != null && Interpreter.isBatchMode()) roiManager = Interpreter.getBatchModeRoiManager(); if (roiManager == null) { Frame frame = WindowManager.getFrame("ROI Manager"); if (frame == null) IJ.run("ROI Manager..."); frame = WindowManager.getFrame("ROI Manager"); if (frame == null || !(frame instanceof RoiManager)) { addToManager = false; return; } roiManager = (RoiManager) frame; } if (resetCounter) roiManager.runCommand("reset"); } if (imp.getStackSize() > 1) roi.setPosition(imp.getCurrentSlice()); if (lineWidth != 1) roi.setStrokeWidth(lineWidth); roiManager.add(imp, roi, rt.getCounter()); } if (showResults) rt.addResults(); }
/** * Creates a new GenericDialog with the specified title. Uses the current image image window as * the parent frame or the ImageJ frame if no image windows are open. Dialog parameters are * recorded by ImageJ's command recorder but this requires that the first word of each label be * unique. */ public GenericDialog(String title) { this( title, WindowManager.getCurrentImage() != null ? (Frame) WindowManager.getCurrentImage().getWindow() : IJ.getInstance() != null ? IJ.getInstance() : new Frame()); }
void addToRoiManager(ImagePlus imp) { if (IJ.macroRunning() && Interpreter.isBatchModeRoiManager()) IJ.error("run(\"Add to Manager\") may not work in batch mode macros"); Frame frame = WindowManager.getFrame("ROI Manager"); if (frame == null) IJ.run("ROI Manager..."); if (imp == null) return; Roi roi = imp.getRoi(); if (roi == null) return; frame = WindowManager.getFrame("ROI Manager"); if (frame == null || !(frame instanceof RoiManager)) IJ.error("ROI Manager not found"); RoiManager rm = (RoiManager) frame; boolean altDown = IJ.altKeyDown(); IJ.setKeyUp(IJ.ALL_KEYS); if (altDown && !IJ.macroRunning()) IJ.setKeyDown(KeyEvent.VK_SHIFT); if (roi.getState() == Roi.CONSTRUCTING) { // wait (up to 2 sec.) until ROI finished long start = System.currentTimeMillis(); while (true) { IJ.wait(10); if (roi.getState() != Roi.CONSTRUCTING) break; if ((System.currentTimeMillis() - start) > 2000) { IJ.beep(); IJ.error("Add to Manager", "Selection is not complete"); return; } } } rm.runCommand("add"); IJ.setKeyUp(IJ.ALL_KEYS); }
public void run(String arg) { ImagePlus imp = WindowManager.getCurrentImage(); if (imp == null) { IJ.noImage(); return; } ImageStack stack1 = imp.getStack(); String fileName = imp.getTitle(); int endslice = stack1.getSize(); ImagePlus imp2 = duplicateStack(imp); imp2.show(); String duplicateName = imp2.getTitle(); // IJ.showMessage("Box",fileName); ImageStack stack2 = imp2.getStack(); stack1.deleteSlice(1); stack2.deleteSlice(endslice); String calculatorstring = ("image1='" + fileName + "' operation=Subtract image2=" + imp2.getTitle() + " create stack"); IJ.run("Image Calculator...", calculatorstring); ImagePlus imp3 = WindowManager.getCurrentImage(); imp3.setTitle(fileName + " DeltaF up"); imp2.getWindow().close(); imp.getWindow().close(); }
public void run(String arg) { int[] wList = WindowManager.getIDList(); if (wList == null) { IJ.error("No images are open."); return; } double thalf = 0.5; boolean keep; GenericDialog gd = new GenericDialog("Bleach correction"); gd.addNumericField("t½:", thalf, 1); gd.addCheckbox("Keep source stack:", true); gd.showDialog(); if (gd.wasCanceled()) return; long start = System.currentTimeMillis(); thalf = gd.getNextNumber(); keep = gd.getNextBoolean(); if (keep) IJ.run("Duplicate...", "title='Bleach corrected' duplicate"); ImagePlus imp1 = WindowManager.getCurrentImage(); int d1 = imp1.getStackSize(); double v1, v2; int width = imp1.getWidth(); int height = imp1.getHeight(); ImageProcessor ip1, ip2, ip3; int slices = imp1.getStackSize(); ImageStack stack1 = imp1.getStack(); ImageStack stack2 = imp1.getStack(); int currentSlice = imp1.getCurrentSlice(); for (int n = 1; n <= slices; n++) { ip1 = stack1.getProcessor(n); ip3 = stack1.getProcessor(1); ip2 = stack2.getProcessor(n); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { v1 = ip1.getPixelValue(x, y); v2 = ip3.getPixelValue(x, y); // =B8/(EXP(-C$7*A8)) v1 = (v1 / Math.exp(-n * thalf)); ip2.putPixelValue(x, y, v1); } } IJ.showProgress((double) n / slices); IJ.showStatus(n + "/" + slices); } // stack2.show(); imp1.updateAndDraw(); }
private static CustomStackWindow getInstance() { if (cached != null) return cached; // check if there's an existing SegmentationEditor int[] ids = WindowManager.getIDList(); for (int id : ids) { ImageWindow iw = WindowManager.getImage(id).getWindow(); if (iw instanceof CustomStackWindow) return (CustomStackWindow) iw; } newSegmentationEditor(); return cached; }
private static Frame getParentFrame() { Frame parent = WindowManager.getCurrentImage() != null ? (Frame) WindowManager.getCurrentImage().getWindow() : IJ.getInstance() != null ? IJ.getInstance() : new Frame(); if (IJ.isMacOSX() && IJ.isJava18()) { ImageJ ij = IJ.getInstance(); if (ij != null && ij.isActive()) parent = ij; else parent = null; } return parent; }
/** Builds the list of currently opened {@link ImagePlus} in ImageJ. */ private void initImageList() { int[] IDs = WindowManager.getIDList(); if (null == IDs) { image_names = new String[] {MESSAGES[1]}; images = new ArrayList<ImagePlus>(); return; } ImagePlus imp; images = new ArrayList<ImagePlus>(IDs.length); for (int i = 0; i < IDs.length; i++) { imp = WindowManager.getImage(IDs[i]); images.add(imp); } refreshImageNames(); }
public void run(ImageProcessor ip) { IndexColorModel icm = (IndexColorModel) ip.getColorModel(); // IJ.write("Color Model=" + ip.getColorModel() + " " + ip.isColorLut()); int pixBits = icm.getPixelSize(); int mapSize = icm.getMapSize(); // retrieve the current lookup tables (maps) for R,G,B byte[] Rmap = new byte[mapSize]; icm.getReds(Rmap); byte[] Gmap = new byte[mapSize]; icm.getGreens(Gmap); byte[] Bmap = new byte[mapSize]; icm.getBlues(Bmap); // modify the lookup tables for (int idx = 0; idx < mapSize; idx++) { int r = 0xff & Rmap[idx]; // mask to treat as unsigned byte int g = 0xff & Gmap[idx]; int b = 0xff & Bmap[idx]; Rmap[idx] = (byte) Math.min(r + 10, 255); Gmap[idx] = (byte) Math.min(g + 10, 255); Bmap[idx] = (byte) Math.min(b + 10, 255); } // create a new color model and apply to the image IndexColorModel icm2 = new IndexColorModel(pixBits, mapSize, Rmap, Gmap, Bmap); ip.setColorModel(icm2); WindowManager.getCurrentImage().updateAndDraw(); }
public void render(int w, int h, Graphics2D g2) { if (WindowManager.getImageCount() > 0) { imp = WindowManager.getCurrentWindow().getImagePlus(); if (imp != null) { Image img = imp.getImage(); g2.drawImage(img, 0, 0, imp.getWidth(), imp.getHeight(), null); } if (buff != null) { g2.drawImage(buff, 0, 0, imp.getWidth(), imp.getHeight(), null); } } }
public Zipper<Map<Integer, MZipper<RoiContainer>>> exec( Zipper<Map<Integer, MZipper<RoiContainer>>> z, int frame) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(WindowManager.getCurrentWindow().getCanvas()); Map<Integer, MZipper<RoiContainer>> newRois; if (returnVal == JFileChooser.APPROVE_OPTION) { try { FileInputStream f = new FileInputStream(fc.getSelectedFile().getCanonicalPath()); MroiLisp parser = new MroiLisp(f); parser.ReInit(f); newRois = parser.roiFile(); // z.rights.clear(); // z.rights.add(newRois); // z = z.right(); // return z; return z.insertAndStep(newRois); } catch (IOException e) { IJ.error("Couldn't open from " + fc.getSelectedFile().getName() + ": " + e.getMessage()); } catch (mroi.ParseException e) { IJ.error("Failed in parsing: " + e.getMessage()); } catch (Exception e) { IJ.error("Malformed input file: " + e.getMessage()); } } return z; }
public String[] getOpenImageNames() { int[] imageIDList = WindowManager.getIDList(); String[] imageNames = new String[imageIDList.length]; // imageNames[0] = "None"; if (!imageIDList.equals(null) && imageIDList.length > 1) { for (int i = 0; i < imageIDList.length; i++) { ImagePlus tempIMP = WindowManager.getImage(imageIDList[i]); imageNames[i] = tempIMP.getTitle(); } return imageNames; } else { imageNames[0] = "None"; return imageNames; } }
/** * Execute plugin functionality: stack FFT with window function, max projection over all slices * (phase, Z angle), blank out central 1/8 circle (set to min value), display min-max. */ public ResultSet exec(ImagePlus... imps) { ImagePlus imp = imps[0]; Util_StackFFT2D stackFFT2D = new Util_StackFFT2D(); stackFFT2D.resultTypeChoice = Util_StackFFT2D.resultType[1]; ImagePlus impF = stackFFT2D.exec(imp); IJ.run(impF, "Z Project...", "projection=[Max Intensity]"); ImagePlus impProjF = ij.WindowManager.getCurrentImage(); maskCentralRegion(impProjF); if (impProjF.isComposite()) { // display grayscale, not colored composite CompositeImage ci = (CompositeImage) impProjF; ci.setMode(IJ.GRAYSCALE); impProjF.updateAndDraw(); } displayMinToMax(impProjF); impProjF.setTitle(I1l.makeTitle(imps[0], TLA)); String shortInfo = "Maximum intensity projection of log" + " (amplitude^2) 2D FFT stack, central region masked," + " rescaled (min-max) to improve contrast of the relevant" + " frequency range."; results.addImp(shortInfo, impProjF); results.addInfo( "How to interpret", "look for clean 1st & 2nd" + " order spots, similar across angles. Note that spot" + " intensity depends on image content."); return results; }
public void run(String arg) { imp = WindowManager.getCurrentImage(); if (arg.equals("add")) { addToRoiManager(imp); return; } if (imp == null) { IJ.noImage(); return; } if (arg.equals("all")) imp.setRoi(0, 0, imp.getWidth(), imp.getHeight()); else if (arg.equals("none")) imp.killRoi(); else if (arg.equals("restore")) imp.restoreRoi(); else if (arg.equals("spline")) fitSpline(); else if (arg.equals("circle")) fitCircle(imp); else if (arg.equals("ellipse")) createEllipse(imp); else if (arg.equals("hull")) convexHull(imp); else if (arg.equals("mask")) createMask(imp); else if (arg.equals("from")) createSelectionFromMask(imp); else if (arg.equals("inverse")) invert(imp); else if (arg.equals("toarea")) lineToArea(imp); else if (arg.equals("toline")) areaToLine(imp); else if (arg.equals("properties")) { setProperties("Properties ", imp.getRoi()); imp.draw(); } else if (arg.equals("band")) makeBand(imp); else if (arg.equals("tobox")) toBoundingBox(imp); else runMacro(arg); }
void createMask(ImagePlus imp) { Roi roi = imp.getRoi(); boolean useInvertingLut = Prefs.useInvertingLut; Prefs.useInvertingLut = false; if (roi == null || !(roi.isArea() || roi.getType() == Roi.POINT)) { createMaskFromThreshold(imp); Prefs.useInvertingLut = useInvertingLut; return; } ImagePlus maskImp = null; Frame frame = WindowManager.getFrame("Mask"); if (frame != null && (frame instanceof ImageWindow)) maskImp = ((ImageWindow) frame).getImagePlus(); if (maskImp == null) { ImageProcessor ip = new ByteProcessor(imp.getWidth(), imp.getHeight()); if (!Prefs.blackBackground) ip.invertLut(); maskImp = new ImagePlus("Mask", ip); maskImp.show(); } ImageProcessor ip = maskImp.getProcessor(); ip.setRoi(roi); ip.setValue(255); ip.fill(ip.getMask()); maskImp.updateAndDraw(); Prefs.useInvertingLut = useInvertingLut; }
void updateSliceSummary() { int slices = imp.getStackSize(); float[] areas = rt.getColumn(ResultsTable.AREA); if (areas == null) areas = new float[0]; String label = imp.getTitle(); if (slices > 1) { label = imp.getStack().getShortSliceLabel(slice); label = label != null && !label.equals("") ? label : "" + slice; } String aLine = null; double sum = 0.0; int start = areas.length - particleCount; if (start < 0) return; for (int i = start; i < areas.length; i++) sum += areas[i]; int places = Analyzer.getPrecision(); Calibration cal = imp.getCalibration(); String total = "\t" + ResultsTable.d2s(sum, places); String average = "\t" + ResultsTable.d2s(sum / particleCount, places); String fraction = "\t" + ResultsTable.d2s(sum * 100.0 / totalArea, 1); aLine = label + "\t" + particleCount + total + average + fraction; aLine = addMeans(aLine, areas.length > 0 ? start : -1); if (slices == 1) { Frame frame = WindowManager.getFrame("Summary"); if (frame != null && (frame instanceof TextWindow) && summaryHdr.equals(prevHdr)) tw = (TextWindow) frame; } if (tw == null) { String title = slices == 1 ? "Summary" : "Summary of " + imp.getTitle(); tw = new TextWindow(title, summaryHdr, aLine, 450, 300); prevHdr = summaryHdr; } else tw.append(aLine); }
void remove() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp != null) imp.setOverlay(null); overlay2 = null; RoiManager rm = RoiManager.getInstance(); if (rm != null) rm.runCommand("show none"); }
public void run(String arg) { ImagePlus image = WindowManager.getCurrentImage(); try { Image3DUniverse univ = new Image3DUniverse(); univ.show(); GUI.center(univ.getWindow()); // only when there is an image and we are not called // from a macro if (image != null && !IJ.isMacro()) univ.getExecuter().addContent(image, null); } catch (Exception e) { StringBuffer buf = new StringBuffer(); StackTraceElement[] st = e.getStackTrace(); buf.append( "An unexpected exception occurred. \n" + "Please mail me the following lines if you \n" + "need help.\n" + "[email protected]\n \n"); buf.append(e.getClass().getName() + ":" + e.getMessage() + "\n"); for (int i = 0; i < st.length; i++) { buf.append( " at " + st[i].getClassName() + "." + st[i].getMethodName() + "(" + st[i].getFileName() + ":" + st[i].getLineNumber() + ")\n"); } new ij.text.TextWindow("Error", buf.toString(), 500, 400); } }
public Channels() { super("Channels"); if (instance != null) { instance.toFront(); return; } WindowManager.addWindow(this); instance = this; GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); setLayout(gridbag); int y = 0; c.gridx = 0; c.gridy = y++; c.gridwidth = 1; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; int margin = 32; if (IJ.isMacOSX()) margin = 20; c.insets = new Insets(10, margin, 10, margin); choice = new Choice(); for (int i = 0; i < modes.length; i++) choice.addItem(modes[i]); choice.select(0); choice.addItemListener(this); add(choice, c); CompositeImage ci = getImage(); int nCheckBoxes = ci != null ? ci.getNChannels() : 3; if (nCheckBoxes > CompositeImage.MAX_CHANNELS) nCheckBoxes = CompositeImage.MAX_CHANNELS; checkbox = new Checkbox[nCheckBoxes]; for (int i = 0; i < nCheckBoxes; i++) { checkbox[i] = new Checkbox("Channel " + (i + 1), true); c.insets = new Insets(0, 25, i < nCheckBoxes - 1 ? 0 : 10, 5); c.gridy = y++; add(checkbox[i], c); checkbox[i].addItemListener(this); } c.insets = new Insets(0, 15, 10, 15); c.fill = GridBagConstraints.NONE; c.gridy = y++; moreButton = new Button(moreLabel); moreButton.addActionListener(this); add(moreButton, c); update(); pm = new PopupMenu(); for (int i = 0; i < menuItems.length; i++) addPopupItem(menuItems[i]); add(pm); addKeyListener(IJ.getInstance()); // ImageJ handles keyboard shortcuts setResizable(false); pack(); if (location == null) { GUI.center(this); location = getLocation(); } else setLocation(location); show(); }
/** * Adds a checkbox labelled "Preview" for "automatic" preview. The reference to this checkbox can * be retrieved by getPreviewCheckbox() and it provides the additional method previewRunning for * optical feedback while preview is prepared. PlugInFilters can have their "run" method * automatically called for preview under the following conditions: - the PlugInFilter must pass a * reference to itself (i.e., "this") as an argument to the AddPreviewCheckbox - it must implement * the DialogListener interface and set the filter parameters in the dialogItemChanged method. - * it must have DIALOG and PREVIEW set in its flags. A previewCheckbox is always off when the * filter is started and does not get recorded by the Macro Recorder. * * @param pfr A reference to the PlugInFilterRunner calling the PlugInFilter if automatic preview * is desired, null otherwise. */ public void addPreviewCheckbox(PlugInFilterRunner pfr) { if (previewCheckbox != null) return; ImagePlus imp = WindowManager.getCurrentImage(); if (imp != null && imp.isComposite() && ((CompositeImage) imp).getMode() == IJ.COMPOSITE) return; this.pfr = pfr; addCheckbox(previewLabel, false, true); }
void addToRoiManager(ImagePlus imp) { if (IJ.macroRunning() && Interpreter.isBatchModeRoiManager()) IJ.error("run(\"Add to Manager\") may not work in batch mode macros"); Frame frame = WindowManager.getFrame("ROI Manager"); if (frame == null) IJ.run("ROI Manager..."); if (imp == null) return; Roi roi = imp.getRoi(); if (roi == null) return; frame = WindowManager.getFrame("ROI Manager"); if (frame == null || !(frame instanceof RoiManager)) IJ.error("ROI Manager not found"); RoiManager rm = (RoiManager) frame; boolean altDown = IJ.altKeyDown(); IJ.setKeyUp(IJ.ALL_KEYS); if (altDown && !IJ.macroRunning()) IJ.setKeyDown(KeyEvent.VK_SHIFT); rm.runCommand("add"); IJ.setKeyUp(IJ.ALL_KEYS); }
/** @param args */ public static void main(String[] args) { // Set params int[][] pairs = new int[][] {new int[] {1, 2}}; PIV_analyser.WINDOW_SIZE blocksize = PIV_analyser.WINDOW_SIZE._64x64; // Load the test image System.out.println("Loading the image..."); FileInfo fi = new FileInfo(); fi.width = 256; fi.height = 64; fi.offset = 177; fi.nImages = 2; fi.fileName = TESTPIV; fi.directory = "."; new FileOpener(fi).open(); // Get a reference to it ImagePlus imp = WindowManager.getCurrentImage(); // Initialize the plugin System.out.println("Initializing the plugin..."); PIV_analyser piv = new PIV_analyser(); // give it a ref to the ImageProcessor piv.setup("", imp); // setup image pair piv.setImagePairs(pairs); // setup window size piv.setWinsize(blocksize); // run it and time it System.out.println("Running the plugin..."); Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); piv.exec(false); stopwatch.stop(); System.out.println("Done in: " + stopwatch); System.out.println("Exiting."); if (LOG) { File log = new File("log.txt"); Writer output; try { output = new BufferedWriter(new FileWriter(log, true)); output.append("[+] Test - " + DateUtils.now() + "\n"); output.append("\t Image: " + TESTPIV + "\n"); output.append("\t Image pairs: " + pairs.length + " pair(s).\n"); output.append("\t Image size: " + imp.getWidth() + " x " + imp.getHeight() + ".\n"); output.append("\t Block size: " + blocksize.toString() + ".\n"); output.append("\t Exec time: " + stopwatch + "\n\n"); output.close(); } catch (IOException e) { e.printStackTrace(); } } imp.changes = false; imp.close(); if (DISPLAY_COLOR_WHEEL) { ColorProcessor cp = new ColorProcessor(256, 256); PIV_analyser.colorCircle(cp); new ImagePlus("Color coded orientation", cp).show(); } }
boolean setProperties(String title, Roi roi) { Frame f = WindowManager.getFrontWindow(); if (f != null && f.getTitle().indexOf("3D Viewer") != -1) return false; if (roi == null) { IJ.error("This command requires a selection."); return false; } RoiProperties rp = new RoiProperties(title, roi); return rp.showDialog(); }
@Override public void run(String arg0) { GenericDialog gd = new GenericDialog("Save JPEG"); gd.addStringField("Title", "A"); gd.addStringField("Directory", "/"); gd.showDialog(); String base_name = gd.getNextString(); String direc = gd.getNextString(); save(WindowManager.getCurrentImage(), base_name, direc); }
/** Sets the color used used for the ROI Manager "Show All" mode. */ public static void setShowAllColor(Color c) { if (c == null) return; showAllColor = c; labelColor = null; ImagePlus img = WindowManager.getCurrentImage(); if (img != null) { ImageCanvas ic = img.getCanvas(); if (ic != null && ic.getShowAllROIs()) img.draw(); } }
public void run(String arg) { ImageWindow iw = WindowManager.getCurrentWindow(); pw = jutils.getPW4SelCopy(iw); String title = pw.getTitle(); float[][] yvals = pw.getYValues(); float[][] xvals = pw.getXValues(); int length = yvals[0].length; if (pw.getShowErrors()) errs = pw.getErrors(0, false); int[] colors = pw.getColors(); colors[0] = 0; ScriptEngineManager manager = new ScriptEngineManager(); engine = manager.getEngineByName("js"); ce = (Compilable) engine; // hitcounter=0; c2 = 0.0f; iterations = 0; checkc2 = false; double[] stats = new double[3]; tempx = new float[length]; tempdata = new float[length]; System.arraycopy(xvals[0], 0, tempx, 0, length); System.arraycopy(yvals[0], 0, tempdata, 0, length); pw.addPoints(tempx, new float[tempx.length], false); series = pw.getNpts().length - 1; double[] params = new double[10]; int[] fixes = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1}; init_options(params, fixes); if (!init_functions()) { return; } while (showoptions(params, fixes)) { NLLSfit_v2 fitclass; if (checkc2) { fitclass = new NLLSfit_v2(this, 0); } else { fitclass = new NLLSfit_v2(this, 0.0001, 50, 0.1); } float[] fit = fitclass.fitdata(params, fixes, constraints, yvals[0], weights, stats, true); pw.updateSeries(fit, series, false); c2 = (float) stats[1]; iterations = (int) stats[0]; } IJ.log("Chi Squared = " + (float) stats[1]); IJ.log("Iterations = " + (int) stats[0]); for (int i = 0; i < 10; i++) { IJ.log("P" + (i + 1) + " = " + (float) params[i] + " fixed = " + fixes[i]); } IJ.log("AIC = " + (float) stats[2]); // IJ.log("hits = "+hitcounter); set_options(params, fixes); }
private boolean showDialog() { String[] types = {"RAW", "JPEG", "ZLIB"}; GenericDialog gd = new GenericDialog("Generate Bricks"); gd.addChoice("FileType", types, filetype); gd.addNumericField("JPEG quality", jpeg_quality, 0); gd.addNumericField("Max file size (MB)", bdsizelimit, 0); int[] wlist = WindowManager.getIDList(); if (wlist == null) return false; String[] titles = new String[wlist.length]; for (int i = 0; i < wlist.length; i++) titles[i] = ""; int tnum = 0; for (int i = 0; i < wlist.length; i++) { ImagePlus imp = WindowManager.getImage(wlist[i]); if (imp != null) { titles[tnum] = imp.getTitle(); tnum++; } } gd.addChoice("Source image: ", titles, titles[0]); gd.showDialog(); if (gd.wasCanceled()) return false; filetype = types[gd.getNextChoiceIndex()]; jpeg_quality = (int) gd.getNextNumber(); if (jpeg_quality > 100) jpeg_quality = 100; if (jpeg_quality < 0) jpeg_quality = 0; bdsizelimit = (int) gd.getNextNumber(); int id = gd.getNextChoiceIndex(); lvImgTitle = new ArrayList<String>(); lvImgTitle.add(titles[id]); Prefs.set("filetype.string", filetype); Prefs.set("jpeg_quality.int", jpeg_quality); Prefs.set("bdsizelimit.int", bdsizelimit); return true; }
public static void addOrthoslice( String image, String c, String name, String r, String g, String b, String resamplingF) { Image3DUniverse univ = getUniv(); ImagePlus grey = WindowManager.getImage(image); Color3f color = ColorTable.getColor(c); int factor = getInt(resamplingF); boolean[] channels = new boolean[] {getBoolean(r), getBoolean(g), getBoolean(b)}; univ.addOrthoslice(grey, color, name, 0, channels, factor); }
private boolean checkImage() { imp = WindowManager.getCurrentImage(); if (imp == null) { IJ.beep(); IJ.showStatus("No image"); return false; } ip = setup(imp); if (ip == null) return false; return true; }
public void run(String arg) { if (imp == null) imp = WindowManager.getCurrentImage(); if (imp == null) { return; } CustomCanvas cc = new CustomCanvas(imp); storePixelValues(imp.getProcessor()); new CustomWindow(imp, cc); }