ome / ome-model

OME model (specification, code generator, implementation)
Other
13 stars 26 forks source link

ome-model: add support for Plane population #122

Closed sbesson closed 4 years ago

sbesson commented 4 years ago

This API addition had driven in the context of idr0065 - see https://github.com/IDR/idr0065-camsund-crispri/blob/master/scripts/generate_companions.py#L146 to populate the Plane metadata using the submitted timestamp/exposure information - see https://idr.openmicroscopy.org/webclient/img_detail/9022301 for instance. As I was trying to re-use the API for idr0092, I realized I never backported the change.

In terms of style, the new Plane object explicitly defines the z/c/t arguments as well as an options dictionary which takes all the optional Plane attributes. A minimal example of consumption of this API is illustrated below:

from ome_model.experimental import Image, create_companion

i = Image("test", 256, 512, 1, 2, 2)
i.add_plane(c=0, z=0, t=0, options={'DeltaT': '0.0'})
i.add_plane(c=0, z=0, t=1, options={'DeltaT': '1.0'})
i.add_plane(c=1, z=0, t=0, options={'DeltaT': '0.1'})
i.add_plane(c=1, z=0, t=1, options={'DeltaT': '1.1'})
create_companion(images=[i], out='planes.companion.ome')

The alternative is to define all these attributes explicitly in the constructor and the Image.add_plane() API. Feedback welcome.

joshmoore commented 4 years ago

:+1: LGTM