Flattens Overlay 'overlay' on slice 'slice' of ImageStack 'stack'. Copied from OverlayCommands by Marcel Boeglin 2014.01.08.
(ImageStack stack, int slice, Overlay overlay, boolean showAll)
| 3406 | * Copied from OverlayCommands by Marcel Boeglin 2014.01.08. |
| 3407 | */ |
| 3408 | private void flattenImage(ImageStack stack, int slice, Overlay overlay, boolean showAll) { |
| 3409 | ImageProcessor ips = stack.getProcessor(slice); |
| 3410 | ImagePlus imp1 = new ImagePlus("temp", ips); |
| 3411 | int w = imp1.getWidth(); |
| 3412 | int h = imp1.getHeight(); |
| 3413 | for (int i=0; i<overlay.size(); i++) { |
| 3414 | Roi r = overlay.get(i); |
| 3415 | int roiPosition = r.getPosition(); |
| 3416 | //IJ.log(slice+" "+i+" "+roiPosition+" "+showAll+" "+overlay.size()); |
| 3417 | if (!(roiPosition==0 || roiPosition==slice || showAll)) |
| 3418 | r.setLocation(w, h); |
| 3419 | } |
| 3420 | imp1.setOverlay(overlay); |
| 3421 | ImagePlus imp2 = imp1.flatten(); |
| 3422 | stack.setPixels(imp2.getProcessor().getPixels(), slice); |
| 3423 | } |
| 3424 | |
| 3425 | /** Flattens Overlay 'overlay' on slice 'slice' corresponding to |
| 3426 | * coordinates 'z' and 't' in RGB-HyperStack 'stack'. |
no test coverage detected