def test_value(self, delay_test_time: float): resize = SimulateDelay(delay_time=delay_test_time) start: float = time.time() result = resize(self.imt[0]) stop: float = time.time() measured_approximate: float = stop - start np.testing.assert_allclose(delay_test_time, measured_approximate, rtol=0.5)
def __init__(self, keys: KeysCollection, delay_time=0.0): """ Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` delay_time(float or list of float): The minimum amount of time, in fractions of seconds, to accomplish this identity task. If a list is provided, it must be of length equal to the keys representing the delay for each key element. """ super().__init__(keys) self.delay_time = ensure_tuple_rep(delay_time, len(self.keys)) self.delayer = SimulateDelay()
def __init__(self, keys: KeysCollection, delay_time=0.0): """ Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` delay_time(float or list of float): The minimum amount of time, in fractions of seconds, to accomplish this identity task. It also can be a sequence of string, each element corresponds to a key in ``keys``. """ super().__init__(keys) self.delay_time = ensure_tuple_rep(delay_time, len(self.keys)) self.delayer = SimulateDelay()
def __init__( self, keys: KeysCollection, delay_time: Union[Sequence[float], float] = 0.0, allow_missing_keys: bool = False ) -> None: """ Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` delay_time: The minimum amount of time, in fractions of seconds, to accomplish this identity task. It also can be a sequence of string, each element corresponds to a key in ``keys``. allow_missing_keys: don't raise exception if key is missing. """ super().__init__(keys, allow_missing_keys) self.delay_time = ensure_tuple_rep(delay_time, len(self.keys)) self.delayer = SimulateDelay()
def __init__(self, keys, delay_time=0.0): """ Args: keys (hashable items): keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` delay_time(float or list of float): The minimum amount of time, in fractions of seconds, to accomplish this identity task. If a list is provided, it must be of length equal to the keys representing the delay for each key element. """ super().__init__(keys) if not isinstance(delay_time, (tuple, list)): delay_time = [delay_time] * len(keys) self.converter_dictionary = dict() for key, keyed_default_delay in zip(self.keys, delay_time): self.converter_dictionary[key] = SimulateDelay(delay_time=keyed_default_delay)