MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / __init__

Method __init__

monai/data/dataset_summary.py:45–79  ·  view source on GitHub ↗

Args: dataset: dataset from which to load the data. image_key: key name of images (default: ``image``). label_key: key name of labels (default: ``label``). meta_key: explicitly indicate the key of the corresponding metadata dictionary.

(
        self,
        dataset: Dataset,
        image_key: str | None = "image",
        label_key: str | None = "label",
        meta_key: KeysCollection | None = None,
        meta_key_postfix: str = DEFAULT_POST_FIX,
        num_workers: int = 0,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

43 """
44
45 def __init__(
46 self,
47 dataset: Dataset,
48 image_key: str | None = "image",
49 label_key: str | None = "label",
50 meta_key: KeysCollection | None = None,
51 meta_key_postfix: str = DEFAULT_POST_FIX,
52 num_workers: int = 0,
53 **kwargs,
54 ):
55 """
56 Args:
57 dataset: dataset from which to load the data.
58 image_key: key name of images (default: ``image``).
59 label_key: key name of labels (default: ``label``).
60 meta_key: explicitly indicate the key of the corresponding metadata dictionary.
61 for example, for data with key `image`, the metadata by default is in `image_meta_dict`.
62 the metadata is a dictionary object which contains: filename, affine, original_shape, etc.
63 if None, will try to construct meta_keys by `{image_key}_{meta_key_postfix}`.
64 This is not required if `data[image_key]` is a MetaTensor.
65 meta_key_postfix: use `{image_key}_{meta_key_postfix}` to fetch the metadata from dict,
66 the metadata is a dictionary object (default: ``meta_dict``).
67 num_workers: how many subprocesses to use for data loading.
68 ``0`` means that the data will be loaded in the main process (default: ``0``).
69 kwargs: other parameters (except `batch_size` and `num_workers`) for DataLoader,
70 this class forces to use ``batch_size=1``.
71
72 """
73
74 self.data_loader = DataLoader(dataset=dataset, batch_size=1, num_workers=num_workers, **kwargs)
75
76 self.image_key = image_key
77 self.label_key = label_key
78 self.meta_key = meta_key or f"{image_key}_{meta_key_postfix}"
79 self.all_meta_data: list = []
80
81 def collect_meta_data(self):
82 """

Callers

nothing calls this directly

Calls 1

DataLoaderClass · 0.90

Tested by

no test coverage detected