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

Class RepeatChanneld

monai/transforms/utility/dictionary.py:291–313  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

289
290
291class RepeatChanneld(MapTransform):
292 """
293 Dictionary-based wrapper of :py:class:`monai.transforms.RepeatChannel`.
294 """
295
296 backend = RepeatChannel.backend
297
298 def __init__(self, keys: KeysCollection, repeats: int, allow_missing_keys: bool = False) -> None:
299 """
300 Args:
301 keys: keys of the corresponding items to be transformed.
302 See also: :py:class:`monai.transforms.compose.MapTransform`
303 repeats: the number of repetitions for each element.
304 allow_missing_keys: don't raise exception if key is missing.
305 """
306 super().__init__(keys, allow_missing_keys)
307 self.repeater = RepeatChannel(repeats)
308
309 def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
310 d = dict(data)
311 for key in self.key_iterator(d):
312 d[key] = self.repeater(d[key])
313 return d
314
315
316class RemoveRepeatedChanneld(MapTransform):

Callers 2

test_shapeMethod · 0.90
test_3d_rgbMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_shapeMethod · 0.72
test_3d_rgbMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…