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.

Bug 320 - ImageStack().deleteSlice(1) deletes wrong slice
ImageStack().deleteSlice(1) deletes wrong slice
Status: RESOLVED INVALID
Product: Fiji
Classification: Unclassified
Component: ImageJ1
unspecified
Macintosh Mac OS
: P2 minor
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2011-05-31 17:15 CDT by Jan Eglinger
Modified: 2011-05-31 17:34 CDT
0 users

See Also:

Description Jan Eglinger 2011-05-31 17:15:22 CDT
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();
Comment 1 Jan Eglinger 2011-05-31 17:34:48 CDT
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();