private void removeStackLabels() { ImagePlus imp = IJ.getImage(); int size = imp.getStackSize(); if (size==1) IJ.error("Stack required"); else { ImageStack stack = imp.getStack(); for (int i=1; i<=size; i++) stack.setSliceLabel(null, i); imp.repaintWindow(); } }
if (command.equals("In")) { ic.zoomIn(x, y); if (ic.getMagnification()<=1.0) imp.repaintWindow(); } else { ic.zoomOut(x, y); if (ic.getMagnification()<1.0) imp.repaintWindow();
private void removeStackLabels() { ImagePlus imp = IJ.getImage(); int size = imp.getStackSize(); if (size==1) IJ.error("Stack required"); else { ImageStack stack = imp.getStack(); for (int i=1; i<=size; i++) stack.setSliceLabel(null, i); imp.repaintWindow(); } }
if (command.equals("In")) { ic.zoomIn(x, y); if (ic.getMagnification()<=1.0) imp.repaintWindow(); } else { ic.zoomOut(x, y); if (ic.getMagnification()<1.0) imp.repaintWindow();
void setMetadata() { String metadata = null; String arg1 = getFirstString(); if (interp.nextToken()==',') metadata = getLastString(); else interp.getRightParen(); ImagePlus imp = getImage(); boolean isInfo = false; if (metadata==null) { // one argument metadata = arg1; if (imp.getStackSize()==1) isInfo = true; if (metadata.startsWith("Info:")) { metadata = metadata.substring(5); isInfo = true; } } else isInfo = arg1.startsWith("info") || arg1.startsWith("Info"); if (metadata!=null && metadata.length()==0) metadata = null; if (isInfo) imp.setProperty("Info", metadata); else { imp.getStack().setSliceLabel(metadata, imp.getCurrentSlice()); if (imp.getStackSize()==1) imp.setProperty("Label", metadata); if (!Interpreter.isBatchMode()) imp.repaintWindow(); } }
void setMetadata() { String metadata = null; String arg1 = getFirstString(); if (interp.nextToken()==',') metadata = getLastString(); else interp.getRightParen(); ImagePlus imp = getImage(); boolean isInfo = false; if (metadata==null) { // one argument metadata = arg1; if (imp.getStackSize()==1) isInfo = true; if (metadata.startsWith("Info:")) { metadata = metadata.substring(5); isInfo = true; } } else isInfo = arg1.startsWith("info") || arg1.startsWith("Info"); if (metadata!=null && metadata.length()==0) metadata = null; if (isInfo) imp.setProperty("Info", metadata); else { imp.getStack().setSliceLabel(metadata, imp.getCurrentSlice()); if (imp.getStackSize()==1) imp.setProperty("Label", metadata); if (!Interpreter.isBatchMode()) imp.repaintWindow(); } }
void repaintWindow() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) { ImageWindow win = imp.getWindow(); if (win!=null) { if (Prefs.blackCanvas) { win.setForeground(Color.white); win.setBackground(Color.black); } else { win.setForeground(Color.black); win.setBackground(Color.white); } imp.repaintWindow(); } } repainted = true; }
if (arg.equals("in")) { ic.zoomIn(x, y); if (ic.getMagnification()<=1.0) imp.repaintWindow(); } else if (arg.equals("out")) { ic.zoomOut(x, y); if (ic.getMagnification()<1.0) imp.repaintWindow(); } else if (arg.equals("orig")) ic.unzoom();
void setVoxelSize() { double width = getFirstArg(); double height = getNextArg(); double depth = getNextArg(); String unit = getLastString(); ImagePlus imp = getImage(); Calibration cal = imp.getCalibration(); cal.pixelWidth = width; cal.pixelHeight = height; cal.pixelDepth = depth; cal.setUnit(unit); imp.repaintWindow(); }
void setVoxelSize() { double width = getFirstArg(); double height = getNextArg(); double depth = getNextArg(); String unit = getLastString(); ImagePlus imp = getImage(); Calibration cal = imp.getCalibration(); cal.pixelWidth = width; cal.pixelHeight = height; cal.pixelDepth = depth; cal.setUnit(unit); imp.repaintWindow(); }
ic.zoomOut(sx, sy); if (ic.getMagnification()<=1.0) imp.repaintWindow();
ic.zoomOut(sx, sy); if (ic.getMagnification()<=1.0) imp.repaintWindow();
void repaintWindow() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) { ImageWindow win = imp.getWindow(); if (win!=null) { if (Prefs.blackCanvas) { win.setForeground(Color.white); win.setBackground(Color.black); } else { win.setForeground(Color.black); win.setBackground(Color.white); } imp.repaintWindow(); } } repainted = true; }
repaintWindow(); IJ.showStatus(""); changes = false;
private void setSliceLabel() { ImagePlus imp = IJ.getImage(); int size = imp.getStackSize(); if (size==1) { IJ.error("Stack required"); return; } ImageStack stack = imp.getStack(); int n = imp.getCurrentSlice(); String label = stack.getSliceLabel(n); String label2 = label; if (label2==null) label2 = ""; GenericDialog gd = new GenericDialog("Set Slice Label ("+n+")"); gd.addStringField("Label:", label2, 30); gd.showDialog(); if (gd.wasCanceled()) return; label2 = gd.getNextString(); if (label2!=label) { stack.setSliceLabel(label2, n); imp.repaintWindow(); } }
private void setSliceLabel() { ImagePlus imp = IJ.getImage(); int size = imp.getStackSize(); if (size==1) { IJ.error("Stack required"); return; } ImageStack stack = imp.getStack(); int n = imp.getCurrentSlice(); String label = stack.getSliceLabel(n); String label2 = label; if (label2==null) label2 = ""; GenericDialog gd = new GenericDialog("Set Slice Label ("+n+")"); gd.addStringField("Label:", label2, 30); gd.showDialog(); if (gd.wasCanceled()) return; label2 = gd.getNextString(); if (label2!=label) { stack.setSliceLabel(label2, n); imp.repaintWindow(); } }
win.updateImage(this); else if (newStack==null) repaintWindow(); draw();
void swapStackImages(ImagePlus imp) { int n1 = (int)getFirstArg(); int n2 = (int)getLastArg(); ImageStack stack = imp.getStack(); int size = stack.getSize(); if (n1<1||n1>size||n2<1||n2>size) interp.error("Argument out of range"); Object pixels = stack.getPixels(n1); String label = stack.getSliceLabel(n1); stack.setPixels(stack.getPixels(n2), n1); stack.setSliceLabel(stack.getSliceLabel(n2), n1); stack.setPixels(pixels, n2); stack.setSliceLabel(label, n2); int current = imp.getCurrentSlice(); if (imp.isComposite()) { CompositeImage ci = (CompositeImage)imp; if (ci.getMode()==IJ.COMPOSITE) { ci.reset(); imp.updateAndDraw(); imp.repaintWindow(); return; } } if (n1==current || n2==current) imp.setStack(null, stack); }
win.updateImage(this); else if (newStack==null) repaintWindow(); draw();
void swapStackImages(ImagePlus imp) { int n1 = (int)getFirstArg(); int n2 = (int)getLastArg(); ImageStack stack = imp.getStack(); int size = stack.getSize(); if (n1<1||n1>size||n2<1||n2>size) interp.error("Argument out of range"); Object pixels = stack.getPixels(n1); String label = stack.getSliceLabel(n1); stack.setPixels(stack.getPixels(n2), n1); stack.setSliceLabel(stack.getSliceLabel(n2), n1); stack.setPixels(pixels, n2); stack.setSliceLabel(label, n2); int current = imp.getCurrentSlice(); if (imp.isComposite()) { CompositeImage ci = (CompositeImage)imp; if (ci.getMode()==IJ.COMPOSITE) { ci.reset(); imp.updateAndDraw(); imp.repaintWindow(); return; } } if (n1==current || n2==current) imp.setStack(null, stack); }