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

Method __call__

monai/transforms/spatial/dictionary.py:2295–2321  ·  view source on GitHub ↗

Args: data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified in this dictionary must be tensor like arrays that are channel first and have at most three spatial dimensions Returns: a diction

(self, data: Mapping[Hashable, torch.Tensor])

Source from the content-addressed store, hash-verified

2293 return self
2294
2295 def __call__(self, data: Mapping[Hashable, torch.Tensor]) -> dict[Hashable, torch.Tensor]:
2296 """
2297 Args:
2298 data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified
2299 in this dictionary must be tensor like arrays that are channel first and have at most
2300 three spatial dimensions
2301
2302 Returns:
2303 a dictionary containing the transformed data, as well as any other data present in the dictionary
2304 """
2305 d = dict(data)
2306 self.randomize(None)
2307 if not self._do_transform:
2308 out: dict[Hashable, torch.Tensor] = convert_to_tensor(d, track_meta=get_track_meta())
2309 return out
2310
2311 first_key: Hashable = self.first_key(d)
2312 if first_key == ():
2313 out = convert_to_tensor(d, track_meta=get_track_meta())
2314 return out
2315 if isinstance(d[first_key], MetaTensor) and d[first_key].pending_operations: # type: ignore
2316 warnings.warn(f"data['{first_key}'] has pending operations, transform may return incorrect results.")
2317 self.rand_grid_distortion.randomize(d[first_key].shape[1:])
2318
2319 for key, mode, padding_mode in self.key_iterator(d, self.mode, self.padding_mode):
2320 d[key] = self.rand_grid_distortion(d[key], mode=mode, padding_mode=padding_mode, randomize=False)
2321 return d
2322
2323
2324class GridSplitd(MapTransform, MultiSampleTrait):

Callers

nothing calls this directly

Calls 5

convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
first_keyMethod · 0.80
key_iteratorMethod · 0.80
randomizeMethod · 0.45

Tested by

no test coverage detected