class_docstr: Template class for volumetric (3D/4D) images
class_docstr_tok: ["Template","class","for","volumetric","(","3D\/4D",")","images"]
docstr: Unconditionally set affine into the header
docstr_tok: ["Unconditionally","set","affine","into","the","header"]
code: def _affine2header(self) -> None:
      """Unconditionally set affine into the header"""
      assert self._affine is not None
      RZS = self._affine[:3, :3]
      vox = np.sqrt(np.sum(RZS * RZS, axis=0))
      hdr = self._header
      zooms = list(hdr.get_zooms())
      n_to_set = min(len(zooms), 3)
      zooms[:n_to_set] = vox[:n_to_set]
      hdr.set_zooms(zooms)
  
imports: from __future__ import annotations
  import io
  import typing
  from collections.abc import Sequence
  from typing import Literal
  import numpy
  from .arrayproxy import ArrayLike
  from .casting import sctypes_aliases
  from .dataobj_images import DataobjImage
  from .filebasedimages import FileBasedHeader, FileBasedImage
  from .fileholders import FileMap
  from .fileslice import canonical_slicers
  from .orientations import apply_orientation, inv_ornt_aff
  from .viewers import OrthoSlicer3D
  from .volumeutils import shape_zoom_affine
label_desc: Use image node_id 4 for calling the SpatialImage obj's underlying member method code with example usage: obj._affine2header() without return types