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

Method __init__

monai/transforms/post/dictionary.py:352–373  ·  view source on GitHub ↗

Initialize the connectivity and limit the labels for which holes are filled. Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` applied_labels (Optional[Union[Iterable[in

(
        self,
        keys: KeysCollection,
        applied_labels: Iterable[int] | int | None = None,
        connectivity: int | None = None,
        allow_missing_keys: bool = False,
    )

Source from the content-addressed store, hash-verified

350 backend = FillHoles.backend
351
352 def __init__(
353 self,
354 keys: KeysCollection,
355 applied_labels: Iterable[int] | int | None = None,
356 connectivity: int | None = None,
357 allow_missing_keys: bool = False,
358 ) -> None:
359 """
360 Initialize the connectivity and limit the labels for which holes are filled.
361
362 Args:
363 keys: keys of the corresponding items to be transformed.
364 See also: :py:class:`monai.transforms.compose.MapTransform`
365 applied_labels (Optional[Union[Iterable[int], int]], optional): Labels for which to fill holes. Defaults to None,
366 that is filling holes for all labels.
367 connectivity (int, optional): Maximum number of orthogonal hops to consider a pixel/voxel as a neighbor.
368 Accepted values are ranging from 1 to input.ndim. Defaults to a full
369 connectivity of ``input.ndim``.
370 allow_missing_keys: don't raise exception if key is missing.
371 """
372 super().__init__(keys, allow_missing_keys)
373 self.converter = FillHoles(applied_labels=applied_labels, connectivity=connectivity)
374
375 def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
376 d = dict(data)

Callers

nothing calls this directly

Calls 2

FillHolesClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected