monailabel.transform.pre module¶
- class monailabel.transform.pre.LoadImageExd(keys, reader=None, dtype=<class 'numpy.float32'>, meta_keys=None, meta_key_postfix='meta_dict', overwriting=False, image_only=True, ensure_channel_first=False, simple_keys=False, prune_meta_pattern=None, prune_meta_sep='.', allow_missing_keys=False, expanduser=True, *args, **kwargs)[source]¶
Bases:
monai.transforms.io.dictionary.LoadImaged- Parameters
keys (
Union[Collection[Hashable],Hashable]) – keys of the corresponding items to be transformed. See also:monai.transforms.compose.MapTransformreader (
Union[type[ImageReader],str,None]) – reader to load image file and metadata - if reader is None, a default set of SUPPORTED_READERS will be used. - if reader is a string, it’s treated as a class name or dotted path (such as"monai.data.ITKReader"), the supported built-in reader classes are"ITKReader","NibabelReader","NumpyReader". a reader instance will be constructed with the *args and **kwargs parameters. - if reader is a reader class/instance, it will be registered to this loader accordingly.dtype (
Union[dtype,type,str,None]) – if not None, convert the loaded image data to this data type.meta_keys (
Union[Collection[Hashable],Hashable,None]) – explicitly indicate the key to store the corresponding metadata dictionary. the metadata is a dictionary object which contains: filename, original_shape, etc. it can be a sequence of string, map to the keys. if None, will try to construct meta_keys by key_{meta_key_postfix}.meta_key_postfix (
str) – if meta_keys is None, use key_{postfix} to store the metadata of the nifti image, default is meta_dict. The metadata is a dictionary object. For example, load nifti file for image, store the metadata into image_meta_dict.overwriting (
bool) – whether allow overwriting existing metadata of same key. default is False, which will raise exception if encountering existing key.image_only (
bool) – if True return dictionary containing just only the image volumes, otherwise return dictionary containing image data array and header dict per input key.ensure_channel_first (
bool) – if True and loaded both image array and metadata, automatically convert the image array shape to channel first. default to False.simple_keys (
bool) – whether to remove redundant metadata keys, default to False for backward compatibility.prune_meta_pattern (
Optional[str,None]) – combined with prune_meta_sep, a regular expression used to match and prune keys in the metadata (nested dictionary), default to None, no key deletion.prune_meta_sep (
str) – combined with prune_meta_pattern, used to match and prune keys in the metadata (nested dictionary). default is “.”, see alsomonai.transforms.DeleteItemsd. e.g.prune_meta_pattern=".*_code$", prune_meta_sep=" "removes meta keys that ends with"_code".allow_missing_keys (
bool) – don’t raise exception if key is missing.expanduser (
bool) – if True cast filename to Path and call .expanduser on it, otherwise keep filename as is.args – additional parameters for reader if providing a reader name.
kwargs – additional parameters for reader if providing a reader name.