Example Data

image_list = [TensorDicom3D.create(fn) for fn in Path('../data/series/').ls()]
mask_list = [TensorMask3D.create(fn) for fn in Path('../data/masks/').ls()]

Helper functions

Basic Viewer

class BasicViewer[source]

BasicViewer(x:TensorDicom3D, y=None, prediction:str=None, description:str=None, figsize=(3, 3), cmap:str='bone')

Base class for viewing TensorDicom3D objects.
Arguments:
    x (TensorDicom3D): an TensorDicom3D object to view
    y (TensorMask3D, str): either a segmentations mask as TensorMask3D or a label as str.
    prediction: a class predicton as str
plot = BasicViewer(image_list[0], y=mask_list[0], prediction='Covid', figsize = (5,5))
plot.show()

Dicom Explorer

class DicomExplorer[source]

DicomExplorer(x:TensorDicom3D, y=None, prediction:str=None, description:str=None, figsize=(3, 3), cmap:str='bone') :: BasicViewer

DICOM viewer for basic image analysis inside iPython notebooks.
Can display a single 3D volume together with a segmentation mask, a histogram
of voxel/pixel values and some summary statistics.
Allows simple windowing by clipping the pixel/voxel values to a region, which
can be manually specified.
plot = DicomExplorer(image_list[4], y=mask_list[4], figsize = (5,5))
plot.show()

List Viewer Class

class ListViewer[source]

ListViewer(x:(<class 'list'>, <class 'tuple'>), y=None, prediction:str=None, description:str=None, figsize=(4, 4), cmap:str='bone', max_n=9)

Display multipple Images with their masks or labels/predictions.
Arguments:
    x (tuple, list): TensorDicom3D objects to view
    y (tuple, list): TensorMask3D objects (in case of segmentation task) or class labels as string.
    predictions (str): Class predictions
    cmap: colormap for display of `x`
    max_n: maximum number of items to display
plot = ListViewer(image_list, y=['Covid', 'Covid', 'Covid', 'Covid', 'Covid'], prediction=['Covid', 'Covid', 'Covid', 'No Covid', 'No Covid'])
plot.show()