/** Performs projection using the specified method and stack range, and returns the result, where 'method' is "avg", "min", "max", "sum", "sd" or "median". Add " all" to 'method' to project all hyperstack time points. <br> Example: http://imagej.nih.gov/ij/macros/js/ProjectionDemo.js */ public static ImagePlus run(ImagePlus imp, String method, int startSlice, int stopSlice) { ZProjector zp = new ZProjector(imp); zp.setStartSlice(startSlice); zp.setStopSlice(stopSlice); zp.isHyperstack = imp.isHyperStack(); if (zp.isHyperstack && startSlice==1 && stopSlice==imp.getStackSize()) zp.setDefaultBounds(); if (method==null) return null; method = method.toLowerCase(); int m = -1; if (method.startsWith("av")) m = AVG_METHOD; else if (method.startsWith("max")) m = MAX_METHOD; else if (method.startsWith("min")) m = MIN_METHOD; else if (method.startsWith("sum")) m = SUM_METHOD; else if (method.startsWith("sd")) m = SD_METHOD; else if (method.startsWith("median")) m = MEDIAN_METHOD; if (m<0) throw new IllegalArgumentException("Invalid projection method: "+method); zp.allTimeFrames = method.contains("all"); zp.setMethod(m); zp.doProjection(true); return zp.getProjection(); }
/** Performs projection using the specified method and stack range, and returns the result, where 'method' is "avg", "min", "max", "sum", "sd" or "median". Add " all" to 'method' to project all hyperstack time points. <br> Example: http://imagej.nih.gov/ij/macros/js/ProjectionDemo.js */ public static ImagePlus run(ImagePlus imp, String method, int startSlice, int stopSlice) { ZProjector zp = new ZProjector(imp); zp.setStartSlice(startSlice); zp.setStopSlice(stopSlice); zp.isHyperstack = imp.isHyperStack(); if (zp.isHyperstack && startSlice==1 && stopSlice==imp.getStackSize()) zp.setDefaultBounds(); if (method==null) return null; method = method.toLowerCase(); int m = -1; if (method.startsWith("av")) m = AVG_METHOD; else if (method.startsWith("max")) m = MAX_METHOD; else if (method.startsWith("min")) m = MIN_METHOD; else if (method.startsWith("sum")) m = SUM_METHOD; else if (method.startsWith("sd")) m = SD_METHOD; else if (method.startsWith("median")) m = MEDIAN_METHOD; if (m<0) throw new IllegalArgumentException("Invalid projection method: "+method); zp.allTimeFrames = method.contains("all"); zp.setMethod(m); zp.doProjection(true); return zp.getProjection(); }
zp.setImage(imagePlus); zp.setMethod(ZProjector.MAX_METHOD); zp.doProjection(); final ImagePlus overlay = zp.getProjection();
/** 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()); }
/** 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()); }
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; }
zp.doProjection(); resultStack.addSlice(availableFeatures[GABOR] + "_" + i +"_"+sigma+"_" + gamma + "_"+ (int) (psi / (Math.PI/4) ) +"_"+frequency,
zp.doProjection(); resultStack.addSlice(availableFeatures[GABOR] + "_" + i +"_"+sigma+"_" + gamma + "_"+ (int) (psi / (Math.PI/4) ) +"_"+frequency,
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();
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();
for (int i=0;i<6; i++){ zp.setMethod(i); zp.doProjection(); membraneStack.addSlice(availableFeatures[MEMBRANE] + "_" +i+"_"+patchSize+"_"+membraneSize, zp.getProjection().getChannelProcessor());
for (int i=0;i<6; i++){ zp.setMethod(i); zp.doProjection(); membraneStack.addSlice(availableFeatures[MEMBRANE] + "_" +i+"_"+patchSize+"_"+membraneSize, zp.getProjection().getChannelProcessor());
for (int i=0;i<6; i++){ zp.setMethod(i); zp.doProjection(); membraneStack.addSlice(availableFeatures[MEMBRANE] + "_" +i+"_"+patchSize+"_"+membraneSize, zp.getProjection().getChannelProcessor());
for (int i=0;i<6; i++){ zp.setMethod(i); zp.doProjection(); membraneStack.addSlice(availableFeatures[MEMBRANE] + "_" +i+"_"+patchSize+"_"+membraneSize, zp.getProjection().getChannelProcessor());
if (isHyperstack) allTimeFrames = imp.getNFrames()>1&&imp.getNSlices()>1?gd.getNextBoolean():false; doProjection(true);
if (isHyperstack) allTimeFrames = imp.getNFrames()>1&&imp.getNSlices()>1?gd.getNextBoolean():false; doProjection(true);
doHSRGBProjection(imp); else doProjection(); stack.addSlice(null, projImage.getProcessor());
doHSRGBProjection(imp); else doProjection(); stack.addSlice(null, projImage.getProcessor());
zp.setStopSlice(stopSlice); zp.setMethod(method); zp.doProjection(); final ImagePlus proj = zp.getProjection();
zp.setStopSlice(stopSlice); zp.setMethod(method); zp.doProjection(); final ImagePlus proj = zp.getProjection(); if (bDoScaling) {