Page 1 of 1

How to convert metadata ROI info to actual pixels?

PostPosted: Tue Jun 19, 2018 5:31 am
by jmfrank
Hi there - hope this is the right place to ask...

I've recorded some FRAP data using a Zeiss LSM confocal, with a few ROI's in each image. I can successfully read the ROI info in the metadata from the .lsm file in MATLAB using the bfreader / getMetadataStore commands.

ROIs in the OME format are specified by values like x-position / y-position / radius / width / height / polygon points (depending on the ROI shape).

However, I'm looking for a definitive and general method for getting the actual pixels that are part of each ROI. I can write my own script for doing so, but it seems like the Zeiss LSM might be using specific rules about whether a pixel is inside a boundary. I.e. is the real-world xyz coordinate of a pixel defined by it's center or a corner of the pixel.

Is there an existing definition of how OME determines whether pixels are within an ROI? If so, how to I access this definition. Ideally, I'm looking for a solution that would work for using MATLAB, but if I can access the source code to any existing tool that would still be helpful.

Thanks!

Re: How to convert metadata ROI info to actual pixels?

PostPosted: Tue Jun 19, 2018 10:26 am
by mtbc
This is a fine place to ask. The implementations of https://downloads.openmicroscopy.org/la ... tCallback- are probably your best bet; the subclasses' source is all available at https://github.com/openmicroscopy/openmicroscopy in components/blitz/src/ and MATLAB allows relatively easy interoperation with Java.

I don't believe that we formally define how to interpret the abstract ROI model shapes (inclusivity of edges, etc.) but the above smart shape code appears to check if a tiny block at each pixel probably intersects with the shape: for example, a 2-wide 2-high rectangle at (0, 0) is considered to have (0, 0), (1, 0), (0, 1), (1, 1) within it. Be warned that when interchanging ROIs with other tools the interpretation may change, e.g., I wonder how some ImageJ analysis plugins may regard shape edges imported from OMERO.

Cheers,
Mark