Ejemplo n.º 1
0
def get_omero_metadata(image: ImageWrapper) -> Dict:
    """Get metadata from OMERO as a Dict to pass to napari."""
    channels = image.getChannels()

    colors = []
    for ch in channels:
        # use current rendering settings from OMERO
        color = ch.getColor().getRGB()
        color = [r / 256 for r in color]
        colors.append(Colormap([[0, 0, 0], color]))

    contrast_limits = [[ch.getWindowStart(),
                        ch.getWindowEnd()] for ch in channels]

    visibles = [ch.isActive() for ch in channels]
    names = [ch.getLabel() for ch in channels]

    scale = None
    # Setting z-scale causes issues with Z-slider.
    # See https://github.com/tlambert03/napari-omero/pull/15
    # if image.getSizeZ() > 1:
    #     size_x = image.getPixelSizeX()
    #     size_z = image.getPixelSizeZ()
    #     if size_x is not None and size_z is not None:
    #         scale = [1, size_z / size_x, 1, 1]

    return {
        'channel_axis': 1,
        'colormap': colors,
        'contrast_limits': contrast_limits,
        'name': names,
        'visible': visibles,
        'scale': scale,
    }
Ejemplo n.º 2
0
def load_image_wrapper(image: ImageWrapper) -> List[LayerData]:
    return [
        load_omero_channel(image, channel, c)
        for c, channel in enumerate(image.getChannels())
    ]