Large mask ROI on large image

Hi OME team,

In order to show object classifications after analysis I am generating a single mask ROI for each of the identified classes. These ROIs are the same size as the image so they show as an overlay that can be easily turned on and off using iviewer with a single click. However, this works fine for images (and thus mask ROIs) up to about 3000 by 3000 pixels but when the image (and ROI) is larger I get no error but the mask does not display in iviewer or in the old-style viewer. The ROI shows up in the list and its border high-lights when selected and the “Show” checkbox appears to work but the mask ROI itself does not show in the display.

For generating the mask ROIs from my classification masks, I’m using a modified version of the example Python code on: https://github.com/ome/openmicroscopy/blob/v5.5.1/examples/Training/python/ROIs.py

Is there a built-in limit that silently stops large mask ROIs from appearing? If so, can that limit be increased?

Thanks,
Damir

Hi Damir,

There’s no fixed limit that I’m aware of.
I just tried this and was able to view a mask of 3700 x 3700 pixels, but it took a long time to render the mask (50 secs on my local server). It’s possible that you’re getting a web server timeout (1 minute?).

You could try to view the browser dev tools (Network tab, looking for images) to see if there’s any URLs failing to load. Or try to load the mask directly at ```/webgateway/render_shape_mask/1308/```` using the Shape ID, which you can see in the tooltip of the ROI table.

If it is a case of timeout, then you may be able to extend the timeout a bit or it might need a deeper investigation on how to speed up the mask generation.

Regards,
Will.

Hi @will-moore
Thanks for looking into this. It is indeed related to a timeout. After 60059 ms it stops with a 504 error on rendering the masks. I tried increasing the omero.web.wsgi_timeout config setting to 240 and restarted OMERO.web but that didn’t change things. Is there a different timeout setting that governs this?

But I do indeed think that it would be necessary to have significantly faster mask rendering generation for this to be practical. Or maybe there is a better approach? At first I tried using individual masks per object but for large images this was also very slow. Also, (as I found when using Polygon shapes or Point shapes) even when grouped into a single ROI, there is no way in iviewer to Show/NotShow an entire ROI ; you have to turn on and off individual shapes in a ROI.

Thanks,
Damir

Check your Nginx timeout(s), e.g. proxy_read_timeout (default 60s)

Thanks @manics. That indeed extended the timeout so the mask generation and display could complete. But it takes ~3 minutes for one of my typical images so back to the drawing board for a different solution. No end user will put up with that delay.
Once the mask has been created and rendered once, it will turn on/off instantly with the Show checkbox so maybe this type of mask creation can happen off-line and be cached?
Thanks,
Damir

1 Like

Hi Damir,
I’ve created a ticket to support the showing/hiding of all shapes in an ROI in one go. https://trello.com/c/DtbhtoAA/81-show-hide-all-shapes-in-an-roi
I don’t suppose it’s possible to represent your Masks as Polygons? That would improve storage and loading speeds.
I assume the caching you’re seeing is happening in your browser once you’ve loaded it. So that would make it tricky to populate the cache off-line. It’s possible that you can (or have already) set-up some web-server caching of masks, in which case you could use some script to populate that, as I believe we do for IDR (for rendered planes, thumbnails etc).
Regards,

Will.

Hi Will,
Thanks for getting that very useful feature request into the queue. In my current workflow I have typically 10k-20k objects (cells in a tissue) grouped into 10-20 classification groups.

Yes, I was indeed working to make the masks into Polygons and it’d definitely possible. However, as an intermediary step I created just Point shapes at the center-of-gravity of each object and then found that even when grouping multiples of those into a single ROI, I couldn’t turn then on/off as a group. So assuming the same was true for Polygons, I then abandoned that approach and attempted this one whole image-sized mask (encompassing all objects in the group) for each group. Once the ticket has made it to release, I’ll definitely re-visit the Polygon approach.

I’ll definitely look into the caching at the web server option. I presume Simon is the expert on that? I’ll look through the IDR deployment documentation.

Cheers,
Damir

Hi Damir,

a good starting point is likely proxy-hosts.yml. The choice of timeout is of course critical: long enough to reduce overhead but not so long that changes are missed by users.

We opted to add a “cachebuster” port which allows to force a refresh of a given URL.

Cheers,
~Josh