class_docstr: Class for MGH format image
class_docstr_tok: ["Class","for","MGH","format","image"]
docstr: Write image to `file_map` or contained ``self.file_map``
  
  Parameters
  ----------
  file_map : None or mapping, optional
     files mapping.  If None (default) use object's ``file_map``
     attribute instead
docstr_tok: ["Write","image","to","`","file_map","`","or","contained","``","self.file_map","``","Parameters","--","--","--","--","--","file_map",":","None","or","mapping",",","optional","files","mapping",".","If","None","(","default",")","use","object","'s","``","file_map","``","attribute","instead"]
code: def to_file_map(self, file_map=None):
      """Write image to `file_map` or contained ``self.file_map``
  
      Parameters
      ----------
      file_map : None or mapping, optional
         files mapping.  If None (default) use object's ``file_map``
         attribute instead
      """
      if file_map is None:
          file_map = self.file_map
      data = np.asanyarray(self.dataobj)
      self.update_header()
      hdr = self.header
      with file_map["image"].get_prepare_fileobj("wb") as mghf:
          hdr.writehdr_to(mghf)
          self._write_data(mghf, data, hdr)
          hdr.writeftr_to(mghf)
      self._header = hdr
      self.file_map = file_map
  
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 4 for calling the MGHImage obj's underlying member method code with example usage: obj.to_file_map(file_map) without return types