class_docstr: Class for MGH format image
class_docstr_tok: ["Class","for","MGH","format","image"]
docstr: Utility routine to write image
  
  Parameters
  ----------
  mghfile : file-like
     file-like object implementing ``seek`` or ``tell``, and
     ``write``
  data : array-like
     array to write
  header : analyze-type header object
     header
docstr_tok: ["Utility","routine","to","write","image","Parameters","--","--","--","--","--","mghfile",":","file-like","file-like","object","implementing","``","seek","``","or","``","tell","``",",","and","``","write","``","data",":","array-like","array","to","write","header",":","analyze-type","header","object","header"]
code: def _write_data(self, mghfile, data, header):
      """Utility routine to write image
  
      Parameters
      ----------
      mghfile : file-like
         file-like object implementing ``seek`` or ``tell``, and
         ``write``
      data : array-like
         array to write
      header : analyze-type header object
         header
      """
      shape = header.get_data_shape()
      if data.shape != shape:
          raise HeaderDataError(
              "Data should be shape (%s)"
              % ", ".join(str(s) for s in shape)
          )
      offset = header.get_data_offset()
      out_dtype = header.get_data_dtype()
      array_to_file(data, mghfile, out_dtype, offset)
  
imports: from os.path import splitext
  import numpy
  from ..affines import from_matvec, voxel_sizes
  from ..arrayproxy import ArrayProxy, reshape_dataobj
  from ..batteryrunners import BatteryRunner, Report
  from ..filebasedimages import SerializableImage
  from ..fileholders import FileHolder
  from ..filename_parser import _stringify_path
  from ..openers import ImageOpener
  from ..spatialimages import HeaderDataError, SpatialHeader, SpatialImage
  from ..volumeutils import Recoder, array_from_file, array_to_file, endian_codes
  from ..wrapstruct import LabeledWrapStruct
label_desc: Use image node_id 5 for calling the MGHImage obj's underlying member method code with example usage: obj._write_data(mghfile, data, header) without return types