|
Bugzilla – Bug 320 |
ImageStack().deleteSlice(1) deletes wrong slice |
Last modified: 2011-05-31 17:34:48 CDT |
| ⚠ |
NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug. The Fiji project now uses GitHub Issues for issue tracking. Please file all new issues there. |
| ImageStack().deleteSlice(1) deletes wrong slice | |
|
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
The ImageStack's method deleteSlice(int n) deletes the wrong slice if n=1. The labels of the resulting stack start correctly with the label of the second original slice, but the pixel data of the first slice remain, the second slice gets deleted instead. Please run the following Javascript code and observe the first slice. In the image, it says t=001 but should be t=002 after running the script. // Javascript code to reproduce: IJ.run("Hyperstack...", "title=HyperStack type=16-bit display=Color width=400 height=100 channels=1 slices=1 frames=100 label"); var imp = WindowManager.getCurrentImage(); var stack = imp.getStack(); stack.setSliceLabel("this is slice 2, but will contain the pixel data of slice 1", 2); stack.deleteSlice(1); imp.updateAndRepaintWindow();Oh, sorry, I just found out that it _does_ work if you put a imp.setStack(null, stack); before the line updating the ImagePlus. So like this, it works: IJ.run("Hyperstack...", "title=HyperStack type=16-bit display=Color width=400 height=100 channels=1 slices=1 frames=100 label"); var imp = WindowManager.getCurrentImage(); var stack = imp.getStack(); stack.setSliceLabel("this is the former slice 2", 2); stack.deleteSlice(1); imp.setStack(null, stack); imp.updateAndRepaintWindow();