ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 31 forks source link

Batch download of .pdfs from Figure #151

Closed jstitlow closed 7 years ago

jstitlow commented 8 years ago

What is the best way to download several Omero.Figure files from the webclient?

-Would like to retrieve them by their given file name rather than the file id number. -Download a single zip containing multiple PDFs -Script can be run from webclient / commandline/ or client-side python, whichever is easiest

Many thanks, J

will-moore commented 8 years ago

The script dialog in the web/insight clients is kinda "dumb" so you'd have to manually enter multiple figure names (see screenshot) and be sure that the names are unique.

screen shot 2016-05-04 at 22 05 12

If this is acceptable, then approximate steps needed would be:

jstitlow commented 8 years ago

The script produced by selecting View Script from Figure to Pdf.py app doesn't reference the file names I entered in the Figure Files category. How are the file names integrated into the script?

My Figure_to_Pdf.py interface looks a bit different:

image

Also the script (attached) includes ShapetoPDF(Object), ShapeToPilExport(object), and TiffExport(FigureExport) classes. Can I get rid of those if I only want to use class FigureExport(object)?

Set createZip to True is straight forward.

Will work out a loop between self.createFigure() and self.saveFigure().

Export_PDFs.txt

will-moore commented 8 years ago

@jstitlow The screenshot above was from a slightly modified script with different parameters... I entered those file names into the UI manually - there's no way to auto-populate them.

    client = scripts.client(
        'Figure_To_Pdf.py',
        """Used by web.figure to generate pdf figures from json data""",

        scripts.String("Figure_JSON", grouping="1",
                       description="All figure info as json stringified"),

        scripts.List("Figure_Files", grouping="2",
                     description="Figure File IDs or Names"),

        scripts.String("Export_Option", values=exportOptions,
                       grouping="3", default="PDF"),

        scripts.String("Figure_Name", grouping="4",
                       description="Name of the Pdf Figure"),

        scripts.String("Webclient_URI", grouping="5",
                       description="webclient URL for adding links to images"),

        scripts.String("Figure_URI", grouping="6",
                       description="URL to the Figure")

You can get files by name like this:

figures = conn.getObjects('OriginalFile', attributes={'name':'myFigureName'})

You might need a more complex query to filter by owner or restrict it to OMERO.figure files etc, but see how you do. You can iterate through files and get the json content like this:

for f in figures:                                                        
    figure_json_string = "".join(f.getFileInChunks())

You'll need ShapeToPDF for any ROI overlays you have. I would also leave the other classes: Keeping your changes minimal should make it easier for you to apply them to any updated script (future releases). It's also possible if other users want this feature that we could merge your changes into OMERO.figure, in which case we'd want to keep support for TIFF export.

It would be much easier to collaborate on this if you were to fork the repo and work on this in your own branch (you could even do this just with the github.com if you don't want git etc on your machine).

will-moore commented 7 years ago

Let us know if you need any more help. Closing this issue....

will-moore commented 6 years ago

See https://trello.com/c/Ugw3YgLz/184-batch-export-figures