docstr: Implementation various formatting options.
docstr_tok: ["Implementation","various","formatting","options","."]
code: def __format__(self, format_spec):
      """Implementation various formatting options."""
  
      if format_spec is None or self.affine is None:
          return str(self.affine)
      elif isinstance(format_spec, str):
          format_spec = format_spec.lower()
          if format_spec in ["", " ", "f", "full"]:
              return str(self.affine)
          # rotation part only (initial 3x3)
          elif format_spec in ["r", "rotation"]:
              return str(self.affine[:-1, :-1])
          # translation part only (4th col)
          elif format_spec in ["t", "translation"]:
              # notice unusual indexing to make it a column vector
              #   i.e. rows from 0 to n-1, cols from n to n
              return str(self.affine[:-1, -1:])
          else:
              allowed_formats_print_map = [
                  "full",
                  "f",
                  "rotation",
                  "r",
                  "translation",
                  "t",
              ]
              raise NotImplementedError(
                  "Format {} not recognized or"
                  "implemented.\nTry one of {}".format(
                      format_spec, allowed_formats_print_map
                  )
              )
  
imports: from warnings import warn
  import numpy
  import numpy.linalg
  import scipy.ndimage
  from dipy.core.optimize import Optimizer
  from dipy.core.interpolation import interpolate_scalar_2d, interpolate_scalar_3d
  from dipy.align import vector_fields
  from dipy.align import VerbosityLevels
  from dipy.align.parzenhist import ParzenJointHistogram, sample_domain_regular, compute_parzen_mi
  from dipy.align.imwarp import get_direction_and_spacings, ScaleSpace
  from dipy.align.scalespace import IsotropicScaleSpace
  from dipy.utils.deprecator import deprecated_params
label_desc: Use image node_id 6 for calling the AffineMap obj's underlying member method code with example usage: obj.__format__(format_spec) and returns: str, str, str, str