class_docstr: Template class to implement header protocol
class_docstr_tok: ["Template","class","to","implement","header","protocol"]
docstr: Write array data `data` as binary to `fileobj`
  
  Parameters
  ----------
  data : array-like
      data to write
  fileobj : file-like object
      file-like object implementing 'write'
  rescale : {True, False}, optional
      Whether to try and rescale data to match output dtype specified by
      header. For this minimal header, `rescale` has no effect
docstr_tok: ["Write","array","data","`","data","`","as","binary","to","`","fileobj","`","Parameters","--","--","--","--","--","data",":","array-like","data","to","write","fileobj",":","file-like","object","file-like","object","implementing","'write'","rescale",":","{","True",",","False","}",",","optional","Whether","to","try","and","rescale","data","to","match","output","dtype","specified","by","header",".","For","this","minimal","header",",","`","rescale","`","has","no","effect"]
code: def data_to_fileobj(
      self,
      data: npt.ArrayLike,
      fileobj: io.IOBase,
      rescale: bool = True,
  ):
      """Write array data `data` as binary to `fileobj`
  
      Parameters
      ----------
      data : array-like
          data to write
      fileobj : file-like object
          file-like object implementing 'write'
      rescale : {True, False}, optional
          Whether to try and rescale data to match output dtype specified by
          header. For this minimal header, `rescale` has no effect
      """
      data = np.asarray(data)
      dtype = self.get_data_dtype()
      fileobj.write(data.astype(dtype).tobytes(order=self.data_layout))
  
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 12 for calling the SpatialHeader obj's underlying member method code with example usage: obj.data_to_fileobj(data, fileobj, rescale) without return types