class_docstr: Class for basic analyze header
  
  Implements zoom-only setting of affine transform, and no image
  scaling
class_docstr_tok: ["Class","for","basic","analyze","header","Implements","zoom-only","setting","of","affine","transform",",","and","no","image","scaling"]
docstr: Class method to create header from another header
  
  Parameters
  ----------
  header : ``Header`` instance or mapping
     a header of this class, or another class of header for
     conversion to this type
  check : {True, False}
     whether to check header for integrity
  
  Returns
  -------
  hdr : header instance
     fresh header instance of our own class
docstr_tok: ["Class","method","to","create","header","from","another","header","Parameters","--","--","--","--","--","header",":","``","Header","``","instance","or","mapping","a","header","of","this","class",",","or","another","class","of","header","for","conversion","to","this","type","check",":","{","True",",","False","}","whether","to","check","header","for","integrity","Returns","--","--","--","-","hdr",":","header","instance","fresh","header","instance","of","our","own","class"]
code: def from_header(klass, header=None, check=True):
      """Class method to create header from another header
  
      Parameters
      ----------
      header : ``Header`` instance or mapping
         a header of this class, or another class of header for
         conversion to this type
      check : {True, False}
         whether to check header for integrity
  
      Returns
      -------
      hdr : header instance
         fresh header instance of our own class
      """
      # own type, return copy
      if type(header) == klass:
          obj = header.copy()
          if check:
              obj.check_fix()
          return obj
      # not own type, make fresh header instance
      obj = klass(check=check)
      if header is None:
          return obj
      if hasattr(header, "as_analyze_map"):
          # header is convertible from a field mapping
          mapping = header.as_analyze_map()
          for key in mapping:
              try:
                  obj[key] = mapping[key]
              except (ValueError, KeyError):
                  # the presence of the mapping certifies the fields as being
                  # of the same meaning as for Analyze types, so we can
                  # safely discard fields with names not known to this header
                  # type on the basis they are from the wrong Analyze dialect
                  pass
          # set any fields etc that are specific to this format (overridden by
          # sub-classes)
          obj._clean_after_mapping()
      # Fallback basic conversion always done.
      # More specific warning for unsupported datatypes
      orig_code = header.get_data_dtype()
      try:
          obj.set_data_dtype(orig_code)
      except HeaderDataError:
          raise HeaderDataError(
              f"Input header {header.__class__} has datatype "
              f'{header.get_value_label("datatype")} '
              f"but output header {klass} does not support it"
          )
      obj.set_data_dtype(header.get_data_dtype())
      obj.set_data_shape(header.get_data_shape())
      obj.set_zooms(header.get_zooms())
      if check:
          obj.check_fix()
      return obj
  
imports: from __future__ import annotations
  import numpy
  from .arrayproxy import ArrayProxy
  from .arraywriters import ArrayWriter, WriterError, get_slope_inter, make_array_writer
  from .batteryrunners import Report
  from .fileholders import copy_file_map
  from .spatialimages import HeaderDataError, HeaderTypeError, SpatialHeader, SpatialImage
  from .volumeutils import apply_read_scaling, array_from_file, make_dt_codes, native_code, seek_tell, shape_zoom_affine, swapped_code
  from .wrapstruct import LabeledWrapStruct
label_desc: Use image node_id 4 for calling the AnalyzeHeader obj's underlying member method code with example usage: obj.from_header(klass, header, check) and returns: obj, obj, obj