How to set and edit the image label via GUI

Posted by Stein Rørvik on
URL: http://imagej.273.s1.nabble.com/How-to-set-and-edit-the-image-label-via-GUI-tp5021785.html

I want to set an image label using the GUI but can't find any obvious way to do it.
It is easy to set an image label via the macro language using the command
setMetadata("Label", "My Image Label");

But how can I do the same via the GUI, using the built in menus? Besides adding a new label, I would like to edit it if there is already a label present.

There is already a menu choice Stack - Tools - Set Label... which does exactly what I want, but that works only for stacks. Perhaps this could be generalized to work on single images too?

It seems that there is no difference behind setting a label to an image or a stack slice since the same macro command is used in both cases. In a macro, if you add a label to a single image, and then add a new slice; the original image label becomes the slice label of slice 1. This is already the expected behaviour, so I just miss the ability to do this (add the single image label) via the GUI.

As the following macro shows, there is no difference in the result if you use setMetadata("Label", ...) or run("Set Label...", ...) but the latter does not work for images, only stacks.

newImage("New Image", "8-bit white", 400, 400, 1);
setMetadata("Label", "My Label for Slice 1");
run("Add Slice");
setMetadata("Label", "My Label for Slice 2");

newImage("New Stack", "8-bit white", 400, 400, 2);
setSlice(1);
run("Set Label...", "label=[My Label for Slice 1]");
setSlice(2);
run("Set Label...", "label=[My Label for Slice 2]");

newImage("New Image", "8-bit white", 400, 400, 1);
run("Set Label...", "label=[My Label for Slice 1]");             //does not work
run("Add Slice");
run("Set Label...", "label=[My Label for Slice 2]");

My suggested solution is to allow the run("Set Label..." command work on single images too, not only stacks.
As the above example shows, the result will be the same.
Then the "Set Label..." menu choice will work via the GUI too.

Stein

--------------------------------------------------------------------------------


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html