private ImageProcessor projImp() { ImageProcessor ip; final ZProjector zp = new ZProjector(imp); zp.setMethod(ZProjector.MAX_METHOD); zp.setStartSlice(minZ); zp.setStopSlice(maxZ); if (imp.isComposite()) { zp.doHyperStackProjection(false); final ImagePlus projImp = zp.getProjection(); projImp.setC(channel); ip = projImp.getChannelProcessor(); } else { zp.doProjection(); ip = zp.getProjection().getProcessor(); } return ip; }
/** Construction of ZProjector with image to be projected. */ public ZProjector(ImagePlus imp) { setImage(imp); }
private ImagePlus mergeUsingRGBProjection(ImagePlus[] images, boolean createComposite) { ImageStack stack = new ImageStack(imp.getWidth(),imp.getHeight()); for (int i=0; i<images.length; i++) { if (images[i]!=null) stack.addSlice(images[i].getProcessor()); } ImagePlus imp2 = new ImagePlus("temp", stack); ZProjector zp = new ZProjector(imp2); zp.setMethod(ZProjector.MAX_METHOD); zp.doRGBProjection(); imp2 = zp.getProjection(); if (createComposite) { imp2 = CompositeConverter.makeComposite(imp2); imp2.setTitle("Composite"); } else imp2.setTitle("RGB"); return imp2; }
public void doRGBProjection(boolean handleOverlay) { doRGBProjection(imp.getStack()); Overlay overlay = imp.getOverlay(); if (handleOverlay && overlay!=null) projImage.setOverlay(projectRGBHyperStackRois(overlay)); }
/** Performs actual projection using specified method. If handleOverlay, adds stack overlay elements from startSlice to stopSlice to projection. */ public void doProjection(boolean handleOverlay) { if (isHyperstack) doHyperStackProjection(allTimeFrames); else if (imp.getType()==ImagePlus.COLOR_RGB) doRGBProjection(handleOverlay); else { doProjection(); Overlay overlay = imp.getOverlay(); if (handleOverlay && overlay!=null) projImage.setOverlay(projectStackRois(overlay)); } if (projImage!=null) projImage.setCalibration(imp.getCalibration()); }
final ZProjector zp = new ZProjector(); zp.setImage(imagePlus); zp.setMethod(ZProjector.MAX_METHOD); zp.doProjection(); final ImagePlus overlay = zp.getProjection();
setDefaultBounds(); GenericDialog gd = buildControlDialog(startSlice,stopSlice); gd.showDialog(); if (gd.wasCanceled()) return; int startSlice2 = startSlice; int stopSlice2 = stopSlice; setStartSlice((int)gd.getNextNumber()); setStopSlice((int)gd.getNextNumber()); boolean rangeChanged = startSlice!=startSlice2 || stopSlice!=stopSlice2; startSlice2 = startSlice; if (isHyperstack) allTimeFrames = imp.getNFrames()>1&&imp.getNSlices()>1?gd.getNextBoolean():false; doProjection(true); IJ.register(ZProjector.class); if (Recorder.scriptMode()) { String m = getMethodAsString(); if (isHyperstack && allTimeFrames) m = m + " all";
stopSlice = (frame-1)*channels*slices + (stop-1)*channels + channel; if (rgb) doHSRGBProjection(imp); else doProjection(); stack.addSlice(null, projImage.getProcessor()); projImage = new ImagePlus(makeTitle(), stack); projImage.setDimensions(channels, 1, frames); if (channels>1) { stopSlice = stop; if (imp.getType()==ImagePlus.COLOR_RGB) projImage.setOverlay(projectRGBHyperStackRois(overlay)); else projImage.setOverlay(projectHyperStackRois(overlay));
public void run(String arg) { ImagePlus imp = IJ.getImage(); int size = imp.getStackSize(); if (size==1) { IJ.error("Z Project", "This command requires a stack"); return; } if (imp.isHyperStack()) { new ZProjector().run(""); return; } if (!showDialog(imp)) return; ImagePlus imp2 = groupZProject(imp, method, groupSize); imp2.setCalibration(imp.getCalibration()); Calibration cal = imp2.getCalibration(); cal.pixelDepth *= groupSize; if (imp!=null) imp2.show(); }
ImagePlus saveImp = imp; imp = red; color = "(red)"; doProjection(); ImagePlus red2 = projImage; imp = green; color = "(green)"; doProjection(); ImagePlus green2 = projImage; imp = blue; color = "(blue)"; doProjection(); ImagePlus blue2 = projImage; int w = red2.getWidth(), h = red2.getHeight(), d = red2.getStackSize(); ImageStack stack2 = merge.mergeStacks(w, h, d, red2.getStack(), green2.getStack(), blue2.getStack(), true); imp = saveImp; projImage = new ImagePlus(makeTitle(), stack2);
return; if (imp.getBitDepth()==24) { doRGBProjection(); return; sliceCount++; if (method==MEDIAN_METHOD) { projImage = doMedianProjection(); return; RayFunction rayFunc = getRayFunction(method, fp); if (IJ.debugMode==true) { IJ.log("\nProjecting stack from: "+startSlice projectSlice(stack.getPixels(n), rayFunc, ptype); sliceCount++; fp.subtract(sliceCount*32768.0); fp.resetMinAndMax(); projImage = new ImagePlus(makeTitle(), fp); } else if (method==SD_METHOD) { rayFunc.postProcess(); fp.resetMinAndMax(); projImage = new ImagePlus(makeTitle(), fp); } else { rayFunc.postProcess(); projImage = makeOutputImage(imp, fp, ptype);
public void doRGBProjection() { doRGBProjection(imp.getStack()); }
private ArrayList<OverlapProperties> findOverlappingTiles(final ArrayList<ImageInformation> imageInformationList, final boolean createPreview, final String fusionMethod) final ZProjector zp = new ZProjector(); zp.setMethod(ZProjector.MAX_METHOD); zp.setImage(iI.imp); if (iI.imp.getType() == ImagePlus.COLOR_RGB || iI.imp.getType() == ImagePlus.COLOR_256) zp.doRGBProjection(); iI.maxIntensity = zp.getProjection(); iI.maxIntensity.setProcessor(iI.maxIntensity.getTitle(), iI.maxIntensity.getProcessor().convertToFloat()); zp.doProjection(); iI.maxIntensity = zp.getProjection(); iI.maxIntensity.setProcessor(iI.maxIntensity.getTitle(), iI.maxIntensity.getProcessor().convertToFloat());
setDefaultBounds(); GenericDialog gd = buildControlDialog(startSlice,stopSlice); gd.showDialog(); if (gd.wasCanceled()) return; int startSlice2 = startSlice; int stopSlice2 = stopSlice; setStartSlice((int)gd.getNextNumber()); setStopSlice((int)gd.getNextNumber()); boolean rangeChanged = startSlice!=startSlice2 || stopSlice!=stopSlice2; startSlice2 = startSlice; if (isHyperstack) allTimeFrames = imp.getNFrames()>1&&imp.getNSlices()>1?gd.getNextBoolean():false; doProjection(true); IJ.register(ZProjector.class); if (Recorder.scriptMode()) { String m = getMethodAsString(); if (isHyperstack && allTimeFrames) m = m + " all";
/** Performs actual projection using specified method. If handleOverlay, adds stack overlay elements from startSlice to stopSlice to projection. */ public void doProjection(boolean handleOverlay) { if (isHyperstack) doHyperStackProjection(allTimeFrames); else if (imp.getType()==ImagePlus.COLOR_RGB) doRGBProjection(handleOverlay); else { doProjection(); Overlay overlay = imp.getOverlay(); if (handleOverlay && overlay!=null) projImage.setOverlay(projectStackRois(overlay)); } if (projImage!=null) projImage.setCalibration(imp.getCalibration()); }
stopSlice = (frame-1)*channels*slices + (stop-1)*channels + channel; if (rgb) doHSRGBProjection(imp); else doProjection(); stack.addSlice(null, projImage.getProcessor()); projImage = new ImagePlus(makeTitle(), stack); projImage.setDimensions(channels, 1, frames); if (channels>1) { stopSlice = stop; if (imp.getType()==ImagePlus.COLOR_RGB) projImage.setOverlay(projectRGBHyperStackRois(overlay)); else projImage.setOverlay(projectHyperStackRois(overlay));
public void run(String arg) { ImagePlus imp = IJ.getImage(); int size = imp.getStackSize(); if (size==1) { IJ.error("Z Project", "This command requires a stack"); return; } if (imp.isHyperStack()) { new ZProjector().run(""); return; } if (!showDialog(imp)) return; ImagePlus imp2 = groupZProject(imp, method, groupSize); imp2.setCalibration(imp.getCalibration()); Calibration cal = imp2.getCalibration(); cal.pixelDepth *= groupSize; if (imp!=null) imp2.show(); }
ImagePlus saveImp = imp; imp = red; color = "(red)"; doProjection(); ImagePlus red2 = projImage; imp = green; color = "(green)"; doProjection(); ImagePlus green2 = projImage; imp = blue; color = "(blue)"; doProjection(); ImagePlus blue2 = projImage; int w = red2.getWidth(), h = red2.getHeight(), d = red2.getStackSize(); ImageStack stack2 = merge.mergeStacks(w, h, d, red2.getStack(), green2.getStack(), blue2.getStack(), true); imp = saveImp; projImage = new ImagePlus(makeTitle(), stack2);
return; if (imp.getBitDepth()==24) { doRGBProjection(); return; sliceCount++; if (method==MEDIAN_METHOD) { projImage = doMedianProjection(); return; RayFunction rayFunc = getRayFunction(method, fp); if (IJ.debugMode==true) { IJ.log("\nProjecting stack from: "+startSlice projectSlice(stack.getPixels(n), rayFunc, ptype); sliceCount++; fp.subtract(sliceCount*32768.0); fp.resetMinAndMax(); projImage = new ImagePlus(makeTitle(), fp); } else if (method==SD_METHOD) { rayFunc.postProcess(); fp.resetMinAndMax(); projImage = new ImagePlus(makeTitle(), fp); } else { rayFunc.postProcess(); projImage = makeOutputImage(imp, fp, ptype);
public void doRGBProjection(boolean handleOverlay) { doRGBProjection(imp.getStack()); Overlay overlay = imp.getOverlay(); if (handleOverlay && overlay!=null) projImage.setOverlay(projectRGBHyperStackRois(overlay)); }