Login  Register

Re: Opening Stack with ImageJ and BioFormats

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

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