We're Hiring!

creating well w/ multiple fields

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

creating well w/ multiple fields

Postby dsudar » Fri Nov 04, 2016 3:21 am

Hi team,

I'm trying to write a script very similar to Will's Dataset_To_Plate.py script that can create Wells with multiple fields. I used Will's code as a starting point and had hoped that the addWellSample method would allow me to just keep adding images (i.e. WellSample's) to a well but clearly that's not how that works. I put my code so far here (https://github.com/dsudar/OMEROscripts/ ... To_Well.py) and I was hoping to get some hints how to proceed with this. As is the routine puts one Image into the Well but then fails on all subsequent Images.

My initial concept is very simple: move all images in a single Dataset to a single specified Well in a Plate as fields in that Well. If the Plate already exists, provide the Plate ID and if it doesn't yet exist, provide a name to be given to the new Plate and get back the Plate ID for that new Plate.

Thanks,
- Damir
dsudar
 
Posts: 235
Joined: Mon May 14, 2012 8:43 pm
Location: Berkeley, CA, USA

Re: creating well w/ multiple fields

Postby wmoore » Fri Nov 04, 2016 11:51 am

Hi Damir,

I posted a fix at https://github.com/dsudar/OMEROscripts/pull/1

I also added posX and posY to each WellSample (just random numbers), just so I could visualise this
in the new "Spacial View" that we're working on. See screenshot at https://github.com/openmicroscopy/openm ... -258405216
But you can remove this if you don't have any useful values to add.

Other suggestions:
You might want to add a default name to the Plate parameter E.g. default='Dataset_To_Well", just to allow you to run the script without having to enter a value here?
There doesn't seem to be any message returned if the Plate already exists. You might just want to fix that with:

Code: Select all
    if newplate:
        message += "New plate created: %s." % newplate.getName().val
        robj = newplate
    else:
        message += "Images added to plate: %s." % plate.getName()
        robj = plate._obj


Regards,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: creating well w/ multiple fields

Postby dsudar » Fri Nov 04, 2016 5:40 pm

Hi Will,

Thanks much for the super-quick fixes. It works! I'm not entirely sure I understand the differences but there's no arguing with success.

Yes, I have been following your progress on the spatial view per well functionality and that will be critical for what I'm doing with this little script. Can't wait for that functionality but I assume that that is scheduled for 5.3 and not before, right? And adding the posX, posY is excellent in this script and for my use.

FYI: we are robotically spotting regular grids of cell-substrates into 96-well plates in grids of 8 by 8 (or 9 by 9) spots per well and then we drive our Nikon HCA microscope to visit each of those spots to create 96 files which each contain the 64 multi-channel images. So the script will be used to re-assemble all that info into a very high-information-density Plate in OMERO with 64 (or 81) fields per well. (Let me know if such a file set is useful for you for testing the new spatial view stuff).

Thanks for your other suggestions. I've incorporated both and pushed a new version to github.

I'll be making some changes and fixing some other issues with the script but once done, what is the best way to "publish" it for others to use?

Thanks,
- Damir
dsudar
 
Posts: 235
Joined: Mon May 14, 2012 8:43 pm
Location: Berkeley, CA, USA

Re: creating well w/ multiple fields

Postby wmoore » Mon Nov 07, 2016 10:19 am

Hi Damir,

The problem with adding well-samples to a Well is that once you've saved the Well, it needs to be re-loaded before you can add more well-samples. Also, you'd need to reload it *with* all it's well-samples loaded, which is doable but the extra complexity of this is not needed if you're simply able to add all the well-samples right at the start before you do the first 'Save'.

I'm afraid you're right: the new SPW UI will be released with 5.3.0, currently scheduled for next Feb: https://trello.com/c/xu6PwMaD/157-5-3-0-release

Some "real" sample data of the type you describe would be really useful for the building and testing of this UI. I'll ask someone from the Bio-Formats team to contact you to discuss upload details. Thanks!

We list scripts contributed by collaborators at http://www.openmicroscopy.org/site/community/scripts and it would be great to add yours to that list.

Thanks,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: creating well w/ multiple fields

Postby dsudar » Tue Nov 08, 2016 6:13 pm

Hi Will,

Thanks for the explanation. Yes, now I understand why my first attempt didn't work. Again thanks for taking the time to fix that code.

I'll wait patiently for 5.3 then .... :-)

I received Melissa's message and am uploading a large dataset for your testing.

I made a few more changes to the Dataset_To_Well.py script. It still needs work for better error handling and such but probably good to make it available to the community with the understanding it's a beta at best.

Cheers,
- Damir
dsudar
 
Posts: 235
Joined: Mon May 14, 2012 8:43 pm
Location: Berkeley, CA, USA

Re: creating well w/ multiple fields

Postby wmoore » Wed Nov 09, 2016 10:19 am

Hi Damir,

Thanks for the data upload and details - We'll see how we get on with importing it.

We'll add your script to the list too,

Thanks,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: creating well w/ multiple fields

Postby dsudar » Thu Nov 10, 2016 12:11 am

Hi Will,

Being a bit impatient and because I needed it for my immediate use, I derived another script from your Dataset_To_Plate.py original, called Wells_To_Plate.py (see: https://github.com/dsudar/OMEROscripts/ ... o_Plate.py) which allows you to generate (a) Plate(s) from all the Fields in (a) Well(s). Your spatial view per well functionality is of course the right way to do this but this script may be useful in the interim. No hurry but can you have a quick look at it and if it doesn't violate everything that's sacred in OMERO, make it also available?

There's also a very simple script in that github repo called HCS_Render_Settings.py (https://github.com/dsudar/OMEROscripts/ ... ettings.py) also derived from your examples. It provides a way to apply new rendering settings to all images in a list of Screens or Plates in bulk and has the following options:
1) reset to imported (all others below are then ignored)
2) only change the assigned colors per channel (without changing the min/max
3) turn on/off certain channel's visibility
4) set the min/max from an example image provided
In principle one should be able to apply multiple options simultaneously but there's a bug somewhere that causes some strange behaviour if you try. The routine is also quite slow but some of that may be due to not doing the updateService in the optimal places. Can you proof?

Cheers,
- Damir
dsudar
 
Posts: 235
Joined: Mon May 14, 2012 8:43 pm
Location: Berkeley, CA, USA

Re: creating well w/ multiple fields

Postby wmoore » Thu Nov 10, 2016 3:00 pm

Hi Damir,

Your Wells_to_Plate script seems to work fine for me. Minor suggestions:
There's a couple of 'Dataset' mentions still in the comments and you could remove your ls_00 lookup by using
Code: Select all
# make plate name from well coordinate
plname = "%s%02d" % (ls_abc[well.row], well.column + 1)


I quickly tried your HCS_Render_Settings script and it seemed to work for a simple case.
However, I'm going to refer the optimisation of this to Simon, who has been doing something similar for the IDR work using the command line. E.g.
Code: Select all
$ bin/omero render copy Image:456: Plate:1

Or using a json or yaml file to specify rendering settings to apply.
His code is at https://github.com/openmicroscopy/openm ... /render.py but he's busy with IDR deadlines today, so will be able to give you more details tomorrow.

Regards,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: creating well w/ multiple fields

Postby dsudar » Thu Nov 10, 2016 9:08 pm

Hi Will,

Thanks for the review and suggestions. I implemented those and did some minor cleanup. The version of Wells_To_Plate.py on github (https://github.com/dsudar/OMEROscripts/ ... o_Plate.py) should now be relatively clean.

Simon's Render stuff looks extremely useful and I very much look forward to hearing more about it. I presume this will be in a future version of OMERO?

Cheers,
- Damir
dsudar
 
Posts: 235
Joined: Mon May 14, 2012 8:43 pm
Location: Berkeley, CA, USA

Re: creating well w/ multiple fields

Postby manics » Fri Nov 11, 2016 5:20 pm

Hi Damir

All the IDR work will eventually end up in mainline OMERO. I think the render plugin will work with the latest release though I haven't tested it- if you want to give it a go download https://github.com/openmicroscopy/openm ... /render.py into your
Code: Select all
OMERO.server/lib/python/omero/plugins/
directory.

Since your rendering settings are common to multiple images you could speed things up by updating just one image and copying the settings to all the rest instead of setting each image individually (someone else will have to explain why). For example https://github.com/openmicroscopy/openm ... er.py#L361

Using the render plugin you could run
Code: Select all
bin/omero render copy Image:456: Screen:2
to copy the settings from Image:456 to all Images in Screen:2 in one go, or if you specify your settings in a YAML/json file (example: https://github.com/IDR/idr-metadata/blo ... derdef.yml) you could do everything in one command:
Code: Select all
bin/omero render edit --copy Screen:123 renderdef.yml
User avatar
manics
Team Member
 
Posts: 261
Joined: Mon Oct 08, 2012 11:01 am
Location: Dundee


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest