code: def test_header_updating(self):
      # Only update on changes
      img_klass = self.image_class
      # With a None affine - don't overwrite zooms
      img = img_klass(np.zeros((2, 3, 4)), None)
      hdr = img.header
      hdr.set_zooms((4, 5, 6))
      # Save / reload using bytes IO objects
      for key, value in img.file_map.items():
          value.fileobj = BytesIO()
      img.to_file_map()
      hdr_back = img.from_file_map(img.file_map).header
      assert_array_equal(hdr_back.get_zooms(), (4, 5, 6))
      # With a real affine, update zooms
      img = img_klass(np.zeros((2, 3, 4)), np.diag([2, 3, 4, 1]), hdr)
      hdr = img.header
      assert_array_equal(hdr.get_zooms(), (2, 3, 4))
      # Modify affine in-place? Update on save.
      img.affine[0, 0] = 9
      for key, value in img.file_map.items():
          value.fileobj = BytesIO()
      img.to_file_map()
      hdr_back = img.from_file_map(img.file_map).header
      assert_array_equal(hdr.get_zooms(), (9, 3, 4))
      # Modify data in-place?  Update on save
      data = img.get_fdata()
      data.shape = (3, 2, 4)
      img.to_file_map()
      img_back = img.from_file_map(img.file_map)
      assert_array_equal(img_back.shape, (3, 2, 4))
  
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 8 for calling the TestAnalyzeImage obj's underlying member method code with example usage: obj.test_header_updating() without return types