class_docstr: Classes for invertible transforms.
  
  This class exists so that an ``invert`` method can be implemented. This allows, for
  example, images to be cropped, rotated, padded, etc., during training and inference,
  and after be returned to their original size before saving to file for comparison in
  an external viewer.
  
  When the ``inverse`` method is called:
  
      - the inverse is called on each key individually, which allows for
        different parameters being passed to each label (e.g., different
        interpolation for image and label).
  
      - the inverse transforms are applied in a last-in-first-out order. As
        the inverse is applied, its entry is removed from the list detailing
        the applied transformations. That is to say that during the forward
        pass, the list of applied transforms grows, and then during the
        inverse it shrinks back down to an empty list.
  
  We currently check that the ``id()`` of the transform is the same in the forward and
  inverse directions. This is a useful check to ensure that the inverses are being
  processed in the correct order.
  
  Note to developers: When converting a transform to an invertible transform, you need to:
  
      #. Inherit from this class.
      #. In ``__call__``, add a call to ``push_transform``.
      #. Any extra information that might be needed for the inverse can be included with the
         dictionary ``extra_info``. This dictionary should have the same keys regardless of
         whether ``do_transform`` was `True` or `False` and can only contain objects that are
         accepted in pytorch data loader's collate function (e.g., `None` is not allowed).
      #. Implement an ``inverse`` method. Make sure that after performing the inverse,
         ``pop_transform`` is called.
docstr: Inverse of ``__call__``.
  
  Raises:
      NotImplementedError: When the subclass does not override this method.
docstr_tok: ["Inverse","of","``","__call__","``",".","Raises",":","NotImplementedError",":","When","the","subclass","does","not","override","this","method","."]
code: def inverse(self, data: Any) -> Any:
      """
      Inverse of ``__call__``.
  
      Raises:
          NotImplementedError: When the subclass does not override this method.
  
      """
      raise NotImplementedError(
          f"Subclass {self.__class__.__name__} must implement this method."
      )
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Hashable, Mapping
  from contextlib import contextmanager
  from typing import Any
  import torch
  from monai import transforms
  from monai.data.meta_obj import MetaObj, get_track_meta
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import to_affine_nd
  from monai.transforms.traits import InvertibleTrait
  from monai.transforms.transform import Transform
  from monai.utils import LazyAttr, MetaKeys, TraceKeys, TraceStatusKeys, convert_to_dst_type, convert_to_numpy, convert_to_tensor
  from monai.utils.misc import MONAIEnvVars
label_desc: Use image node_id 2 for calling the InvertibleTransform obj's underlying member method code with example usage: obj.inverse(data) without return types