class_docstr: Ignite process_function used to introduce interactions (simulation of clicks) for DeepEdit Training/Evaluation.
  
  More details about this can be found at:
  
      Diaz-Pinto et al., MONAI Label: A framework for AI-assisted Interactive
      Labeling of 3D Medical Images. (2022) https://arxiv.org/abs/2203.12362
  
  Args:
      deepgrow_probability: probability of simulating clicks in an iteration
      transforms: execute additional transformation during every iteration (before train).
          Typically, several Tensor based transforms composed by `Compose`.
      train: True for training mode or False for evaluation mode
      click_probability_key: key to click/interaction probability
      label_names: Dict of label names
      max_interactions: maximum number of interactions per iteration
code: def __call__(
      self,
      engine: SupervisedTrainer | SupervisedEvaluator,
      batchdata: dict[str, torch.Tensor],
  ) -> dict:
      if batchdata is None:
          raise ValueError(
              "Must provide batch data for current iteration."
          )
  
      if np.random.choice(
          [True, False],
          p=[self.deepgrow_probability, 1 - self.deepgrow_probability],
      ):
          for j in range(self.max_interactions):
              inputs, _ = engine.prepare_batch(batchdata)
              inputs = inputs.to(engine.state.device)
  
              engine.fire_event(IterationEvents.INNER_ITERATION_STARTED)
              engine.network.eval()
  
              with torch.no_grad():
                  if engine.amp:
                      with torch.cuda.amp.autocast():
                          predictions = engine.inferer(
                              inputs, engine.network
                          )
                  else:
                      predictions = engine.inferer(
                          inputs, engine.network
                      )
              batchdata.update({CommonKeys.PRED: predictions})
  
              # decollate/collate batchdata to execute click transforms
              batchdata_list = decollate_batch(batchdata, detach=True)
              for i in range(len(batchdata_list)):
                  batchdata_list[i][self.click_probability_key] = (
                      (1.0 - ((1.0 / self.max_interactions) * j))
                      if self.train
                      else 1.0
                  )
                  batchdata_list[i] = self.transforms(batchdata_list[i])
  
              batchdata = list_data_collate(batchdata_list)
              engine.fire_event(
                  IterationEvents.INNER_ITERATION_COMPLETED
              )
      else:
          # zero out input guidance channels
          batchdata_list = decollate_batch(batchdata, detach=True)
          for i in range(1, len(batchdata_list[0][CommonKeys.IMAGE])):
              batchdata_list[0][CommonKeys.IMAGE][i] *= 0
          batchdata = list_data_collate(batchdata_list)
  
      # first item in batch only
      engine.state.batch = batchdata
      return engine._iteration(engine, batchdata)
  
file_path: MONAI/monai/apps/deepedit/interaction.py
imports: from __future__ import annotations
  from collections.abc import Callable, Sequence
  import numpy
  import torch
  from monai.data import decollate_batch, list_data_collate
  from monai.engines import SupervisedEvaluator, SupervisedTrainer
  from monai.engines.utils import IterationEvents
  from monai.transforms import Compose
  from monai.utils.enums import CommonKeys
label_desc: Use image node_id 2 for calling the Interaction obj's underlying member method code with example usage: obj.__call__(engine, batchdata) and returns: engine