MCPcopy Index your code

hub / github.com/Project-MONAI/MONAI / functions

Functions7,906 in github.com/Project-MONAI/MONAI

↓ 1,740 callersMethodappend
Add samples to the local cumulative buffers. A buffer will be allocated for each `data` item. Compared with `self.extend`, th
monai/metrics/metric.py:227
↓ 1,089 callersMethodarray
Returns a numpy array of ``self``. The array and ``self`` shares the same underlying storage if self is on cpu. Changes to ``self`` (
monai/data/meta_tensor.py:395
↓ 840 callersFunctionassert_allclose
Assert that types and all values of two data objects are close. Args: actual: Pytorch Tensor or numpy array for comparison.
tests/test_utils.py:123
↓ 596 callersFunctionoptional_import
Imports an optional module specified by `module` string. Any importing related exceptions will be stored, and exceptions raise lazily whe
monai/utils/module.py:317
↓ 436 callersMethodget
Get the config by id. Args: id: id to specify the expected position. See also :py:meth:`__getitem__`. defaul
monai/bundle/config_parser.py:398
↓ 324 callersMethodastype
Cast to ``dtype``, sharing data whenever possible. Args: dtype: dtypes such as np.float32, torch.float, "np.float32", fl
monai/data/meta_tensor.py:434
↓ 257 callersFunctionconvert_to_tensor
Utility to convert the input data to a PyTorch Tensor, if `track_meta` is True, the output will be a `MetaTensor`, otherwise, the output will
monai/utils/type_conversion.py:113
↓ 240 callersMethodas_tensor
Return the `MetaTensor` as a `torch.Tensor`. It is OS dependent as to whether this will be a deep copy or not.
monai/data/meta_tensor.py:349
↓ 239 callersFunctionensure_tuple
Returns a tuple of `vals`. Args: vals: input data to convert to a tuple. wrap_array: if `True`, treat the input numerical ar
monai/utils/misc.py:166
↓ 234 callersFunctionensure_tuple_rep
Returns a copy of `tup` with `dim` values by either shortened or duplicated input. Raises: ValueError: When ``tup`` is a sequence an
monai/utils/misc.py:194
↓ 234 callersMethodkey_iterator
Iterate across keys and optionally extra iterables. If key is missing, exception is raised if `allow_missing_keys==False` (default).
monai/transforms/transform.py:468
↓ 226 callersMethodpop
(self, data)
tests/transforms/inverse/test_traceable_transform.py:25
↓ 208 callersFunctioneval_mode
Set network(s) to eval mode and then return to original state at the end. Args: nets: Input network(s) Examples .. code-bl
monai/networks/utils.py:458
↓ 183 callersMethodinfo
Returns: dataset info dictionary.
monai/data/dataset.py:713
↓ 180 callersFunctionset_determinism
Set random seed for modules to enable or disable deterministic training. Args: seed: the random seed to use, default is np.iinfo(np.
monai/utils/misc.py:339
↓ 178 callersMethodupdate
Set the ``id`` and the corresponding config content in pairs, see also :py:meth:`__setitem__`. For example, ``parser.update({"train::
monai/bundle/config_parser.py:434
↓ 158 callersFunctionget_track_meta
Return the boolean as to whether metadata is tracked. If `True`, metadata will be associated its data by using subclasses of `MetaObj`. If `F
monai/data/meta_obj.py:47
↓ 157 callersMethodsave
Save data into the cache dictionary. The metadata should have the following key: - ``'filename_or_obj'`` -- save the data corresponding to
monai/data/csv_saver.py:85
↓ 154 callersFunctionmax
`torch.max` with equivalent implementation for numpy Args: x: array/tensor. Returns: the maximum of x.
monai/transforms/utils_pytorch_numpy_unification.py:461
↓ 153 callersFunctionconvert_to_dst_type
Convert source data to the same data type and device as the destination data. If `dst` is an instance of `torch.Tensor` or its subclass, conv
monai/utils/type_conversion.py:355
↓ 143 callersFunctionconvert_data_type
Convert to `MetaTensor`, `torch.Tensor` or `np.ndarray` from `MetaTensor`, `torch.Tensor`, `np.ndarray`, `float`, `int`, etc. Args:
monai/utils/type_conversion.py:286
↓ 143 callersFunctioncreate_transform_im
Create an image with the before and after of the transform. Also update the transform's documentation to point to this image.
monai/transforms/utils_create_transform_ims.py:413
↓ 130 callersFunctionmin
`torch.min` with equivalent implementation for numpy Args: x: array/tensor. Returns: the minimum of x.
monai/transforms/utils_pytorch_numpy_unification.py:528
↓ 117 callersMethodset_random_state
(self, seed: int | None = None, state: np.random.RandomState | None = None)
monai/transforms/compose.py:287
↓ 117 callersMethodsplit
(x)
tests/transforms/compose/test_compose.py:784
↓ 114 callersMethodload
(module, prefix="")
monai/networks/nets/transchex.py:96
↓ 112 callersFunctionlook_up_option
Look up the option in the supported collection and return the matched item. Raise a value error possibly with a guess of the closest match.
monai/utils/module.py:62
↓ 98 callersMethodrun
(self)
tests/integration/test_integration_bundle_run.py:45
↓ 84 callersMethodclone
Returns a copy of the MetaTensor instance. Args: kwargs: additional keyword arguments to `torch.clone`. See als
monai/data/meta_tensor.py:520
↓ 78 callersMethodextend
Extend the local buffers with new ("batch-first") data. A buffer will be allocated for each `data` item. Compared with `self.
monai/metrics/metric.py:203
↓ 78 callersMethodflatten
(self)
monai/transforms/compose.py:492
↓ 77 callersMethodmeta
(key: str | None = None)
monai/utils/enums.py:384
↓ 77 callersMethodstate_dict
Return state for serialization. Subclasses should override this method to return a dictionary of attributes that need to be
monai/auto3dseg/algo_gen.py:47
↓ 67 callersMethodpeek_pending_shape
Get the currently expected spatial shape as if all the pending operations are executed. For tensors that have more than 3 spatial dim
monai/data/meta_tensor.py:480
↓ 67 callersFunctionskip_if_downloading_fails
Skips a test if downloading something raises an exception recognised to indicate a download has failed.
tests/test_utils.py:167
↓ 67 callersFunctiontest_script_save
Test the ability to save `net` as a Torchscript object, reload it, and apply inference. The value `inputs` is forward-passed through the orig
tests/test_utils.py:787
↓ 62 callersMethodwrite
Create an ITK object from ``self.create_backend_obj(self.obj, ...)`` and call ``itk.imwrite``. Args: filename: filename
monai/data/image_writer.py:451
↓ 61 callersFunctiondecollate_batch
De-collate a batch of data (for example, as produced by a `DataLoader`). Returns a list of structures with the original tensor's 0-th dimension s
monai/data/utils.py:538
↓ 61 callersMethodget_parsed_content
Get the parsed result of ``ConfigItem`` with the specified ``id``. - If the item is ``ConfigComponent`` and ``instantiate=True``
monai/bundle/config_parser.py:473
↓ 60 callersFunctionset_track_meta
Boolean to set whether metadata is tracked. If `True`, metadata will be associated its data by using subclasses of `MetaObj`. If `False`, the
monai/data/meta_obj.py:30
↓ 60 callersFunctiontesting_data_config
get _test_data_config[keys0][keys1]...[keysN]
tests/test_utils.py:90
↓ 59 callersMethodpop_transform
Return and pop the most recent transform. Args: data: dictionary of data or `MetaTensor` key: if data is a d
monai/transforms/inverse.py:386
↓ 59 callersFunctiontest_resampler_lazy
This test function is used to test the consistency between non-lazy and lazy transforms. Args: resampler: instance of a resampling tr
tests/lazy_transforms_utils.py:34
↓ 53 callersFunctionconvert_to_numpy
Utility to convert the input data to a numpy array. If passing a dictionary, list or tuple, recursively check every item and convert it to nu
monai/utils/type_conversion.py:196
↓ 50 callersMethod__init__
( self, keys: KeysCollection, spatial_axis: Sequence[int] | int | None = None,
monai/transforms/spatial/dictionary.py:1523
↓ 50 callersMethodattach
(self, engine)
tests/integration/test_integration_workflows.py:121
↓ 49 callersMethodload_state_dict
Restore state from a dictionary. Subclasses should override this method to restore their state from the dictionary returned
monai/auto3dseg/algo_gen.py:60
↓ 49 callersMethodpush_transform
Push to a stack of applied transforms of ``data``. Args: data: dictionary of data or `MetaTensor`. args: add
monai/transforms/inverse.py:132
↓ 48 callersMethod__init__
(self, keys: KeysCollection, alpha: float = 0.5, allow_missing_keys: bool = False)
monai/transforms/intensity/dictionary.py:1535
↓ 48 callersFunctionget_norm_layer
Create a normalization layer instance. For example, to create normalization layers: .. code-block:: python from monai.networks
monai/networks/layers/utils.py:22
↓ 44 callersMethod__init__
Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapT
monai/transforms/utility/dictionary.py:619
↓ 44 callersMethodexport_config_file
Export the config content to the specified file path (currently support JSON and YAML files). Args: config: source confi
monai/bundle/config_parser.py:641
↓ 43 callersMethodclose
Close the read environment and set it to None, if it exists.
monai/data/dataset.py:726
↓ 43 callersMethodrandomize
(self, img_size: Sequence[int])
monai/transforms/intensity/array.py:807
↓ 41 callersFunctiontest_local_inversion
test that invertible_xform can bring to_invert back to im
tests/test_utils.py:858
↓ 40 callersMethodadd
Store the object `value` under the name `name` with description `desc`.
monai/utils/component_store.py:63
↓ 40 callersFunctiondict_product
Create cartesian product, equivalent to a nested for-loop, combinations of the items dict. Args: items: dict of items to be combined.
tests/test_utils.py:916
↓ 39 callersFunction_dict_append
(in_dict, key, fn)
monai/config/deviceconfig.py:120
↓ 38 callersMethodcheck
( self, out: torch.Tensor, orig: torch.Tensor, *, shape: bool = True,
tests/data/meta_tensor/test_meta_tensor.py:80
↓ 38 callersFunctionsliding_window_inference
Sliding window inference on `inputs` with `predictor`. The outputs of `predictor` could be a tensor, a tuple, or a dictionary of tensors.
monai/inferers/utils.py:42
↓ 37 callersMethodbackward
(ctx, grad_output)
monai/networks/layers/gmm.py:87
↓ 37 callersFunctionfall_back_tuple
Refine `user_provided` according to the `default`, and returns as a validated tuple. The validation is done for each element in `user_provid
monai/utils/misc.py:260
↓ 37 callersFunctionget_act_layer
Create an activation layer instance. For example, to create activation layers: .. code-block:: python from monai.networks.laye
monai/networks/layers/utils.py:53
↓ 35 callersMethodcopy_meta_from
Copy metadata from a `MetaObj` or an iterable of `MetaObj` instances. Args: input_objs: list of `MetaObj` to copy data f
monai/data/meta_obj.py:118
↓ 35 callersFunctionfrom_engine
Utility function to simplify the `batch_transform` or `output_transform` args of ignite components when handling dictionary or list of dictio
monai/handlers/utils.py:170
↓ 34 callersFunctionapply_pending
This method applies pending transforms to `data` tensors. Currently, only 2d and 3d inputs are supported. This method is designed to be
monai/transforms/lazy/functional.py:197
↓ 34 callersFunctionget_equivalent_dtype
Convert to the `dtype` that corresponds to `data_type`. The input dtype can also be a string. e.g., `"float32"` becomes `torch.float32` or `n
monai/utils/type_conversion.py:67
↓ 34 callersMethodstep
Performs a single optimization step. Arguments: closure: A closure that reevaluates the model and returns the loss. Defaults to `
monai/optimizers/novograd.py:73
↓ 33 callersMethodforward
(self, x)
tests/networks/utils/test_copy_model_state.py:31
↓ 32 callersMethodpeek_pending_affine
(self)
monai/data/meta_tensor.py:491
↓ 31 callersFunctionget_spatial_dims
Get spatial dimension for the giving setting and check the validity of them. Missing input is allowed. But at least one of the input value sh
monai/data/box_utils.py:365
↓ 30 callersFunctioncreate_test_image_2d
Return a noisy 2D image with `num_objs` circles and a 2D mask image. The maximum and minimum radii of the circles are given as `rad_max` and
monai/data/synthetic.py:21
↓ 30 callersFunctiontest_assert
(func, params, expected)
tests/transforms/test_create_grid_and_affine.py:160
↓ 29 callersMethod__init__
(self, spatial_axis: Sequence[int] | int | None = None, lazy: bool = False)
monai/transforms/spatial/array.py:728
↓ 29 callersFunctionsum
`torch.sum` with equivalent implementation for numpy Args: x: array/tensor. Returns: the sum of x.
monai/transforms/utils_pytorch_numpy_unification.py:572
↓ 28 callersFunctionget_package_version
Try to load package and get version. If not found, return `default`.
monai/utils/module.py:493
↓ 28 callersMethodset_random_state
(self, seed: int | None = None, state: np.random.RandomState | None = None)
monai/transforms/intensity/dictionary.py:767
↓ 28 callersFunctionto_affine_nd
Using elements from affine, to create a new affine matrix by assigning the rotation/zoom/scaling matrix and the translation vector. When
monai/data/utils.py:913
↓ 27 callersFunctioncommand_line_tests
(cmd, copy_env=True)
tests/test_utils.py:873
↓ 27 callersMethodread
Read whole slide image objects from given file or list of files. Args: data: file name or a list of file names to read.
monai/data/wsi_reader.py:725
↓ 27 callersFunctionrotate
Functional implementation of rotate. This function operates eagerly or lazily according to ``lazy`` (default ``False``). Args:
monai/transforms/spatial/functional.py:385
↓ 26 callersFunctioncompute_embedding_collapse
Functional form of :class:`EmbeddingCollapseMetric`. Computes a suite of representational collapse indicators from embeddings and optional cl
monai/metrics/embedding_collapse.py:129
↓ 26 callersFunctioncreate_test_image_3d
Return a noisy 3D image and segmentation. Args: height: height of the image. The value should be larger than `2 * rad_max`.
monai/data/synthetic.py:97
↓ 25 callersMethodcompute
(a, b, func=lambda x, y: x + y)
tests/bundle/test_config_parser.py:78
↓ 25 callersMethodget_buffer
Get the synchronized list of buffers. A typical usage is to generate the metrics report based on the raw metric details. Each
monai/metrics/metric.py:282
↓ 25 callersMethodremove
(self, filename: str)
monai/handlers/checkpoint_saver.py:140
↓ 24 callersMethoddebug
()
monai/utils/misc.py:536
↓ 24 callersFunctiondownload_url
Download file from specified URL link, support process bar and hash check. Args: url: source URL link to download file. file
monai/apps/utils.py:191
↓ 24 callersMethodget_im
(shape=None, dtype=None, device=None)
tests/data/meta_tensor/test_meta_tensor.py:52
↓ 24 callersMethodget_report_format
Get the report format by resolving the registered operations recursively. Returns: a dictionary with {keys: None} pairs.
monai/auto3dseg/analyzer.py:119
↓ 24 callersMethodset_timesteps
Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference. Args: num_infe
monai/networks/schedulers/ddpm.py:108
↓ 23 callersMethodread_config
Read the config from specified JSON/YAML file or a dictionary and override the config content in the `self.config` dictionary.
monai/bundle/config_parser.py:514
↓ 23 callersMethodtrain
Read training/validation data and output a model.
monai/auto3dseg/algo_gen.py:35
↓ 22 callersMethod__init__
Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapT
monai/transforms/croppad/dictionary.py:123
↓ 22 callersFunctionexecute_compose
``execute_compose`` provides the implementation that the ``Compose`` class uses to execute a sequence of transforms. As well as being used by
monai/transforms/compose.py:65
↓ 22 callersFunctionget_logger
Get a `module_name` logger with the specified format and date format. By default, the logger will print to `stdout` at the INFO level. If
monai/apps/utils.py:51
↓ 22 callersFunctionpercentile
`np.percentile` with equivalent implementation for torch. Pytorch uses `quantile`. For more details please refer to: https://pytorch.org/docs
monai/transforms/utils_pytorch_numpy_unification.py:104
↓ 22 callersMethodrandomize
(self, img: NdarrayOrTensor)
monai/transforms/spatial/array.py:1630
↓ 21 callersMethoddecode
(self, quantizations: torch.Tensor)
monai/networks/nets/vqvae.py:442
↓ 21 callersFunctionone_hot
For every value v in `labels`, the value in the output will be either 1 or 0. Each vector along the `dim`-th dimension has the "one-hot" form
monai/networks/utils.py:170
next →1–100 of 7,906, ranked by callers