peal.data.dataset_generators.FunnyNodulesDatasetGenerator

class peal.data.dataset_generators.FunnyNodulesDatasetGenerator[source]

Bases: object

Generates a PEAL-compatible FunnyNodules dataset.

The FunnyNodules dataset consists of synthetic medical nodule images with six attributes: - roundness (1-5): round to oval - spiculation (1-5): none to marked - edge_sharpness (1-5): sharp to soft - size (1-5): small to big - intensity (1-5): dark to bright - internal_structure (0-1): absent or present

For the PEAL confounding experiment: - True feature (target): internal_structure (binary: 0 or 1) - Confounder: roundness (correlated with internal_structure)

The confounding is controlled by confounder_probability from the data config.

Methods

generate_dataset

Render the nodules and write imgs/, masks/ and data.csv.

__init__(data_config, **kwargs)[source]

Store the data config (dataset_path, num_samples, seed, confounding_factors).

generate_dataset()[source]

Render the nodules and write imgs/, masks/ and data.csv.

Sample i gets binary labels for every name in data_config.confounding_factors (default ["InternalStructure", "Roundness"]) following a big-endian counter over the sample index, so all label combinations are equally frequent. Label 1 maps to a nodule parameter in {4, 5} and label 0 to {1, 2} (internal_structure uses the label directly); the remaining parameters are random. Images are 64x64 grayscale tiled to RGB; data.csv has columns Name plus the factor names.