large_image_source_openslide package

Submodules

large_image_source_openslide.girder_source module

class large_image_source_openslide.girder_source.OpenslideGirderTileSource(*args, **kwargs)[source]

Bases: OpenslideFileTileSource, GirderTileSource

Provides tile access to Girder items with an SVS file or other files that the openslide library can read.

Initialize the tile class. See the base class for other available parameters.

Parameters

path – a filesystem path for the tile source.

cacheName = 'tilesource'
extensionsWithAdjacentFiles = {'mrxs'}
mimeTypesWithAdjacentFiles = {'image/mirax'}
name = 'openslide'

Name of the tile source

Module contents

class large_image_source_openslide.OpenslideFileTileSource(*args, **kwargs)[source]

Bases: FileTileSource

Provides tile access to SVS files and other files the openslide library can read.

Initialize the tile class. See the base class for other available parameters.

Parameters

path – a filesystem path for the tile source.

cacheName = 'tilesource'
extensions = {None: 4, 'bif': 5, 'mrxs': 1, 'ndpi': 1, 'scn': 5, 'svs': 1, 'svslide': 1, 'tif': 4, 'tiff': 4, 'vms': 3, 'vmu': 3}

A dictionary of known file extensions and the SourcePriority given to each. It must contain a None key with a priority for the tile source when the extension does not match.

getAssociatedImagesList()[source]

Get a list of all associated images.

Returns

the list of image keys.

getInternalMetadata(**kwargs)[source]

Return additional known metadata about the tile source. Data returned from this method is not guaranteed to be in any particular format or have specific values.

Returns

a dictionary of data or None.

getNativeMagnification()[source]

Get the magnification at a particular level.

Returns

magnification, width of a pixel in mm, height of a pixel in mm.

getPreferredLevel(level)[source]

Given a desired level (0 is minimum resolution, self.levels - 1 is max resolution), return the level that contains actual data that is no lower resolution.

Parameters

level – desired level

Returns level

a level with actual data that is no lower resolution.

getTile(x, y, z, pilImageAllowed=False, numpyAllowed=False, **kwargs)[source]

Get a tile from a tile source, returning it as an binary image, a PIL image, or a numpy array.

Parameters
  • x – the 0-based x position of the tile on the specified z level. 0 is left.

  • y – the 0-based y position of the tile on the specified z level. 0 is top.

  • z – the z level of the tile. May range from [0, self.levels], where 0 is the lowest resolution, single tile for the whole source.

  • pilImageAllowed – True if a PIL image may be returned.

  • numpyAllowed – True if a numpy image may be returned. ‘always’ to return a numpy array.

  • sparseFallback – if False and a tile doesn’t exist, raise an error. If True, check if a lower resolution tile exists, and, if so, interpolate the needed data for this tile.

  • frame – the frame number within the tile source. None is the same as 0 for multi-frame sources.

Returns

either a numpy array, a PIL image, or a memory object with an image file.

mimeTypes = {None: 8, 'image/mirax': 1, 'image/tiff': 4, 'image/x-tiff': 4}

A dictionary of common mime-types handled by the source and the SourcePriority given to each. This are used in place of or in additional to extensions.

name = 'openslidefile'

Name of the tile source

large_image_source_openslide.canRead(*args, **kwargs)[source]

Check if an input can be read by the module class.

large_image_source_openslide.open(*args, **kwargs)[source]

Create an instance of the module class.