Skip to content

Instantly share code, notes, and snippets.

@NicoKiaru
Last active January 24, 2025 16:21
Show Gist options
  • Save NicoKiaru/177b4656686d574a383c80008841e9cb to your computer and use it in GitHub Desktop.
Save NicoKiaru/177b4656686d574a383c80008841e9cb to your computer and use it in GitHub Desktop.
Open an OMERO dataset into Fiji with caching #BIOP #Fiji
// Open a URL from OMERO with caching into Fiji as an ImagePlus
// Requires PTBIOP and OMERO 5.5 5.6 update site
// Written by Nicolas Chiaruttini on 24th Jan 2025
// Try https://omero-tim.gerbi-gmb.de/webclient/?show=image-104300 with:
// login: read-tim
// passwd: read-tim
#@CommandService cs
#@String(label="omero url") url
#@SourceAndConverterService source_service
// Creates a SpimData object
def sd = cs.run(CreateBdvDatasetOMEROCommand.class, true,
"datasetname", url,
"omero_urls", url,
"unit", "MICROMETER",
"plane_origin_convention", "CENTER").get().getOutput("spimdata")
// Retrieves sources from spimdata
def sources = source_service.getSourceAndConverterFromSpimdata(sd)
// Gets ImagePlus of Dataset highest resolution level, virtual stack with caching at the bdv level, not at the ImagePlus level
def image = cs.run(ExportToMultipleImagePlusCommand.class, true,
"sacs", sources as SourceAndConverter[],
"level", 0,
"range_channels", "",
"range_slices", "",
"range_frames", "",
"export_mode", "Virtual no-cache", // could also be "Virtual"
"monitor", false,
"parallel", false,
"parallel_c", false,
"parallel_z", false,
"parallel_t", false,
"entities_split", "",
"verbose", false).get().getOutput("imps_out")[0]
import ch.epfl.biop.bdv.img.omero.command.CreateBdvDatasetOMEROCommand
import ch.epfl.biop.scijava.command.source.ExportToMultipleImagePlusCommand
import bdv.viewer.SourceAndConverter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment