docstr: Initialize an instance of the AffineRegistration class.
  
  Parameters
  ----------
  metric : None or object, optional
      an instance of a metric. The default is None, implying
      the Mutual Information metric with default settings.
  level_iters : sequence, optional
      the number of iterations at each scale of the scale space.
      `level_iters[0]` corresponds to the coarsest scale,
      `level_iters[-1]` the finest, where n is the length of the
      sequence. By default, a 3-level scale space with iterations
      sequence equal to [10000, 1000, 100] will be used.
  sigmas : sequence of floats, optional
      custom smoothing parameter to build the scale space (one parameter
      for each scale). By default, the sequence of sigmas will be
      [3, 1, 0].
  factors : sequence of floats, optional
      custom scale factors to build the scale space (one factor for each
      scale). By default, the sequence of factors will be [4, 2, 1].
  method : string, optional
      optimization method to be used. If Scipy version < 0.12, then
      only L-BFGS-B is available. Otherwise, `method` can be any
      gradient-based method available in `dipy.core.Optimize`: CG, BFGS,
      Newton-CG, dogleg or trust-ncg.
      The default is 'L-BFGS-B'.
  ss_sigma_factor : float, optional
      If None, this parameter is not used and an isotropic scale
      space with the given `factors` and `sigmas` will be built.
      If not None, an anisotropic scale space will be used by
      automatically selecting the smoothing sigmas along each axis
      according to the voxel dimensions of the given image.
      The `ss_sigma_factor` is used to scale the automatically computed
      sigmas. For example, in the isotropic case, the sigma of the
      kernel will be $factor * (2 ^ i)$ where
      $i = 1, 2, ..., n_scales - 1$ is the scale (the finest resolution
      image $i=0$ is never smoothed). The default is None.
  options : dict, optional
      extra optimization options. The default is None, implying
      no extra options are passed to the optimizer.
docstr_tok: ["Initialize","an","instance","of","the","AffineRegistration","class",".","Parameters","--","--","--","--","--","metric",":","None","or","object",",","optional","an","instance","of","a","metric",".","The","default","is","None",",","implying","the","Mutual","Information","metric","with","default","settings",".","level_iters",":","sequence",",","optional","the","number","of","iterations","at","each","scale","of","the","scale","space",".","`","level_iters","[","0","]","`","corresponds","to","the","coarsest","scale",",","`","level_iters","[","-1","]","`","the","finest",",","where","n","is","the","length","of","the","sequence",".","By","default",",","a","3-level","scale","space","with","iterations","sequence","equal","to","[","10000",",","1000",",","100","]","will","be","used",".","sigmas",":","sequence","of","floats",",","optional","custom","smoothing","parameter","to","build","the","scale","space","(","one","parameter","for","each","scale",")",".","By","default",",","the","sequence","of","sigmas","will","be","[","3",",","1",",","0","]",".","factors",":","sequence","of","floats",",","optional","custom","scale","factors","to","build","the","scale","space","(","one","factor","for","each","scale",")",".","By","default",",","the","sequence","of","factors","will","be","[","4",",","2",",","1","]",".","method",":","string",",","optional","optimization","method","to","be","used",".","If","Scipy","version","<","0.12",",","then","only","L-BFGS-B","is","available",".","Otherwise",",","`","method","`","can","be","any","gradient-based","method","available","in","`","dipy.core.Optimize","`",":","CG",",","BFGS",",","Newton-CG",",","dogleg","or","trust-ncg",".","The","default","is","'","L-BFGS-B","'",".","ss_sigma_factor",":","float",",","optional","If","None",",","this","parameter","is","not","used","and","an","isotropic","scale","space","with","the","given","`","factors","`","and","`","sigmas","`","will","be","built",".","If","not","None",",","an","anisotropic","scale","space","will","be","used","by","automatically","selecting","the","smoothing","sigmas","along","each","axis","according","to","the","voxel","dimensions","of","the","given","image",".","The","`","ss_sigma_factor","`","is","used","to","scale","the","automatically","computed","sigmas",".","For","example",",","in","the","isotropic","case",",","the","sigma","of","the","kernel","will","be","$","factor","*","(","2","^","i",")","$","where","$","i","=","1",",","2",",","...",",","n_scales","-","1","$","is","the","scale","(","the","finest","resolution","image","$","i=0","$","is","never","smoothed",")",".","The","default","is","None",".","options",":","dict",",","optional","extra","optimization","options",".","The","default","is","None",",","implying","no","extra","options","are","passed","to","the","optimizer","."]
code: def __init__(
      self,
      metric=None,
      level_iters=None,
      sigmas=None,
      factors=None,
      method="L-BFGS-B",
      ss_sigma_factor=None,
      options=None,
      verbosity=VerbosityLevels.STATUS,
  ):
      """Initialize an instance of the AffineRegistration class.
  
      Parameters
      ----------
      metric : None or object, optional
          an instance of a metric. The default is None, implying
          the Mutual Information metric with default settings.
      level_iters : sequence, optional
          the number of iterations at each scale of the scale space.
          `level_iters[0]` corresponds to the coarsest scale,
          `level_iters[-1]` the finest, where n is the length of the
          sequence. By default, a 3-level scale space with iterations
          sequence equal to [10000, 1000, 100] will be used.
      sigmas : sequence of floats, optional
          custom smoothing parameter to build the scale space (one parameter
          for each scale). By default, the sequence of sigmas will be
          [3, 1, 0].
      factors : sequence of floats, optional
          custom scale factors to build the scale space (one factor for each
          scale). By default, the sequence of factors will be [4, 2, 1].
      method : string, optional
          optimization method to be used. If Scipy version < 0.12, then
          only L-BFGS-B is available. Otherwise, `method` can be any
          gradient-based method available in `dipy.core.Optimize`: CG, BFGS,
          Newton-CG, dogleg or trust-ncg.
          The default is 'L-BFGS-B'.
      ss_sigma_factor : float, optional
          If None, this parameter is not used and an isotropic scale
          space with the given `factors` and `sigmas` will be built.
          If not None, an anisotropic scale space will be used by
          automatically selecting the smoothing sigmas along each axis
          according to the voxel dimensions of the given image.
          The `ss_sigma_factor` is used to scale the automatically computed
          sigmas. For example, in the isotropic case, the sigma of the
          kernel will be $factor * (2 ^ i)$ where
          $i = 1, 2, ..., n_scales - 1$ is the scale (the finest resolution
          image $i=0$ is never smoothed). The default is None.
      options : dict, optional
          extra optimization options. The default is None, implying
          no extra options are passed to the optimizer.
  
      """
      self.metric = metric
  
      if self.metric is None:
          self.metric = MutualInformationMetric()
  
      if level_iters is None:
          level_iters = [10000, 1000, 100]
      self.level_iters = level_iters
      self.levels = len(level_iters)
      if self.levels == 0:
          raise ValueError("The iterations sequence cannot be empty")
  
      self.options = options
      self.method = method
      if ss_sigma_factor is not None:
          self.use_isotropic = False
          self.ss_sigma_factor = ss_sigma_factor
      else:
          self.use_isotropic = True
          if factors is None:
              factors = [4, 2, 1]
          if sigmas is None:
              sigmas = [3, 1, 0]
          self.factors = factors
          self.sigmas = sigmas
  
      self.verbosity = verbosity
  
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 1 to create a new AffineRegistration object  with example: obj = AffineRegistration(metric, level_iters, sigmas, factors, method, ss_sigma_factor, options, verbosity)