How to get all ImageIDs for a dataset via imagej-omero

Hi again,

sorry to post again here, but I wanted to bump a previous question:

This should maybe be its own thread, but I don’t know how to split a post into a new topic.

Thanks for your help!

(I think only admins/moderators can do that, by clicking on the wrench :wrench: icon and selecting the posts they want to move to the new topic. I just did that for you.)

Instead of first posting and then splitting, you can choose to create a linked topic when replying to a post:

Hi all,

I want to do something similar and as @imagejan posted, the awesome imagej-omero project can be used.

Below code uses imagej-omero in a python script in ImageJ:

#@ OMEROService omeroService
#@ ConvertService convert
#@ UIService ui

from net.imagej.omero import OMEROLocation
from ij import ImagePlus
from ij.plugin import Duplicator


server = "omero.server.address.com"
port = 4064
user = "my-user-name"
password = "my-password"
image_id = my-imageID

omero_location = OMEROLocation(server, port, user, password)
omero_session = omeroService.createSession(omero_location)
client = omero_session.getClient()

dataset = omeroService.downloadImage(client, image_id)
ui.show(dataset)

# convert dataset to ImagePlus if necessary
imp = convert.convert(dataset, ImagePlus)
imp.show()

# duplicate the imp so its no longer virtual
imp2 = Duplicator().run(imp)
imp2.show()

omero_session.close()

Works like a charm with just a few lines, which is really amazing :star_struck:
Without converting to ImagePlus it would be even less lines.

Concerning this, I have some follow-up questions:

  • The dataset opens as “virtual”. How to get a “real” dataset? Converting to ImagePlus and duplicating seems not the best way of doing it.
  • Whats the imagej-omero way to get all ImageIDs from a given dataset?
1 Like

(Sorry for the confusion. @imagejan and I split the posts within a few minutes of one another. Led to interesting behavior. ~Josh)

1 Like

Thanks Jan!

very nice, I did not know this functionality :slight_smile: