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

Class DataStatsd

monai/transforms/utility/dictionary.py:798–876  ·  view source on GitHub ↗

Dictionary-based wrapper of :py:class:`monai.transforms.DataStats`.

Source from the content-addressed store, hash-verified

796
797
798class DataStatsd(MapTransform):
799 """
800 Dictionary-based wrapper of :py:class:`monai.transforms.DataStats`.
801 """
802
803 backend = DataStats.backend
804
805 def __init__(
806 self,
807 keys: KeysCollection,
808 prefix: Sequence[str] | str = "Data",
809 data_type: Sequence[bool] | bool = True,
810 data_shape: Sequence[bool] | bool = True,
811 value_range: Sequence[bool] | bool = True,
812 data_value: Sequence[bool] | bool = False,
813 meta_info: Sequence[bool] | bool = False,
814 additional_info: Sequence[Callable] | Callable | None = None,
815 name: str = "DataStats",
816 allow_missing_keys: bool = False,
817 ) -> None:
818 """
819 Args:
820 keys: keys of the corresponding items to be transformed.
821 See also: :py:class:`monai.transforms.compose.MapTransform`
822 prefix: will be printed in format: "{prefix} statistics".
823 it also can be a sequence of string, each element corresponds to a key in ``keys``.
824 data_type: whether to show the type of input data.
825 it also can be a sequence of bool, each element corresponds to a key in ``keys``.
826 data_shape: whether to show the shape of input data.
827 it also can be a sequence of bool, each element corresponds to a key in ``keys``.
828 value_range: whether to show the value range of input data.
829 it also can be a sequence of bool, each element corresponds to a key in ``keys``.
830 data_value: whether to show the raw value of input data.
831 it also can be a sequence of bool, each element corresponds to a key in ``keys``.
832 a typical example is to print some properties of Nifti image: affine, pixdim, etc.
833 meta_info: whether to show the data of MetaTensor.
834 it also can be a sequence of bool, each element corresponds to a key in ``keys``.
835 additional_info: user can define callable function to extract
836 additional info from input data. it also can be a sequence of string, each element
837 corresponds to a key in ``keys``.
838 name: identifier of `logging.logger` to use, defaulting to "DataStats".
839 allow_missing_keys: don't raise exception if key is missing.
840
841 """
842 super().__init__(keys, allow_missing_keys)
843 self.prefix = ensure_tuple_rep(prefix, len(self.keys))
844 self.data_type = ensure_tuple_rep(data_type, len(self.keys))
845 self.data_shape = ensure_tuple_rep(data_shape, len(self.keys))
846 self.value_range = ensure_tuple_rep(value_range, len(self.keys))
847 self.data_value = ensure_tuple_rep(data_value, len(self.keys))
848 self.meta_info = ensure_tuple_rep(meta_info, len(self.keys))
849 self.additional_info = ensure_tuple_rep(additional_info, len(self.keys))
850 self.printer = DataStats(name=name)
851
852 def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
853 d = dict(data)
854 for (
855 key,

Callers 3

test_valuesMethod · 0.90
test_valueMethod · 0.90
test_fileMethod · 0.90

Calls

no outgoing calls

Tested by 3

test_valuesMethod · 0.72
test_valueMethod · 0.72
test_fileMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…