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

Method __init__

monai/apps/detection/transforms/dictionary.py:803–826  ·  view source on GitHub ↗
(
        self,
        box_keys: KeysCollection,
        label_keys: KeysCollection,
        box_ref_image_keys: KeysCollection,
        remove_empty: bool = True,
        allow_missing_keys: bool = False,
    )

Source from the content-addressed store, hash-verified

801 """
802
803 def __init__(
804 self,
805 box_keys: KeysCollection,
806 label_keys: KeysCollection,
807 box_ref_image_keys: KeysCollection,
808 remove_empty: bool = True,
809 allow_missing_keys: bool = False,
810 ) -> None:
811 box_keys_tuple = ensure_tuple(box_keys)
812 if len(box_keys_tuple) != 1:
813 raise ValueError("Provide a single key for `box_keys`. All `label_keys` are attached to this `box_keys`.")
814 box_ref_image_keys_tuple = ensure_tuple(box_ref_image_keys)
815 if len(box_ref_image_keys_tuple) != 1:
816 raise ValueError(
817 "Provide a single key for `box_ref_image_keys`. "
818 "All `box_keys` and `label_keys` are attached to this `box_ref_image_keys`."
819 )
820
821 self.label_keys = ensure_tuple(label_keys)
822 super().__init__(box_keys_tuple, allow_missing_keys)
823
824 self.box_keys = box_keys_tuple[0]
825 self.box_ref_image_keys = box_ref_image_keys_tuple[0]
826 self.clipper = ClipBoxToImage(remove_empty=remove_empty)
827
828 def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
829 d = dict(data)

Callers

nothing calls this directly

Calls 3

ensure_tupleFunction · 0.90
ClipBoxToImageClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected