mednet.data.segment.montgomery

Montgomery database for lung segmentation.

The standard digital image database for Tuberculosis was created by the National Library of Medicine, Maryland, USA in collaboration with Shenzhen No.3 People’s Hospital, Guangdong Medical College, Shenzhen, China. The Chest X-rays are from

  • Database reference: [JCA+14], [GML20]

  • Original resolution (height x width or width x height): 4020x4892 px or 4892x4020 px

Data specifications:

  • Raw data input (on disk):

    • PNG images 8 bit grayscale issued from digital radiography machines

    • Original resolution (height x width or width x height): 4020x4892 px or 4892x4020 px

    • Samples: 138 images and associated labels

  • Output image:

    • Transforms:

      • Load raw PNG with PIL

      • Convert to torch tensor

    • Final specifications

      • image: Grayscale, encoded as a single plane tensor, 32-bit floats, original size.

      • target: A binary mask containing ones where lungs are in the original image, otherwise, zeroes.

      • mask: Binary, with all ones (no specific mask)

This module contains the base declaration of common data modules and raw-data loaders for this database. All configured splits inherit from this definition.

Module Attributes

DATABASE_SLUG

Pythonic name to refer to this database.

CONFIGURATION_KEY_DATADIR

Key to search for in the configuration file for the root directory of this database.

Classes

DataModule(split_path)

Montgomery database for lung segmentation.

RawDataLoader()

A specialized raw-data-loader for the Montgomery dataset.

mednet.data.segment.montgomery.DATABASE_SLUG = 'montgomery'

Pythonic name to refer to this database.

mednet.data.segment.montgomery.CONFIGURATION_KEY_DATADIR = 'datadir.montgomery'

Key to search for in the configuration file for the root directory of this database.

class mednet.data.segment.montgomery.RawDataLoader[source]

Bases: RawDataLoader

A specialized raw-data-loader for the Montgomery dataset.

datadir: Path

This variable contains the base directory where the database raw data is stored.

sample(sample)[source]

Load a single image sample from the disk.

Parameters:

sample (Any) – A tuple containing the path suffix, within the dataset root folder, where to find the image to be loaded, and an integer, representing the sample label.

Return type:

Mapping[str, Any]

Returns:

The sample representation.

target(sample)[source]

Load only sample target from its raw representation.

Parameters:

sample (Any) – A tuple containing the path suffix, within the dataset root folder, where to find the image to be loaded, and an integer, representing the sample target.

Return type:

Tensor

Returns:

The label corresponding to the specified sample, encapsulated as a torch float tensor.

class mednet.data.segment.montgomery.DataModule(split_path)[source]

Bases: CachingDataModule

Montgomery database for lung segmentation.

Parameters:

split_path (Path | Traversable) – Path or traversable (resource) with the JSON split description to load.