public ImagePlus groupZProject(ImagePlus imp, int method, int groupSize) { if (method < 0 || method >= ZProjector.METHODS.length) return null; imp.setDimensions(1, groupSize, imp.getStackSize() / groupSize); ZProjector zp = new ZProjector(imp); zp.setMethod(method); zp.setStartSlice(1); zp.setStopSlice(groupSize); zp.doHyperStackProjection(true); return zp.getProjection(); }