BIOP / ijp-operetta-importer

PerkinElmer Operetta Importer using BioFormats!
GNU General Public License v3.0
8 stars 3 forks source link

Support for plate data (whole-well imaging) #18

Closed abhamacher closed 1 year ago

abhamacher commented 1 year ago

Hi,

we highly appreciate the Operetta importer plugin and use it regularly for stitching of tissue images (often in combination with this script from @lacan https://gist.github.com/lacan/cb2eaba47ad001c49b7c232dc6313de9). Interestingly we now have a new use case because some people try to do whole-well imaging with the Operetta. The preview function within Harmony ("well realistic") shows actually a great image (with illumination correction), but as usual it's not possible to export this in original resolution. So I gave it a try with your plugin and the "Export Contiguous Fields.groovy" script from Olivier. The script detects the right amount of captured wells, the field number and the exported files are named with the correct row and column positions. However, all stitched images are basically equal, showing only the first full well in A1. It's the same when using the plugin without the script, then the UI only shows the first well. This is surely related to the structure how tissue images are stored at the Operetta. I was therefore wondering, if an adaption or extension of the plugin would be possible to enable whole-well stitching. Could this be useful also for others? What do you think about it?

Thanks and best regards, Anna

lacan commented 1 year ago

Hi @abhamacher , I amended the script you pointed to, could you please try it out. Basically, it was taking all the fields in the first well to figure out which ones were contiguous outside of the Well loop,. So each well was stitching the same field.

That's it for the script. Could you explain about the UI? It means that it only detects the first well, and not the right amount of wells?

abhamacher commented 1 year ago

Hi Olivier,

thanks for your fast response! COVID hit me, so it took me longer to get back to you. I tested the script and it works fine, thank you! I also re-tested the UI and got it working there, too. This is really great. There is just one issue I have with the script, that I experienced and reported earlier already. I would like to use the "OperettaManager.correction_factor = 0.98" to adjust the overlap a bit, but when I add it to the script, it tells me:

Started Export Contiguous Fields_v3.groovy at Tue Sep 13 10:39:02 CEST 2022
groovy.lang.MissingPropertyException: No such property: correction_factor for class: ch.epfl.biop.operetta.OperettaManager
    at groovy.lang.MetaClassImpl.invokeStaticMissingProperty(MetaClassImpl.java:1013)
    at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2846)
    at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3839)
    at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:217)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:496)
    at Export_Contiguous_Fields_v3.run(Export Contiguous Fields_v3.groovy:12)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
    at org.scijava.plugins.scripting.groovy.GroovyScriptLanguage$1.eval(GroovyScriptLanguage.java:97)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
    at org.scijava.script.ScriptModule.run(ScriptModule.java:164)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:163)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

I can reproduce it on different computers. I updated Fiji this morning and am using the following versions: (Fiji Is Just) ImageJ 2.7.0/1.5.3t; Java 1.8.0_172 [64bit] Operetta Importer 0.1.22

I checked our chat from last year, where I stated that this was already happening with version 0.1.15 but not 0.1.13. You wrote me last year, that you don't have an idea what the problem might be. Do you have any new ideas about that by any chance?

Thanks a lot Anna

NicoKiaru commented 1 year ago

@lacan @abhamacher

Is this issue still relevant ? FYI correction_factor is not a static field, thus OperettaManager.correction_factor will give an error. I also do not see a builder method that gives the possibility to change it. @lacan do you know it this correction factor works in the stitching ? Should we add a builder method that can set it ?

abhamacher commented 1 year ago

Good morning,

for us this is still a topic, because our users do not always use an overlap of 10 %. This correction_factor helped in cases of lower overlap to improve the stitching. In the past months I've recommended your plugin to multiple new microscope users and told them to use 10 % overlap to be on the safe side. However, since lowering the overlap reduced the amount of image data, many users would like to use less overlap. But I haven't been testing myself recently the stitching with datasets with less overlap. In case you are making the correction_factor available again, I'm happy to create some test datasets and do some testing of it.

Thanks, Anna

NicoKiaru commented 1 year ago

@abhamacher in the script, you need to replace:

opm = new OperettaManager.Builder()
                                    .setId( id )
                                    .setSaveFolder(outputDir)
                                    .setProjectionMethod()
                                    .setProjectionMethod( z_projection_method )
                                    .build();

With

opm = new OperettaManager.Builder()
                                    .setId( id )
                                    .setSaveFolder(outputDir)
                                    .setProjectionMethod()
                                    .setProjectionMethod( z_projection_method )
                                                                        .coordinatesCorrectionFactor(the value you need)
                                    .build();
NicoKiaru commented 1 year ago

I'll upload the new version to Fiji PTBIOP update site in a few minutes

NicoKiaru commented 1 year ago

Done