Login  Register

Re: Opening Stack with ImageJ and BioFormats

Posted by Herbie on Oct 28, 2019; 2:46pm
URL: http://imagej.273.s1.nabble.com/Opening-Stack-with-ImageJ-and-BioFormats-tp5022585p5022599.html

Dear Michael,

I fear what you write is not the solution to a confusing naming of stack
images after applying run("Stack to Images"); .

What you write is perfectly OK but doesn't help much if you are not in
the know.

Assume a macro that calls run("Stack to Images"); and then deals with
the resulting images.
The coder assumes that the stack in question (with title stck.xyz) was
opened by plain ImageJ. Consequently, the coder knows that a certain
image, i.e. slice, of this stack is named "stck-000i". Not so if the
stack was opened by "Bio-Formats Importer".

One way to circumvent this problem is to rename or remove names of the
slices of a stack in *any* case.

This is far from convenient.

Many greetings

Herbie

::::::::::::::::::::::::::::::::::::::::::::
Am 28.10.19 um 15:19 schrieb Michael Schmid:

> On 28.10.19 10:19, Herbie wrote:
>> a current discussion here on the ImageJ-list leads me to post a
>> question about opening stacks either with "Plain ImageJ" or by using
>> "Bio-Formats Importer" from plain ImageJ.
>
>
> Hi everyone,
>
> after half a dozen more contributions, in case this has not been clearly
> answered:
>
> If you split a stack into images, the image titles are determined by the
> labels of the stack, if any. Otherwise, the images are named title-0001,
> etc. with "title" being the title of the stack.
>
> E.g. try this macro with any two-image stack like the sample stack
> "confocal-series_2Ch.tif" from this thread
>
>    setSlice(1);
>    run("Set Label...", "label=my_slice1");
>    setSlice(2);
>    run("Set Label...", "label=my_slice2");
>    run("Stack to Images");
>
> The images will be named "my_slice1" and "my_slice2".
>
> So the difference between opening by ImageJ and the Bio-Formats Importer
> seems to be that the latter adds labels (presumably only if there are no
> labels in the file).
>
> You can use a macro like the one above to set the labels to anything of
> your choice. This will determine what the image names after "Stack to
> Images".
> If you don't like the slice labels created by the Bio-Formats Importer,
> you can also get rid of them with the following macro:
>
>    for (i=1; i<=nSlices(); i++) {
>      setSlice(i);
>      setMetadata("Label", "");
>    }
>
> [Instead of run("Set Label..." ...) one has to use the equivalent
> command setMetadata("Label", ...) in this case, as the run("Set
> Label..." ...) command cannot be used to set the label to an empty String.]
>
>
> Michael
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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