Scripting omero.figure

Hi @will-moore,

I’m trying to script omero-figure in order to have all timepoints of a time series as individual panels but I’m having issues with a couple of things.

I started looking into this page which seems to be doing what I want but I would like to have the number of columns and rows automatically depending on the size of the first image so I have some questions:

  • how do you read the size of the current PDF ? Because that will play a role in the number of columns. I also saw using the export to JSON menu that you have size and size_in_mm. I have the calculation for the number of columns and lines but not sure about the size of the page.
  • how could I create a new page once this one is full ?

Thanks for your help !

The code for handling the Paper setup form submission (setting widths, heights and counts etc) is

The paper_width and paper_height are the same coordinates as the panels (x, y, width, height). The mm sizes are there to allow user to pick custom paper sizes and to remember what they picked, but they are converted into paper_width and paper_height (see code above).

// To get page size

// To set page count and layout
figureModel.set('page_count', 4)
figureModel.set('page_col_count', 2)

You’ll also need to know that the gaps between pages is 50 figureModel.get('paper_spacing'), so the coordinates of panels on additional pages need to be offset by that amount + size of previous page(s)

Hope that helps,


1 Like