Hi Hang,
It's not really easy to see the print statements while the script is running. They are in a temp folder which you'll see created if you follow the Processor-0.log on the server:
- Code: Select all
$ tail -f dist/var/log/Processor-0.log
...
2018-03-30 09:39:39,022 INFO [ omero.processor.ProcessI] (Dummy-13 ) Created 7639a872-b5df-4823-a215-67273586e69c in /Users/wmoore/omero/tmp/omero_wmoore/31276/processBDrApF.dir
But when it completes you will get a stdout file created in OMERO and returned and this has all the print statements.
If you're running the script from the webclient, this is accessible from the (i) icon in the web Activities dialog (see screenshot). If you "bin/omero script launch" from the command line it is returned in the console.
If you have access to the server itself, you can also look for the latest files under the OMERO binary repository Files/ dir.
You can't show an image on screen when the script is running, but there are a couple of ways you can create an image and return it to the user, both of which require saving the image to OMERO:
- Create a new Image in OMERO (and add it to an appropriate Dataset) - see conn.createImageFromNumpySeq() described at
https://docs.openmicroscopy.org/latest/ ... ython.html. An example of creating a new image in this way starting with a PIL image can be seen at
https://github.com/ome/omero-figure/blo ... f.py#L1778 Return this from the OMERO.script using
- Code: Select all
i = conn.createImageFromNumpySeq(....)
client.setOutput("Image", robject(i._obj))
and the webclient UI will show a link to open the image.
- or create a tiff/png as an Original file linked to a File Annotation. See conn.createFileAnnfromLocalFile(file_name, mimetype="image/png") in the Python.html link above. Again, you can return this in the same way:
- Code: Select all
client.setOutput("File_Annotation", robject(file_annotation._obj))
See example at
https://github.com/ome/scripts/blob/dev ... re.py#L803If the file is viewable in the browser (png/jpeg) then the webclient will give you a link to show it in a pop-up window.
Hope that helps.
Will.