[ome-users] syntax for scripting the windowless importer in Jython

Jean-Marie Burel (Staff) j.burel at dundee.ac.uk
Sat May 26 07:26:57 BST 2018


Hi Kai

I have prepared a template script that we will include in our training material after review. https://github.com/ome/training-scripts/pull/16
The script:
*  iterates through an OMERO Dataset
* opens each OMERO Image with the method allowing you to specify the plane you want to open
* load the OMERO ROIs associated to the Image.
* converts the ROIs and add them to the ROI manager
* section where you will run your macro is commented out. You can inject your macro

This script does not contain any code to save the output of the macro.

I think that we have migrated all the example scripts to the new repository. It will be preferable to use those ones.
Balaji has moved to a new position in Oxford few months ago
so the scripts on his private branch are not tested/used and might no longer work

Hope it helps

See you next week

Jmarie



From: Kai Schleicher <kai.schleicher at unibas.ch<mailto:kai.schleicher at unibas.ch>>
Date: Friday, 25 May 2018 at 17:02
To: jmarie burel <j.burel at dundee.ac.uk<mailto:j.burel at dundee.ac.uk>>, OME User Support List <ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>>
Subject: Re: [ome-users] syntax for scripting the windowless importer in Jython


Hi Jean-Marie,

thanks again for your reply! I realise that my request was not very clear:

I have time laps images (hyperstacks of 2C,75Z, 150T) in OMERO which all have ROIs stored in only the first time point. The ROIs where added using OMERO.

I am trying to write a script that

(i) fetches the first time point from all hyperstacks of a given dataset including their ROIs (ie, per hyperstack 2C,75Z, 1T)

(iii) runs an ImageJ macro on each hyperstack. This macro will require the ROIs to be present in the ImageJ ROI manager

My current script is based on the old one from Balaji [1] and already achieves this in principle, but I can not limit the import to only the first time point.

With the newer version [2] you referred me to this can be fixed, but here I failed to import the ROIs from OMERO into the ImageJ ROI manager.

Is there maybe a neat way of how I could achieve my goal?
Perhaps these two scripts could be combine (maybe including [3]?), but so far I failed to do so.

Thank you again for your help and see you soon at the meeting,
Kai

[1] https://github.com/bramalingam/Omero-Imagej-Scripts/blob/master/omero_batch_analysis.py
[2] https://github.com/ome/training-scripts/blob/master/practical/jython/analyse_particles_from_dataset.jy
[3] <https://github.com/ome/training-scripts/blob/master/practical/jython/analyse_particles_from_dataset.jy> <https://github.com/ome/training-scripts/blob/master/practical/jython/analyse_particles_from_dataset.jy> https://github.com/ome/training-scripts/blob/master/practical/jython/omero_rois_to_imagej_roi.jy

On 05/21/2018 02:17 PM, Jean-Marie Burel (Staff) wrote:
Hi Kai

To read the ROI when opening an image from OMERO to ImageJ
We use the Bio-Formats Importer option
The ROIs are read using https://github.com/openmicroscopy/bioformats/blob/develop/components/bio-formats-plugins/src/loci/plugins/util/ROIHandler.java

This can be a bit confusing
Will you need a Jython script that convert imagej ROIs to OMERO?

Cheers

Jmarie

From: Kai Schleicher <kai.schleicher at unibas.ch<mailto:kai.schleicher at unibas.ch>>
Date: Friday, 18 May 2018 at 16:33
To: OME User Support List <ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>>, jmarie burel <j.burel at dundee.ac.uk<mailto:j.burel at dundee.ac.uk>>
Subject: Re: [ome-users] syntax for scripting the windowless importer in Jython


Hi Jean-Marie,

thanks for your reply and the updated scripts! I switched to the newer version you mentioned and it works like a charm, it was easy to adept to fetch only the time points that I like to have!

I would like to further extend it and get the ROIs associated to that image from OMERO into the ROI manger of ImageJ.

I found how this could be done in the example scripts, i.e https://github.com/ome/training-scripts/blob/master/practical/jython/omero_rois_to_imagej_roi.jy

Just as a question, is this script already available as a class in OMER.insight?
Like a "ROIwriter class", as opposed to the ROIreader class from org.openmicroscopy.shoola.util.roi.io

Since this is a feature that is already in OMERO.insight, I figure there must be such a class, I just don't know its name :)

I apologize in advance, as these type of questions must be tedious to answer one by one (you are not a class/command/package lookup service), but I just started trying to find my way through the documentation.

Thanks and cheers,
Kai

On 05/17/2018 10:11 PM, Jean-Marie Burel (Staff) wrote:
Hi Kai


All the scripts are now available at https://github.com/ome/training-scripts

I did a bit of digging and it seems that the option specifyRanges=true is taken into account only when windowless=false
In that case the values in the range dialog are read.

We have written a new version of the script you mentioned
The new version  does not use the BF-importer plugin
https://github.com/ome/training-scripts/blob/master/practical/jython/analyse_particles_from_dataset.jy
This should hopefully allow you to only retrieve the planes you want

Cheers
Jmarie

From: ome-users <ome-users-bounces at lists.openmicroscopy.org.uk<mailto:ome-users-bounces at lists.openmicroscopy.org.uk>> on behalf of Kai Schleicher <kai.schleicher at unibas.ch<mailto:kai.schleicher at unibas.ch>>
Reply-To: OME User Support List <ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>>
Date: Thursday, 17 May 2018 at 18:11
To: "ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>" <ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>>
Subject: [ome-users] syntax for scripting the windowless importer in Jython


Dear OME-team,

To script the windowless BF-importer in Jython I am building on the cool script by Balaji<https://github.com/bramalingam/Omero-Imagej-Scripts/blob/master/omero_batch_analysis.py>.

I specifically wish to limit the import to the first time-point of my datasets, but I am struggling at getting the syntax right.

In IJ1-macro language it works like this:

run("Bio-Formats Importer", "open=V:/small5Dstack.tif specify_range t_begin=1 t_end=1 t_step=1");
In the jython script I tried to add a line 53:
options += " specifyranges=true tbegin=1 tend=1 tstep=1 "
But it still loads the entire dataset.
I tried a few other strings without luck and was wondering if you could maybe just point me to the proper way of doing it.

Thanks and see you soon at the meeting,
Kai

--
>>Please note my NEW PHONE NUMBERS: +41 61 207 57 31 (direct) +41 61 207 22 50 (central)<<
Kai Schleicher, PhD | Research Associate in Advanced Light Microscopy | Biozentrum, University of Basel | Klingelbergstrasse 50/70 | CH-4056 Basel |
Phone: +41 61 207 57 31 (direct) +41 61 207 22 50 (central) | kai.schleicher at unibas.ch<mailto:kai.schleicher at unibas.ch> | www.biozentrum.unibas.ch<http://www.biozentrum.unibas.ch> | www.microscopynetwork.unibas.ch<http://www.microscopynetwork.unibas.ch>

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


_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


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


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20180526/b1f2cad5/attachment.html>


More information about the ome-users mailing list