Posted by
Fred Damen on
Feb 10, 2021; 8:45pm
URL: http://imagej.273.s1.nabble.com/No-SliceLabel-displayed-on-one-slice-image-tp5024449.html
Greeting,
When there is only one slice, the slice label is not displayed on the
image window status line or on the Info... page. The information is
there, just not viewable by the user through the GUI interface. See
below...
Thanks in advance,
Fred
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;
public class SliceLabelTest implements PlugIn {
public void run(String arg) {
{
ImagePlus imp = IJ.createImage("One", "32-bit black", 256, 256, 1);
imp.getStack().setSliceLabel("1\nA line of text\n",1);
imp.show();
IJ.log("One\n"+imp.getStack().getSliceLabel(1));
}
{
ImagePlus imp = IJ.createImage("Two", "32-bit black", 256, 256, 2);
imp.getStack().setSliceLabel("1\nA line of text\n",1);
imp.getStack().setSliceLabel("1\nAnother line of text\n",2);
imp.show();
IJ.log("Two\n"+imp.getStack().getSliceLabel(1));
}
{
ImagePlus imp = IJ.createImage("HyperStackOne", "32-bit
grayscale-mode", 256, 256, 1, 1, 1);
imp.getStack().setSliceLabel("1\nA line of text\n",1);
imp.show();
IJ.log("HyperStackOne\n"+imp.getStack().getSliceLabel(1));
}
{
ImagePlus imp = IJ.createImage("HyperStackTwo", "32-bit
grayscale-mode", 256, 256, 1, 1, 2);
imp.getStack().setSliceLabel("1\nA line of text\n",1);
imp.getStack().setSliceLabel("1\nAnother line of text\n",2);
imp.show();
IJ.log("HyperStackTwo\n"+imp.getStack().getSliceLabel(1));
}
}
}
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html