class_docstr: Class for MGH format header
  
  The header also consists of the footer data which MGH places after the data
  chunk.
class_docstr_tok: ["Class","for","MGH","format","header","The","header","also","consists","of","the","footer","data","which","MGH","places","after","the","data","chunk","."]
docstr: Return new object with given ``endianness``
  
  If big endian, returns a copy of the object. Otherwise raises ValueError.
  
  Parameters
  ----------
  endianness : None or string, optional
     endian code to which to swap.  None means swap from current
     endianness, and is the default
  
  Returns
  -------
  wstr : ``MGHHeader``
     ``MGHHeader`` object
docstr_tok: ["Return","new","object","with","given","``","endianness","``","If","big","endian",",","returns","a","copy","of","the","object",".","Otherwise","raises","ValueError",".","Parameters","--","--","--","--","--","endianness",":","None","or","string",",","optional","endian","code","to","which","to","swap",".","None","means","swap","from","current","endianness",",","and","is","the","default","Returns","--","--","--","-","wstr",":","``","MGHHeader","``","``","MGHHeader","``","object"]
code: def as_byteswapped(self, endianness=None):
      """Return new object with given ``endianness``
  
      If big endian, returns a copy of the object. Otherwise raises ValueError.
  
      Parameters
      ----------
      endianness : None or string, optional
         endian code to which to swap.  None means swap from current
         endianness, and is the default
  
      Returns
      -------
      wstr : ``MGHHeader``
         ``MGHHeader`` object
  
      """
      if endianness is None or endian_codes[endianness] != ">":
          raise ValueError(
              "Cannot byteswap MGHHeader - must always be big endian"
          )
      return self.copy()
  
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 29 for calling the MGHHeader obj's underlying member method code with example usage: obj.as_byteswapped(endianness) and returns: self