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

Method __call__

monai/transforms/transform.py:278–300  ·  view source on GitHub ↗

``data`` is an element which often comes from an iteration over an iterable, such as :py:class:`torch.utils.data.Dataset`. This method should return an updated version of ``data``. To simplify the input validations, most of the transforms assume that - ``dat

(self, data: Any)

Source from the content-addressed store, hash-verified

276
277 @abstractmethod
278 def __call__(self, data: Any):
279 """
280 ``data`` is an element which often comes from an iteration over an
281 iterable, such as :py:class:`torch.utils.data.Dataset`. This method should
282 return an updated version of ``data``.
283 To simplify the input validations, most of the transforms assume that
284
285 - ``data`` is a Numpy ndarray, PyTorch Tensor or string,
286 - the data shape can be:
287
288 #. string data without shape, `LoadImage` transform expects file paths,
289 #. most of the pre-/post-processing transforms expect: ``(num_channels, spatial_dim_1[, spatial_dim_2, ...])``,
290 except for example: `AddChannel` expects (spatial_dim_1[, spatial_dim_2, ...])
291
292 - the channel dimension is often not omitted even if number of channels is one.
293
294 This method can optionally take additional arguments to help execute transformation operation.
295
296 Raises:
297 NotImplementedError: When the subclass does not override this method.
298
299 """
300 raise NotImplementedError(f"Subclass {self.__class__.__name__} must implement this method.")
301
302
303class LazyTransform(Transform, LazyTrait):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected