MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / flattenImage

Method flattenImage

ij/src/main/java/ij/ImagePlus.java:3408–3423  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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'.

Callers 1

flattenStackMethod · 0.95

Calls 14

getProcessorMethod · 0.95
getWidthMethod · 0.95
getHeightMethod · 0.95
getPositionMethod · 0.95
setLocationMethod · 0.95
setOverlayMethod · 0.95
flattenMethod · 0.95
getCPositionMethod · 0.95
getZPositionMethod · 0.95
getTPositionMethod · 0.95
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected