imagej / imagej-common

ImageJ core data model
https://imagej.net/libs/imagej-common
BSD 2-Clause "Simplified" License
9 stars 18 forks source link

Make sure rich image data structure has a "label" property #47

Open ctrueden opened 9 years ago

ctrueden commented 9 years ago

ImageJ1 displays the label as a "subtitle" at the top of the image window (not in the title bar—that would be the name). ImageJ2 will also need a dedicated label property, since it's useful.

We also need slice labels—but see #21 for that.

lannybroo commented 9 years ago

I agree with this. I use these all the time in ImageJ1. I also have always found it strange that this is different metadata than the slice labels. It would be nice if you wanted a subtitle on an entire stack to be able to set a label/subtitle property once for a stack. In IJ1, I end up using a utility function often when I want a plugin to be able to set a subtitle. Here is my utility function, for reference:

public static void setSubtitle(ImagePlus imp, String label) {
    ImageStack stack = imp.getStack();
    if (stack.getSize()>1) {
        // Stacks show the stack label as the subtitle
        stack.setSliceLabel(label, imp.getSlice());
    } else {
        // Single images show the "Label" property as the subtitle
        imp.setProperty("Label", label);
    }
    imp.updateAndRepaintWindow();
}
ctrueden commented 9 years ago

Thanks @lannybroo. I think that discrepancy is an artifact of ImageJ1's growth from 2D to 3D to 5D over time. Hopefully we can make ImageJ2 more unified in this regard.