code: def test_from_header(self):
      # check from header class method.
      klass = self.header_class
      empty = klass.from_header()
      assert klass() == empty
      empty = klass.from_header(None)
      assert klass() == empty
      hdr = klass()
      hdr.set_data_dtype(np.float64)
      hdr.set_data_shape((1, 2, 3))
      hdr.set_zooms((3.0, 2.0, 1.0))
      for check in (True, False):
          copy = klass.from_header(hdr, check=check)
          assert hdr == copy
          assert hdr is not copy
  
      class C:
          def get_data_dtype(self):
              return np.dtype("i2")
  
          def get_data_shape(self):
              return (5, 4, 3)
  
          def get_zooms(self):
              return (10.0, 9.0, 8.0)
  
      converted = klass.from_header(C())
      assert isinstance(converted, klass)
      assert converted.get_data_dtype() == np.dtype("i2")
      assert converted.get_data_shape() == (5, 4, 3)
      assert converted.get_zooms() == (10.0, 9.0, 8.0)
  
imports: import itertools
  import logging
  import os
  import pickle
  import re
  from io import BytesIO, StringIO
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..None import imageglobals
  from ..analyze import AnalyzeHeader, AnalyzeImage
  from ..arraywriters import WriterError
  from ..casting import sctypes_aliases
  from ..nifti1 import Nifti1Header
  from ..optpkg import optional_package
  from ..spatialimages import HeaderDataError, HeaderTypeError, supported_np_types
  from ..testing import assert_dt_equal, bytesio_filemap, bytesio_round_trip, data_path, suppress_warnings
  from ..tmpdirs import InTemporaryDirectory
  from .None import test_spatialimages
  from .None import test_wrapstruct
label_desc: Use image node_id 23 for calling the TestAnalyzeHeader obj's underlying member method code with example usage: obj.test_from_header() and returns: np, int,  int,  int, int,  int,  int