ImporterOptions for Bio-Formats windowless importer (colorMode)

I have some questions related to this post.
First, thanks a lot to @dgault for pointing to the correct usage of the ImporterOptions.
However, when using a similar script as @CellKai (see post-link above), I had troubles with the colorMode options.

Using the Strings described in the ImporterOptions (key and possible values) did not work, i.e. following line:

while either of the next lines did the job:

  1. Is there a specific reason why the String colorMode is ignored?
  2. Or is there an alternative way to create the options directly from Key-Value pairs defined by the ImporterOptions? E.g. something like that:
options = [ImporterOptions.KEY_COLOR_MODE: ImporterOptions.COLOR_MODE_COMPOSITE, ImporterOptions.KEY_AUTOSCALE: false]
IJ.runPlugIn("loci.plugins.LociImporter", options)
  1. Is there a specific order in which the options should be stated?

Thank a lot for your input!

Hi @loicsauteur

I am not sure why colorMode is ignored.The recorder prints for example color_mode=Composite, so I wonder why using colormode instead actually works :slight_smile:

As an alternative to, you can access the ImporterOptions from the Bio-Formats API directly.
There are very nice short examples (python) by @ctrueden on how to do so, for example

# read in and display ImagePlus(es) with arguments
from loci.plugins import BF
from loci.common import Region
from import ImporterOptions

file = "/Users/curtis/data/tubhiswt4D.ome.tif"

options = ImporterOptions()
options.setCropRegion(0, Region(15, 25, 50, 70))
imps = BF.openImagePlus(options)
for imp in imps:

Hope this helps!

1 Like

@CellKai thanks for the script example.
I will give it a try to open images stored on OMERO this way.

Let’s see if someone has any idea why the String colorMode is ignored…

Hi Loic,

unfortunately opening from OMERO does not work this way, as discussed here:

However, there is an even smoother way using imagej-OMERO:

Hope this works for you :slight_smile:

1 Like

Just to jump in on the colorMode String being ignored, this is certainly confusing and has come up a few times. Essentially the macro parser currently trims the Strings to lower case which means its not picking up options such as colorMode. I have opened a GitHub issue to address at some point in the future: