Opening Stack with ImageJ and BioFormats

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Opening Stack with ImageJ and BioFormats

Herbie
Dear experts,

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.

Attached please find a test-stack consisting of two color channels.

1. "Plain ImageJ"
(Copy the following macro code lines to an empty macro window
"Plugins >> New >> Macro" and run it.)
/////
open(""); // please open the test-stack
run("Stack to Images");
/////
I get two images with titles:
"confocal-series_2Ch-0001"
"confocal-series_2Ch-0002"

2. "Bio-Formats Importer" from plain ImageJ
(Copy the following macro code lines to an empty macro window
"Plugins >> New >> Macro" and run it.)
/////
f=File.openDialog(""); // please open the test-stack
run("Bio-Formats Importer", "open="+f+" color_mode=Default
rois_import=[ROI manager] view=[Standard ImageJ] stack_order=Default");
run("Stack to Images");
/////
(Please take care of possible line breaks introduced by the mailer.)
I get two images with titles:
"c:1/2 - confocal-series_2Ch"
"c:2/2 - confocal-series_2Ch"


The latter images appear in the Mac-Finder, when saved as TIF, with file
names:
"c/1/2 - confocal-series_2Ch.tif"
"c/2/2 - confocal-series_2Ch.tif"

For magic reasons the latter image files are correctly opened on my Mac
by using the macro:
(Copy the following macro code lines to an empty macro window
"Plugins >> New >> Macro" and run it.)
/////
f=File.openDialog(""); // please open one of the result images
open(f);
/////
I get the images opened by plain ImageJ with titles:
"c:1:2 - confocal-series_2Ch.tif"
"c:2:2 - confocal-series_2Ch.tif"

This may be judged as being nice but I judge it highly confusing.
  From my point of view the prefix introduced by "Bio-Formats Importer"
appears being far from reasonable.

Thanks for reading and testing!

Regards

Herbie




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

confocal-series_2Ch.tif (431K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Michael Schmid-3
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
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Herbie
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
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Michael Schmid-3
Dear Herbie,

well, I think you can't rely on an ImageStack opened by plain ImageJ not
to have any slice labels.
ImageJ saves the slice labels with the stack, so if you get slice labels
in ImageJ from whereever and then save the stack, you will get the
labels back when opening that stack.
You get slice labels e.g. after "images to stack", or a user plugin or
macro may have added labels (many of my local plugins and macros that
create stacks do so).

Thus, a macro that runs "Stack to Images" and then assumes image titles
like "stck-0001" etc. is unsafe in any case; one would better use the
last (most negative) nSlices ImageIDs to address these images.

I agree that the slice labels created by the BioFormats importer are a
bit unfortunate, because they contain characters that must not be
present in file names, and in most cases one would also like to have the
slice numbers (channel/z/t etc.) following the file name, not preceding
it, for easier sorting.
I am not sure, however, whether it is a good idea to change this, to
avoid breaking existing code that may rely on it.

Good ideas how to solve the problem without the danger of breaking
existing macros etc. are welcome...


Michael
________________________________________________________________
On 28.10.19 15:46, Herbie wrote:

> 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
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Kenneth R Sloan-2
While not a general solution, I would start by using whatever application-specific
knowledge you have to create your own slice labels.  Change them before Stack To Images.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Herbie
In reply to this post by Michael Schmid-3
Dear Michael,

if this is so, and I know it is, then it is of utmost importance to tell
the community.

My test-stack has no slice labels, so how comes that "Bio-Formats
Importer" invents them (according to what?) and uses them to name the
slices?
This is the problem, not plain ImageJ.

Frankly speaking the approach of "Bio-Formats Importer" is not
reasonable in several respects.
No one will use slashes and colons in a file name or is this the new
style in informatics? Did I miss something?

 From my point of view the problem is severe and if any reasonable
changes will break old code: So what?
Nobody cared about silly prefixes, so let's break code that uses those.

We shall see what the leading persons have to contribute and I really
should like to know who came up with the idea of using such prefixes.

Kind regards

Herbie

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

> Dear Herbie,
>
> well, I think you can't rely on an ImageStack opened by plain ImageJ not
> to have any slice labels.
> ImageJ saves the slice labels with the stack, so if you get slice labels
> in ImageJ from whereever and then save the stack, you will get the
> labels back when opening that stack.
> You get slice labels e.g. after "images to stack", or a user plugin or
> macro may have added labels (many of my local plugins and macros that
> create stacks do so).
>
> Thus, a macro that runs "Stack to Images" and then assumes image titles
> like "stck-0001" etc. is unsafe in any case; one would better use the
> last (most negative) nSlices ImageIDs to address these images.
>
> I agree that the slice labels created by the BioFormats importer are a
> bit unfortunate, because they contain characters that must not be
> present in file names, and in most cases one would also like to have the
> slice numbers (channel/z/t etc.) following the file name, not preceding
> it, for easier sorting.
> I am not sure, however, whether it is a good idea to change this, to
> avoid breaking existing code that may rely on it.
>
> Good ideas how to solve the problem without the danger of breaking
> existing macros etc. are welcome...
>
>
> Michael
> ________________________________________________________________
> On 28.10.19 15:46, Herbie wrote:
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Herbie
In reply to this post by Kenneth R Sloan-2
Good day Kenneth,

I mentioned this already but it is clumsy, less for me than for those
who are not in the know, like in the present case.
(Please consider the first post in the thread that led to this one.)

Greetings

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 28.10.19 um 16:23 schrieb Kenneth Sloan:

> While not a general solution, I would start by using whatever application-specific
> knowledge you have to create your own slice labels.  Change them before Stack To Images.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Sebastien Besson (Staff)
In reply to this post by Herbie
Dear Herbie and all,

Thanks for raising the issue of the slice label and providing a reproducible scenario including test data. Answering a few questions from the thread:

- we fully agree that breaking downstream code should never be done lightly. In the case of Bio-Formats, this will always be communicated via an increment of the major version number
- I retested your example using both the current (6.3.0) and older (down to 5.3.0) releases of Bio-Formats and I can confirm the slice label behaviour you are describing in all cases
- looking into the code base, the formatting of the slice label including the prefixes has always been the behavior since the implementation of the plugin over a decade ago

The Stack to Images workflow you are describing makes sense.  Other consumers of the plugin have separately asked for the ability to further customize the slice label with additional metadata in the context of a completely different workflow[1].

Bio-Formats 5.7.0 introduced the ability to control the pattern used for controlling the slice label which I expect helps addressing both use cases. You should be able to set its value from the configuration window (Plugins > Bio-Formats > Bio-Formats Plugins Configuration) under the General panel.
The default value has been kept to "%c%z%t- %n" to prevent a breaking change of the plugin. Setting this value to empty results in the label of your test file displayed exactly like in plain ImageJ which should fix your workflow.
Please give us a try and let us know if you find any issue.

Best,
Sebastien

[1] https://github.com/ome/bioformats/pull/2670

On 28/10/2019, 15:35, "ImageJ Interest Group on behalf of Herbie" <[hidden email] on behalf of [hidden email]> wrote:

    Dear Michael,

    if this is so, and I know it is, then it is of utmost importance to tell
    the community.

    My test-stack has no slice labels, so how comes that "Bio-Formats
    Importer" invents them (according to what?) and uses them to name the
    slices?
    This is the problem, not plain ImageJ.

    Frankly speaking the approach of "Bio-Formats Importer" is not
    reasonable in several respects.
    No one will use slashes and colons in a file name or is this the new
    style in informatics? Did I miss something?

     From my point of view the problem is severe and if any reasonable
    changes will break old code: So what?
    Nobody cared about silly prefixes, so let's break code that uses those.

    We shall see what the leading persons have to contribute and I really
    should like to know who came up with the idea of using such prefixes.

    Kind regards

    Herbie

    ::::::::::::::::::::::::::::::::::::::::::::
    Am 28.10.19 um 16:15 schrieb Michael Schmid:
    > Dear Herbie,
    >
    > well, I think you can't rely on an ImageStack opened by plain ImageJ not
    > to have any slice labels.
    > ImageJ saves the slice labels with the stack, so if you get slice labels
    > in ImageJ from whereever and then save the stack, you will get the
    > labels back when opening that stack.
    > You get slice labels e.g. after "images to stack", or a user plugin or
    > macro may have added labels (many of my local plugins and macros that
    > create stacks do so).
    >
    > Thus, a macro that runs "Stack to Images" and then assumes image titles
    > like "stck-0001" etc. is unsafe in any case; one would better use the
    > last (most negative) nSlices ImageIDs to address these images.
    >
    > I agree that the slice labels created by the BioFormats importer are a
    > bit unfortunate, because they contain characters that must not be
    > present in file names, and in most cases one would also like to have the
    > slice numbers (channel/z/t etc.) following the file name, not preceding
    > it, for easier sorting.
    > I am not sure, however, whether it is a good idea to change this, to
    > avoid breaking existing code that may rely on it.
    >
    > Good ideas how to solve the problem without the danger of breaking
    > existing macros etc. are welcome...
    >
    >
    > Michael
    > ________________________________________________________________
    > On 28.10.19 15:46, Herbie wrote:
    >> 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



The University of Dundee is a registered Scottish Charity, No: SC015096

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Wayne Rasband-2
In reply to this post by Herbie
> On Oct 28, 2019, at 5:19 AM, Herbie <[hidden email]> wrote:
>
> Dear experts,
>
> 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.

This bug is fixed in the latest ImageJ daily build (1.52s1). The “Stack to Images” command no longer uses the slice label as the file name if it contains a forward slash or space.

-wayne

> Attached please find a test-stack consisting of two color channels.
>
> 1. "Plain ImageJ"
> (Copy the following macro code lines to an empty macro window
> "Plugins >> New >> Macro" and run it.)
> /////
> open(""); // please open the test-stack
> run("Stack to Images");
> /////
> I get two images with titles:
> "confocal-series_2Ch-0001"
> "confocal-series_2Ch-0002"
>
> 2. "Bio-Formats Importer" from plain ImageJ
> (Copy the following macro code lines to an empty macro window
> "Plugins >> New >> Macro" and run it.)
> /////
> f=File.openDialog(""); // please open the test-stack
> run("Bio-Formats Importer", "open="+f+" color_mode=Default rois_import=[ROI manager] view=[Standard ImageJ] stack_order=Default");
> run("Stack to Images");
> /////
> (Please take care of possible line breaks introduced by the mailer.)
> I get two images with titles:
> "c:1/2 - confocal-series_2Ch"
> "c:2/2 - confocal-series_2Ch"
>
>
> The latter images appear in the Mac-Finder, when saved as TIF, with file names:
> "c/1/2 - confocal-series_2Ch.tif"
> "c/2/2 - confocal-series_2Ch.tif"
>
> For magic reasons the latter image files are correctly opened on my Mac by using the macro:
> (Copy the following macro code lines to an empty macro window
> "Plugins >> New >> Macro" and run it.)
> /////
> f=File.openDialog(""); // please open one of the result images
> open(f);
> /////
> I get the images opened by plain ImageJ with titles:
> "c:1:2 - confocal-series_2Ch.tif"
> "c:2:2 - confocal-series_2Ch.tif"
>
> This may be judged as being nice but I judge it highly confusing.
> From my point of view the prefix introduced by "Bio-Formats Importer" appears being far from reasonable.
>
> Thanks for reading and testing!

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Stein Rørvik
I don't understand why spaces in labels are no longer allowed in this case?
Spaces should be valid in filenames for all the relevant operating systems in use for ImageJ.

It would make more sense to disallow the colon character ":" in addition to forward "/" and also backward "\" slashes, to avoid problems with the image title to filename conversion.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 29. oktober 2019 16:40
To: [hidden email]
Subject: Re: Opening Stack with ImageJ and BioFormats

> On Oct 28, 2019, at 5:19 AM, Herbie <[hidden email]> wrote:
>
> Dear experts,
>
> 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.

This bug is fixed in the latest ImageJ daily build (1.52s1). The “Stack to Images” command no longer uses the slice label as the file name if it contains a forward slash or space.

-wayne

> Attached please find a test-stack consisting of two color channels.
>
> 1. "Plain ImageJ"
> (Copy the following macro code lines to an empty macro window "Plugins
> >> New >> Macro" and run it.) ///// open(""); // please open the
> test-stack run("Stack to Images"); ///// I get two images with titles:
> "confocal-series_2Ch-0001"
> "confocal-series_2Ch-0002"
>
> 2. "Bio-Formats Importer" from plain ImageJ (Copy the following macro
> code lines to an empty macro window "Plugins >> New >> Macro" and run
> it.) ///// f=File.openDialog(""); // please open the test-stack
> run("Bio-Formats Importer", "open="+f+" color_mode=Default
> rois_import=[ROI manager] view=[Standard ImageJ]
> stack_order=Default"); run("Stack to Images"); ///// (Please take care
> of possible line breaks introduced by the mailer.) I get two images
> with titles:
> "c:1/2 - confocal-series_2Ch"
> "c:2/2 - confocal-series_2Ch"
>
>
> The latter images appear in the Mac-Finder, when saved as TIF, with file names:
> "c/1/2 - confocal-series_2Ch.tif"
> "c/2/2 - confocal-series_2Ch.tif"
>
> For magic reasons the latter image files are correctly opened on my Mac by using the macro:
> (Copy the following macro code lines to an empty macro window "Plugins
> >> New >> Macro" and run it.) ///// f=File.openDialog(""); // please
> open one of the result images open(f); ///// I get the images opened
> by plain ImageJ with titles:
> "c:1:2 - confocal-series_2Ch.tif"
> "c:2:2 - confocal-series_2Ch.tif"
>
> This may be judged as being nice but I judge it highly confusing.
> From my point of view the prefix introduced by "Bio-Formats Importer" appears being far from reasonable.
>
> Thanks for reading and testing!

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7C2f6eb7e3b7a7468899b208d75c8689fb%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637079605220643687&amp;sdata=viQV0XBCFhgt0e%2FnziV%2BUMMxn%2BfWjhC%2FlXXrkYkYeUw%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Wayne Rasband-2
> On Oct 29, 2019, at 3:22 PM, Stein Rørvik <[hidden email]> wrote:
>
> I don't understand why spaces in labels are no longer allowed in this case?
> Spaces should be valid in filenames for all the relevant operating systems in use for ImageJ.
>
> It would make more sense to disallow the colon character ":" in addition to forward "/" and also backward "\" slashes, to avoid problems with the image title to filename conversion.

The "Stack to Images” command in the 1.52s3 daily build does not use the slice label as the image title if the label contains "/", "\" or ":".

-wayne

> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
> Sent: 29. oktober 2019 16:40
> To: [hidden email]
> Subject: Re: Opening Stack with ImageJ and BioFormats
>
>> On Oct 28, 2019, at 5:19 AM, Herbie <[hidden email]> wrote:
>>
>> Dear experts,
>>
>> 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.
>
> This bug is fixed in the latest ImageJ daily build (1.52s1). The “Stack to Images” command no longer uses the slice label as the file name if it contains a forward slash or space.
>
> -wayne
>
>> Attached please find a test-stack consisting of two color channels.
>>
>> 1. "Plain ImageJ"
>> (Copy the following macro code lines to an empty macro window "Plugins
>>>> New >> Macro" and run it.) ///// open(""); // please open the
>> test-stack run("Stack to Images"); ///// I get two images with titles:
>> "confocal-series_2Ch-0001"
>> "confocal-series_2Ch-0002"
>>
>> 2. "Bio-Formats Importer" from plain ImageJ (Copy the following macro
>> code lines to an empty macro window "Plugins >> New >> Macro" and run
>> it.) ///// f=File.openDialog(""); // please open the test-stack
>> run("Bio-Formats Importer", "open="+f+" color_mode=Default
>> rois_import=[ROI manager] view=[Standard ImageJ]
>> stack_order=Default"); run("Stack to Images"); ///// (Please take care
>> of possible line breaks introduced by the mailer.) I get two images
>> with titles:
>> "c:1/2 - confocal-series_2Ch"
>> "c:2/2 - confocal-series_2Ch"
>>
>>
>> The latter images appear in the Mac-Finder, when saved as TIF, with file names:
>> "c/1/2 - confocal-series_2Ch.tif"
>> "c/2/2 - confocal-series_2Ch.tif"
>>
>> For magic reasons the latter image files are correctly opened on my Mac by using the macro:
>> (Copy the following macro code lines to an empty macro window "Plugins
>>>> New >> Macro" and run it.) ///// f=File.openDialog(""); // please
>> open one of the result images open(f); ///// I get the images opened
>> by plain ImageJ with titles:
>> "c:1:2 - confocal-series_2Ch.tif"
>> "c:2:2 - confocal-series_2Ch.tif"
>>
>> This may be judged as being nice but I judge it highly confusing.
>> From my point of view the prefix introduced by "Bio-Formats Importer" appears being far from reasonable.
>>
>> Thanks for reading and testing!

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Opening Stack with ImageJ and BioFormats

Herbie
In reply to this post by Stein Rørvik
Thanks Stein and Wayne,

for insisting on my initial suggestion of not allowing slashes and
colons in file names and for implementing the code change!

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::::
Am 29.10.19 um 20:22 schrieb Stein Rørvik:

> I don't understand why spaces in labels are no longer allowed in this case?
> Spaces should be valid in filenames for all the relevant operating systems in use for ImageJ.
>
> It would make more sense to disallow the colon character ":" in addition to forward "/" and also backward "\" slashes, to avoid problems with the image title to filename conversion.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
> Sent: 29. oktober 2019 16:40
> To: [hidden email]
> Subject: Re: Opening Stack with ImageJ and BioFormats
>
>> On Oct 28, 2019, at 5:19 AM, Herbie <[hidden email]> wrote:
>>
>> Dear experts,
>>
>> 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.
>
> This bug is fixed in the latest ImageJ daily build (1.52s1). The “Stack to Images” command no longer uses the slice label as the file name if it contains a forward slash or space.
>
> -wayne
>
>> Attached please find a test-stack consisting of two color channels.
>>
>> 1. "Plain ImageJ"
>> (Copy the following macro code lines to an empty macro window "Plugins
>>>> New >> Macro" and run it.) ///// open(""); // please open the
>> test-stack run("Stack to Images"); ///// I get two images with titles:
>> "confocal-series_2Ch-0001"
>> "confocal-series_2Ch-0002"
>>
>> 2. "Bio-Formats Importer" from plain ImageJ (Copy the following macro
>> code lines to an empty macro window "Plugins >> New >> Macro" and run
>> it.) ///// f=File.openDialog(""); // please open the test-stack
>> run("Bio-Formats Importer", "open="+f+" color_mode=Default
>> rois_import=[ROI manager] view=[Standard ImageJ]
>> stack_order=Default"); run("Stack to Images"); ///// (Please take care
>> of possible line breaks introduced by the mailer.) I get two images
>> with titles:
>> "c:1/2 - confocal-series_2Ch"
>> "c:2/2 - confocal-series_2Ch"
>>
>>
>> The latter images appear in the Mac-Finder, when saved as TIF, with file names:
>> "c/1/2 - confocal-series_2Ch.tif"
>> "c/2/2 - confocal-series_2Ch.tif"
>>
>> For magic reasons the latter image files are correctly opened on my Mac by using the macro:
>> (Copy the following macro code lines to an empty macro window "Plugins
>>>> New >> Macro" and run it.) ///// f=File.openDialog(""); // please
>> open one of the result images open(f); ///// I get the images opened
>> by plain ImageJ with titles:
>> "c:1:2 - confocal-series_2Ch.tif"
>> "c:2:2 - confocal-series_2Ch.tif"
>>
>> This may be judged as being nice but I judge it highly confusing.
>>  From my point of view the prefix introduced by "Bio-Formats Importer" appears being far from reasonable.
>>
>> Thanks for reading and testing!
>
> --
> ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7C2f6eb7e3b7a7468899b208d75c8689fb%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637079605220643687&amp;sdata=viQV0XBCFhgt0e%2FnziV%2BUMMxn%2BfWjhC%2FlXXrkYkYeUw%3D&amp;reserved=0
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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