large_image_source_dicom package

Subpackages

Submodules

large_image_source_dicom.dicom_metadata module

large_image_source_dicom.dicom_metadata.extract_dicom_metadata(dataset)[source]
large_image_source_dicom.dicom_metadata.extract_specimen_metadata(dataset)[source]

large_image_source_dicom.dicom_tags module

large_image_source_dicom.dicom_tags.dicom_key_to_tag(key)[source]

large_image_source_dicom.dicomweb_utils module

large_image_source_dicom.dicomweb_utils.get_dicomweb_metadata(client, study_uid, series_uid)[source]
large_image_source_dicom.dicomweb_utils.get_first_wsi_volume_metadata(client, study_uid, series_uid)[source]

large_image_source_dicom.girder_plugin module

class large_image_source_dicom.girder_plugin.DICOMwebPlugin(entrypoint)[source]

Bases: GirderPlugin

CLIENT_SOURCE_PATH = 'web_client'

The path of the plugin’s web client source code. This path is given relative to the python package. This property is used to link the web client source into the staging area while building in development mode. When this value is None it indicates there is no web client component.

DISPLAY_NAME = 'DICOMweb Plugin'

This is the named displayed to users on the plugin page. Unlike the entrypoint name used internally, this name can be an arbitrary string.

load(info)[source]

large_image_source_dicom.girder_source module

class large_image_source_dicom.girder_source.DICOMGirderTileSource(*args, **kwargs)[source]

Bases: DICOMFileTileSource, GirderTileSource

Provides tile access to Girder items with an DICOM file or other files that the dicomreader 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'
levels: int
name = 'dicom'
sizeX: int
sizeY: int
tileHeight: int
tileWidth: int

Module contents

class large_image_source_dicom.DICOMFileTileSource(*args, **kwargs)[source]

Bases: FileTileSource

Provides tile access to dicom files the dicom or dicomreader 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: Dict[str | None, SourcePriority] = {'dcm': SourcePriority.PREFERRED, 'dic': SourcePriority.PREFERRED, 'dicom': SourcePriority.PREFERRED, None: SourcePriority.LOW}
getAssociatedImagesList()[source]

Return a list of 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.

getMetadata()[source]

Return a dictionary of metadata containing levels, sizeX, sizeY, tileWidth, tileHeight, magnification, mm_x, mm_y, and frames.

Returns:

metadata dictionary.

getNativeMagnification()[source]

Get the magnification at a particular level.

Returns:

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

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: Dict[str | None, SourcePriority] = {'application/dicom': SourcePriority.PREFERRED, None: SourcePriority.FALLBACK}
name = 'dicom'
nameMatches: Dict[str, SourcePriority] = {'DCM_\\d+$': SourcePriority.MEDIUM, '\\d+(\\.\\d+){3,20}$': SourcePriority.MEDIUM}
large_image_source_dicom.canRead(*args, **kwargs)[source]

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

large_image_source_dicom.dicom_to_dict(ds, base=None)[source]

Convert a pydicom dataset to a fairly flat python dictionary for purposes of reporting. This is not invertable without extra work.

Parameters:
  • ds – a pydicom dataset.

  • base – a base dataset entry within the dataset.

Returns:

a dictionary of values.

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

Create an instance of the module class.