Image getDataset()
Posted: Thu Mar 20, 2014 3:13 pm
I have an image that is in two datasets. When I call getDataset() on my image object through the python API I receive an error:
This happens because the image is in two datasets. However my code did not expect an error from the API. It just wanted to know the dataset so a new result image could be placed in the same dataset as the parent image.
However what is the expected behaviour of the method in this case? Should it error or return the first valid dataset from a list? Should it be changed to return a list or should there be a getDatasets() method to return a list.
We are using OMERO.server-4.4.10-ice34-b112.
Thanks,
Alex
- Code: Select all
img = conn.getObject('Image',23228)
img.getDataset()
serverExceptionClass = ome.conditions.ApiUsageException
message = Query named:
select ds from Image i join i.datasetLinks dl join dl.parent ds
where i.id = 23228
has returned more than one Object
findBy methods must return a single value.
Please try findAllBy methods for queries which return Lists.
This happens because the image is in two datasets. However my code did not expect an error from the API. It just wanted to know the dataset so a new result image could be placed in the same dataset as the parent image.
However what is the expected behaviour of the method in this case? Should it error or return the first valid dataset from a list? Should it be changed to return a list or should there be a getDatasets() method to return a list.
We are using OMERO.server-4.4.10-ice34-b112.
Thanks,
Alex