Metadata access with omero matlab language bindings fails

Hi all,
I’ve stored an ome.tiff on my local omero server and now I try to read the image’s metadata. I use omero matlab bindings to access the project/dataset/image. I can load a part of metadata, see example:

datasetImages = getImages(session, 'dataset', dataset.getId.getValue);
image=datasetImages(1);

instrument=image.getInstrument()
instrument.getId.getValue
ans = 2

pixels = image.getPrimaryPixels();
pixels.getSizeX().getValue()
ans = 2032

pixels.getPhysicalSizeX
ans = Length(0.325 MICROMETER)

So far it works well. But if I try to get other metadata (the are really stored in the tiff and visible in the web client) I get following errors:

instrument.getMicroscope
Java exception occurred:
omero.UnloadedEntityException: Object unloaded:omero.model.InstrumentI@3bbc47c9

	at omero.model.InstrumentI.errorIfUnloaded(InstrumentI.java:26)

	at omero.model.InstrumentI.getMicroscope(InstrumentI.java:286)

	at omero.model.Instrument.getMicroscope(Instrument.java:275)
	
pixels.getChannel(0)
Java exception occurred:
omero.UnloadedCollectionException: Error updating collection:channelsSeq
Collection is currently null. This can be seen
by testing "channelsSeqLoaded". This implies
that this collection was unloaded. Please refresh this object
in order to update this collection.

	at omero.model.PixelsI.throwNullCollectionException(PixelsI.java:45)

	at omero.model.PixelsI.getChannel(PixelsI.java:1105)

	at omero.model.Pixels.getChannel(Pixels.java:221)

Any ideas what UnloadedEntityException and UnloadedCollectionException mean and how to solve this?
What’s wrong?

Thanks
Michael

Hi Michael

When making the calls, only part of the graph is loaded.
When the exception above are returned, this means that the part of the graph we wish to access is not loaded
To load the channels you can use the loadChannels(session, imageId) method
and to load the instrument information, you will have to use the MetadataService (there is no method “hidden” logic)
i.e. session.getMetadataService().loadInstrument(instrument.getId.getValue)

Hope it helps

Cheers

Jean-marie

Hi Jean-Marie,
many thanks . It works!

Cheers
Michael

Hi, I’ve tried the suggested solution, and it works for the requested tasks. Now I would like to read out some more metadata and I run into new problems. How to access the Lightsource, Detector, Objective, Filterset and some other? Here is what I’ve done and where the UnloadedEntityException occurs:

% Objective
os=image.getObjectiveSettings
os.getMedium -> UnloadedEntityException
os.getObjective -> UnloadedEntityException

% Detector ??? no idea
% Lightsource, Arc ??? no idea


px=image.getPrimaryPixels
px.getDimensionOrder.getValue -> UnloadedEntityException 

% this works:
channels=loadChannels(session, image.getId.getValue)
channel=channels(2)
lchannel=channel.getLogicalChannel
lchannel.getFluor.getValue
lchannel.getContrastMethod.getValue.getValue
lchannel.getIllumination.getValue.getValue
lchannel.getName.getValue
lchannel.getMode.getValue.getValue

% this works not:
filterset=lchannel.getFilterSet
filterset.getModel -> UnloadedEntityException
filterset.getManufacturer -> UnloadedEntityException

Regards
Michael

Hi Michael,

as Jean-Marie said, you could get most of these values via the Instrument object from the MetadataService API, e. g.

instId = image.getInstrument.getId.getValue
inst = session.getMetadataService().loadInstrument(instId)
det = inst.copyDetector.get(0)
det.getModel.getValue

Note: You’d have to access most of the objects via methods like copySomething.get(0) (as they return Java Arraylists).

Kind Regards,
Dominik