void lineWidth() { int width = (int) IJ.getNumber("Line Width:", Line.getWidth()); if (width == IJ.CANCELED) return; Line.setWidth(width); LineWidthAdjuster.update(); ImagePlus imp = WindowManager.getCurrentImage(); if (imp != null && imp.isProcessor()) { ImageProcessor ip = imp.getProcessor(); ip.setLineWidth(Line.getWidth()); Roi roi = imp.getRoi(); if (roi != null && roi.isLine()) imp.draw(); } }
/** * @return the height of the camera stored at the ImageJ preferences. * @throws ConfigurationException */ public static int getFullHeight() { EFTEMj_Configuration config; try { config = EFTEMj_ConfigurationManager.getConfiguration(); int height = config.getInt(heightKey); if (height <= 0) { height = (int) IJ.getNumber( "The height of the used camera is not saved. Please enter the height in Pixel:", 4096); config.setProperty(heightKey, height); config.save(); } return height; } catch (ConfigurationException e) { e.printStackTrace(); } return 1; }
/** * @return the width of the camera stored at the ImageJ preferences. * @throws ConfigurationException */ public static int getFullWidth() { EFTEMj_Configuration config; try { config = EFTEMj_ConfigurationManager.getConfiguration(); int width = config.getInt(widthKey); if (width <= 0) { width = (int) IJ.getNumber( "The width of the used camera is not saved. Please enter the width in Pixel:", 4096); config.setProperty(widthKey, width); config.save(); } return width; } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 1; }
void runMacro(String arg, ImagePlus imp) { boolean rotate = arg.equals("rotate"); Roi roi = imp.getRoi(); if (rotate && IJ.macroRunning()) { String options = Macro.getOptions(); if (options != null && (options.indexOf("grid=") != -1 || options.indexOf("interpolat") != -1)) { IJ.run("Rotate... ", options); // run Image>Transform>Rotate return; } } if (roi == null) { noRoi(rotate ? "Rotate" : "Enlarge"); return; } double dangle = Tools.parseDouble(angle); if (Double.isNaN(dangle)) { dangle = 15; angle = "" + dangle; } if (rotate && (roi instanceof ImageRoi)) { dangle = IJ.getNumber("Angle (degrees):", dangle); ((ImageRoi) roi).rotate(dangle); imp.draw(); angle = "" + dangle; return; } Undo.setup(Undo.ROI, imp); roi = (Roi) roi.clone(); if (rotate) { String value = IJ.runMacroFile("ij.jar:RotateSelection", angle); Roi roi2 = imp.getRoi(); transferProperties(roi, roi2); imp.setRoi(roi2); if (value != null) angle = value; } else if (arg.equals("enlarge")) (new RoiEnlarger()).run(""); }