We're Hiring!

Problem setting up FIJI to run .py scripts for OMERO

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.

Problem setting up FIJI to run .py scripts for OMERO

Postby jstitlow » Mon Feb 05, 2018 10:13 am

Hello,

Having trouble running a .py batch processing script https://github.com/bramalingam/Omero-Imagej-Scripts/blob/master/omero_batch_analysis.py from the FIJI script interface. Error message below.

Any ideas?
THANKS!

FYI nothing works in the .py script interface, e.g., print("hello"), which makes me suspect the Jy/Python environment is not setup properly. The OMERO and FIJI environments are setup as instructed in Balaji's video. FIJI:OMERO connection is working properly.

Environment:
OMERO 5.3.5-ice36-b73
OSX 10.12.4
FIJI v2.0.0-rc-65/1.51a
Python 2.7 (Anaconda build)
MATLAB R2015a

Error message:
SyntaxError: ("no viable alternative at input 'import'", ('<string>', 1, 0, 'import os\n'))

at org.python.core.ParserFacade.fixParseError(ParserFacade.java:95)
at org.python.core.ParserFacade.parse(ParserFacade.java:205)
at org.python.core.CompileFunction.compile(__builtin__.java:1672)
at org.python.core.CompileFunction.compile(__builtin__.java:1648)
at org.python.core.CompileFunction.compile(__builtin__.java:1640)
at org.python.core.__builtin__.eval(__builtin__.java:492)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:251)
at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:64)
at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
jstitlow
 
Posts: 18
Joined: Sat Feb 03, 2018 9:07 pm

Re: Problem setting up FIJI to run .py scripts for OMERO

Postby bramalingam » Wed Feb 07, 2018 11:38 am

Hi,

Thank you for sharing your issue.

Please go through the following links to explore Fiji-Jython scripting interface and Jython in general,
https://imagej.net/Jython_Scripting
http://imagej.net/Jython_Scripting_Examples

And the following link to read about Jython,
https://wiki.python.org/jython/Document ... dEducation

The workflow has further been simplified in terms of setup,

Setup:

Please try the following simple setup,
Download the OMERO.insight-IJ plugin from the following link,
https://www.openmicroscopy.org/omero/downloads/

And add it to the plugins folder in Fiji.

And then you could try the updated scripts which were demo’d in one of our recent workshops:
https://github.com/jburel/omero-example ... t_batch.py

To Run:
1. Go to File > New > Script (In Fiji)
2. A dialog pops up. In the Language menu select Python
3. Copy the content of the local script omero_bg_subtract_batch.py into the text editor
4. Edit the following parameters: dataset_id, USERNAME, PASSWORD.
5. Click Run
6. The script will process all images in the specified dataset, apply the same processing and create new Images and add them to a new Dataset script_editor_output_from_dataset_$dataset_id where $dataset_id is the identifier of the dataset Fiji-batch
7. Return to the webclient and click the refresh button
8. above the left-hand panel to see the new Dataset.

The above script is an example for a rolling-background subtraction workflow.
But you could potentially fit it to your needs.

Hope that helps.
Please let us know if you have any other issues.

Best,
Balaji
User avatar
bramalingam
 
Posts: 70
Joined: Tue Jan 14, 2014 12:01 pm

Re: Problem setting up FIJI to run .py scripts for OMERO

Postby jstitlow » Wed Feb 07, 2018 6:12 pm

Thanks for this, but my issue is more fundamental. The FIJI script editor isn't interpreting python code, e.g., the templates provided with FIJI also do not work.

Are there dependencies or plugins required to make the script window interpret python code?

Error message from running Greeting.py from Templates > by language > Python

Started Greeting.py at Wed Feb 07 18:09:20 GMT 2018
SyntaxError: ("mismatched input '=' expecting EOF", ('<string>', 9, 9, 'greeting = "Hello, " + name + "!"\n'))

at org.python.core.ParserFacade.fixParseError(ParserFacade.java:95)
at org.python.core.ParserFacade.parse(ParserFacade.java:205)
at org.python.core.CompileFunction.compile(__builtin__.java:1672)
at org.python.core.CompileFunction.compile(__builtin__.java:1648)
at org.python.core.CompileFunction.compile(__builtin__.java:1640)
at org.python.core.__builtin__.eval(__builtin__.java:492)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:251)
at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:64)
at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
jstitlow
 
Posts: 18
Joined: Sat Feb 03, 2018 9:07 pm

Re: Problem setting up FIJI to run .py scripts for OMERO

Postby bramalingam » Thu Feb 08, 2018 8:33 pm

Hi,

The language that is supported via the scripting interface by Fiji is "Jython" and Jython is an implementation of the Python programming language designed to run on the Java platform.

Even though many of the concepts are similar, it requires a bit of a learning curve to get started. Prior knowledge of Python, does help significantly in grasping the concepts of Jython.

The set of links pasted in my previous reply should help get started, and please let us know if you have any questions about expanding the library of methods listed in the script.

Hope that helps.

Best,
Balaji
User avatar
bramalingam
 
Posts: 70
Joined: Tue Jan 14, 2014 12:01 pm


Return to Developer Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron