CompositeImage getImage() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null || !imp.isComposite()) return null; else return (CompositeImage)imp; }
/** Returns the display mode (IJ.COMPOSITE, IJ.COLOR or IJ.GRAYSCALE) if this is a CompositeImage, otherwise returns -1. */ public int getCompositeMode() { if (isComposite()) return ((CompositeImage)this).getMode(); else return -1; }
static int type(final ImagePlus imp) { int type = SINGLEIMAGE; boolean i5dexist = false; try { Class.forName("i5d.Image5D"); i5dexist = true; } catch (Throwable e) { } if (i5dexist && I5DResource.instance(imp)) type = IMAGE5D; else if (imp.isComposite()) type = COMPOSITEIMAGE; else if (imp.isHyperStack()) type = HYPERSTACK; else if (imp.getImageStackSize() > 1) type = IMAGESTACK; return type; }
public void setStack(ImageStack newStack, int channels, int slices, int frames) { if (newStack==null || channels*slices*frames!=newStack.getSize()) throw new IllegalArgumentException("channels*slices*frames!=stackSize"); if (IJ.debugMode) IJ.log("setStack: "+newStack.getSize()+" "+channels+" "+slices+" "+frames+" "+isComposite()); compositeChanges = channels!=this.nChannels; this.nChannels = channels; this.nSlices = slices; this.nFrames = frames; setStack(null, newStack); }
void getDisplayMode(ImagePlus imp) { Variable v = getVariableArg(); String mode = ""; if (imp.isComposite()) mode = ((CompositeImage)imp).getModeAsString(); v.setString(mode); }
private LUT[] getLuts() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null || imp.getBitDepth()!=16 || !imp.isComposite()) return null; return ((CompositeImage)imp).getLuts(); }
void addBalanceChoices() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null && imp.isComposite()) { for (int i=0; i<altChannelLabels.length; i++) choice.addItem(altChannelLabels[i]); } else { for (int i=0; i<channelLabels.length; i++) choice.addItem(channelLabels[i]); } }
private LUT[] getLuts() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null || imp.getBitDepth()!=16 || !imp.isComposite()) return null; return ((CompositeImage)imp).getLuts(); }
public void setStack(ImageStack newStack, int channels, int slices, int frames) { if (newStack==null || channels*slices*frames!=newStack.getSize()) throw new IllegalArgumentException("channels*slices*frames!=stackSize"); if (IJ.debugMode) IJ.log("setStack: "+newStack.getSize()+" "+channels+" "+slices+" "+frames+" "+isComposite()); compositeChanges = channels!=this.nChannels; this.nChannels = channels; this.nSlices = slices; this.nFrames = frames; setStack(null, newStack); }
/** Returns a copy of this image as an 8-bit or RGB BufferedImage. * @see ij.process.ShortProcessor#get16BitBufferedImage */ public BufferedImage getBufferedImage() { if (isComposite()) return (new ColorProcessor(getImage())).getBufferedImage(); else return ip.getBufferedImage(); }
/** Returns a copy of this image as an 8-bit or RGB BufferedImage. * @see ij.process.ShortProcessor#get16BitBufferedImage */ public BufferedImage getBufferedImage() { if (isComposite()) return (new ColorProcessor(getImage())).getBufferedImage(); else return ip.getBufferedImage(); }
double minshown(final int c) { if (imagetype == IMAGE5D) return I5DResource.processor(image,c).getMin(); else if (image.isComposite()) return ((CompositeImage)image).getChannelLut(c).min; else return image.getProcessor().getMin(); }
double maxshown(final int c) { if (imagetype == IMAGE5D) return I5DResource.processor(image,c).getMax(); else if (image.isComposite()) return ((CompositeImage)image).getChannelLut(c).max; else return image.getProcessor().getMax(); }
ColorModel colormodel(final int c) { if (imagetype == IMAGE5D) return I5DResource.processor(image,c).getColorModel(); else if (image.isComposite()) return ((CompositeImage)image).getChannelLut(c); else return image.getProcessor().getColorModel(); }
public void writeImage(ImagePlus imp, String path, int transparentIndex) throws Exception { if (imp.getStackSize()==4 && imp.getBitDepth()==8 && "alpha".equalsIgnoreCase(imp.getStack().getSliceLabel(4))) writeFourChannelsWithAlpha(imp, path); else if (transparentIndex>=0 && transparentIndex<=255 && imp.getBitDepth()==8) writeImageWithTransparency(imp, path, transparentIndex); else if (imp.getOverlay()!=null && !imp.getHideOverlay()) ImageIO.write(imp.flatten().getBufferedImage(), "png", new File(path)); else if (imp.getBitDepth()==16 && !imp.isComposite() && imp.getProcessor().isDefaultLut()) write16gs(imp, path); else ImageIO.write(imp.getBufferedImage(), "png", new File(path)); }
public void writeImage(ImagePlus imp, String path, int transparentIndex) throws Exception { if (imp.getStackSize()==4 && imp.getBitDepth()==8 && "alpha".equalsIgnoreCase(imp.getStack().getSliceLabel(4))) writeFourChannelsWithAlpha(imp, path); else if (transparentIndex>=0 && transparentIndex<=255 && imp.getBitDepth()==8) writeImageWithTransparency(imp, path, transparentIndex); else if (imp.getOverlay()!=null && !imp.getHideOverlay()) ImageIO.write(imp.flatten().getBufferedImage(), "png", new File(path)); else if (imp.getBitDepth()==16 && !imp.isComposite() && imp.getProcessor().isDefaultLut()) write16gs(imp, path); else ImageIO.write(imp.getBufferedImage(), "png", new File(path)); }
public void run(String arg) { ImagePlus imp = IJ.getImage(); if (imp.isHyperStack() || imp.isComposite()) { (new SubHyperstackMaker()).run(""); return; } String userInput = showDialog(); if (userInput==null) return; ImagePlus imp2 = makeSubstack(imp, userInput); if (imp2!=null) imp2.show(); }
void toggleChannel(ImagePlus imp, int channel) { if (!imp.isComposite()) interp.error("Composite image required"); if (channel<1 || channel>imp.getNChannels()) interp.error("Invalid channel: "+channel); if (((CompositeImage)imp).getMode()!=IJ.COMPOSITE) ((CompositeImage)imp).setMode(IJ.COMPOSITE); boolean[] active = ((CompositeImage)imp).getActiveChannels(); active[channel-1] = active[channel-1]?false:true; imp.updateAndDraw(); Channels.updateChannels(); }
public void run(String arg) { ImagePlus imp = IJ.getImage(); if (imp.isComposite() && imp.getNChannels()==imp.getStackSize()) { IJ.error("3D Gaussian Blur", "Composite color images not supported"); return; } if (!showDialog()) return; imp.startTiming(); blur(imp, xsigma, ysigma, zsigma); IJ.showTime(imp, imp.getStartTime(), "", imp.getStackSize()); }
public void run(String arg) { ImagePlus imp = IJ.getImage(); if (imp.isComposite() && imp.getNChannels()==imp.getStackSize()) { IJ.error("3D Gaussian Blur", "Composite color images not supported"); return; } if (!showDialog()) return; imp.startTiming(); blur(imp, xsigma, ysigma, zsigma); IJ.showTime(imp, imp.getStartTime(), "", imp.getStackSize()); }