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

Method __call__

monai/transforms/compose.py:604–636  ·  view source on GitHub ↗
(self, input_, start=0, end=None, threading=False, lazy: bool | None = None)

Source from the content-addressed store, hash-verified

602 self.log_stats = log_stats
603
604 def __call__(self, input_, start=0, end=None, threading=False, lazy: bool | None = None):
605 if start != 0:
606 raise ValueError(f"RandomOrder requires 'start' parameter to be 0 (start set to {start})")
607 if end is not None:
608 raise ValueError(f"RandomOrder requires 'end' parameter to be None (end set to {end}")
609
610 if len(self.transforms) == 0:
611 return input_
612
613 num = len(self.transforms)
614 applied_order = self.R.permutation(range(num))
615 _lazy = self._lazy if lazy is None else lazy
616
617 input_ = execute_compose(
618 input_,
619 [self.transforms[ind] for ind in applied_order],
620 start=start,
621 end=end,
622 map_items=self.map_items,
623 unpack_items=self.unpack_items,
624 lazy=_lazy,
625 threading=threading,
626 log_stats=self.log_stats,
627 )
628
629 # if the data is a mapping (dictionary), append the RandomOrder transform to the end
630 if isinstance(input_, monai.data.MetaTensor):
631 self.push_transform(input_, extra_info={"applied_order": applied_order})
632 elif isinstance(input_, Mapping):
633 for key in input_: # dictionary not change size during iteration
634 if isinstance(input_[key], monai.data.MetaTensor):
635 self.push_transform(input_[key], extra_info={"applied_order": applied_order})
636 return input_
637
638 def inverse(self, data):
639 if len(self.transforms) == 0:

Callers

nothing calls this directly

Calls 2

execute_composeFunction · 0.85
push_transformMethod · 0.80

Tested by

no test coverage detected