/** Replaces the ImageProcessor with the one specified and updates the display. With stacks, the ImageProcessor must be the same type as the other images in the stack and it must be the same width and height. */ public void setProcessor(ImageProcessor ip) { setProcessor(null, ip); }
public void setProcessor(String title, ImageProcessor ip) { if (! (ip instanceof FakeProcessor)) return; super.setProcessor(title, ip); } public void flush() {} // disabled
/** Replaces the ImageProcessor with the one specified and updates the display. With stacks, the ImageProcessor must be the same type as the other images in the stack and it must be the same width and height. */ public void setProcessor(ImageProcessor ip) { setProcessor(null, ip); }
/** Constructs an ImagePlus from an ImageProcessor. */ public ImagePlus(String title, ImageProcessor ip) { setProcessor(title, ip); setID(); }
/** Assigns a LUT (lookup table) to this image. * @see ij.io.Opener#openLut */ public void setLut(LUT lut) { ImageProcessor ip2 = getProcessor(); if (ip2!=null && lut!=null) { ip2.setLut(lut); setProcessor(ip2); } }
private void applyProcessorToStack(final Map<BPKey, ByteProcessor> byteProcessors, BPKey key, ImagePlus rtnVal, int channelNum) { ByteProcessor cp = byteProcessors.get(key); int i = key.getZ(); rtnVal.setC(channelNum); rtnVal.setZ(i + 1); rtnVal.setProcessor(cp); }
void saveAs8bitTiff(ImagePlus img, String path) { ImageProcessor ip = img.getProcessor(); if (ip instanceof ColorProcessor) {ip = reduceColors(ip); img.setProcessor(null, ip);} else if ((ip instanceof ShortProcessor) || (ip instanceof FloatProcessor)) {ip = ip.convertToByte(true); img.setProcessor(null, ip);} new FileSaver(img).saveAsTiff(path); }
/** Draws a new plot in this window. */ public void drawPlot(Plot plot) { this.plot = plot; if (imp!=null) { if (ic instanceof PlotCanvas) ((PlotCanvas)ic).setPlot(plot); imp.setProcessor(null, plot.getProcessor()); plot.setImagePlus(imp); //also adjusts the calibration of imp } }
void redisplayPowerSpectrum() { FHT fht = (FHT)imp.getProperty("FHT"); if (fht==null) {IJ.error("FFT", "Frequency domain image required"); return;} ImageProcessor ps = fht.getPowerSpectrum(); imp.setProcessor(null, ps); }
ImagePlus getVirtualStackImage() { ImagePlus imp = virtualStack.createImagePlus(); imp.setProcessor("", virtualStack.getProcessor().duplicate()); return imp; }
ImagePlus getVirtualStackImage() { ImagePlus imp = virtualStack.createImagePlus(); imp.setProcessor("", virtualStack.getProcessor().duplicate()); return imp; }
public static ImagePlus generateBlobImage(Blob b){ Rectangle r = b.getOuterContour().getBounds(); r.setBounds(r.x, r.y, (int)r.getWidth()+1, (int)r.getHeight()+1); ImagePlus help = NewImage.createByteImage("", r.width+2, r.height+2, 1, NewImage.FILL_WHITE); ImageProcessor ip = help.getProcessor(); b.draw(ip, Blob.DRAW_HOLES, -(r.x-1), -(r.y-1)); help.setProcessor(ip); return help; }
/** Converts the current image from RGB to CIE L*a*b* and stores the results * in the same RGB image R=L*, G=a*, B=b*. Values are therfore offset and rescaled. */ public static void RGBtoLab() { ImagePlus imp = IJ.getImage(); if (imp.getBitDepth()==24) imp.setProcessor(RGBtoLab(imp.getProcessor())); }
@Override final protected void init() { ipOriginal = imp.getProcessor(); if ( imp.getType() == ImagePlus.GRAY32 ) fp = ( FloatProcessor )ipOriginal.duplicate(); else fp = ( FloatProcessor )ipOriginal.convertToFloat(); imp.setProcessor( fp ); std = new BlockStatistics( fp ); }
@Override final protected void init() { ipOriginal = imp.getProcessor(); if ( imp.getType() == ImagePlus.GRAY32 ) fp = ( FloatProcessor )ipOriginal.duplicate(); else fp = ( FloatProcessor )ipOriginal.convertToFloat(); imp.setProcessor( fp ); variance = new BlockStatistics( fp ); }
@Override final protected void init() { ipOriginal = imp.getProcessor(); if ( imp.getType() == ImagePlus.GRAY32 ) fp = ( FloatProcessor )ipOriginal.duplicate(); else fp = ( FloatProcessor )ipOriginal.convertToFloat(); imp.setProcessor( fp ); variance = new BlockStatistics( fp ); }
public void setProcessor(String title, ImageProcessor ip) { if (1 != patch.length) return; //so not applied to stacks Loader loader = patch[currentSlice-1].getProject().getLoader(); ImagePlus imp = loader.fetchImagePlus(patch[currentSlice-1]); if (ip.getWidth() != imp.getWidth() || ip.getHeight() != imp.getHeight()) throw new IllegalArgumentException("PatchStack: ip wrong size"); imp.setProcessor(null, ip); // null means don't touch title patch[currentSlice-1].updateInDatabase("tiff_working"); //loader.vacuum(); // repainting elsewhere }
/** Draws the plot again, ignored if the plot has not been drawn before or the plot is frozen * If the ImagePlus exist, updates it and its calibration. */ public void updateImage() { if (!plotDrawn || pp.isFrozen) return; getBlankProcessor(); drawContents(ip); if (imp == null) return; adjustCalibration(imp.getCalibration()); imp.updateAndDraw(); if (ip != imp.getProcessor()) imp.setProcessor(ip); }
/** Converts this ImagePlus to RGB. */ public void convertToRGB() { if (imp.getBitDepth()==24) return; if (imp.getStackSize()>1) { new StackConverter(imp).convertToRGB(); return; } ImageProcessor ip = imp.getProcessor(); imp.setProcessor(null, ip.convertToRGB()); imp.setCalibration(imp.getCalibration()); //update calibration }
/** Converts this ImagePlus to RGB. */ public void convertToRGB() { if (imp.getBitDepth()==24) return; if (imp.getStackSize()>1) { new StackConverter(imp).convertToRGB(); return; } ImageProcessor ip = imp.getProcessor(); imp.setProcessor(null, ip.convertToRGB()); imp.setCalibration(imp.getCalibration()); //update calibration }