Omero python API. How to get metadata for Image ID?

I need to retrieve the image with a full meta-data from the Omero-server trough python API. I can retrieve the image itself (code below), but I cannot find in the documentation how to get file meta-data. Specifically, I need exposure from metadata. Could you?

conn = BlitzGateway(input("Username: "),getpass("OMERO Password: "),host=HOST, secure=True)
image_id =41974
image = conn.getObject(“Image”, image_id)
print(image.getName(), image.getDescription())
print(“Z={},Chanells={} Frames={}”.format(image.getSizeZ(),image.getSizeC(),image.getSizeT()))

Thank you

Thank you!


You can get the exposure for a particular Z and T plane like this:

for theC in range(image.getSizeC()):
    # You can filter by C/Z/T here, to get a particular plane
    planeInfo = image.getPrimaryPixels().copyPlaneInfo(theC=theC, theZ=0, theT=0)

    for pi in planeInfo:
        deltaT = pi.getDeltaT(units="SECOND")
        exposure = pi.getExposureTime(units="SECOND")
        if deltaT is not None:
            print('deltaT secs', deltaT.getValue())
        if exposure is not None:
            print('exposure secs', exposure.getValue())

You can find other metadata example code used by the webclient def load_metadata_acquisition() at omero-web/ at c7eb75fd6b65edd2ffa3556bf8ba178c348e04d0 · ome/omero-web · GitHub



1 Like

Thanks! It is working great.

1 Like