@importer('<STR_LIT>', ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'))<EOL>def load_nifti(filename, to='<STR_LIT>'):
img = nib.load(filename)<EOL>to = to.lower()<EOL>if to == '<STR_LIT:image>':    return img<EOL>elif to == '<STR_LIT:data>':   return img.get_data()<EOL>elif to == '<STR_LIT>': return img.affine<EOL>elif to == '<STR_LIT>': return img.header<EOL>elif to == '<STR_LIT>':<EOL><INDENT>dat = np.squeeze(np.asarray(img.get_data()))<EOL>if len(dat.shape) > <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>return dat<EOL><DEDENT>elif to in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>dims = set(np.shape(img.get_data()))<EOL>if <NUM_LIT:1> < len(dims) < <NUM_LIT:4> and <NUM_LIT:1> in dims:<EOL><INDENT>return np.squeeze(np.asarray(img.get_data()))<EOL><DEDENT>else:<EOL><INDENT>return img<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % to)<EOL><DEDENT>
load_nifti(filename) yields the Nifti1Image or Nifti2Image referened by the given filename by
  using the nibabel load function.

The optional argument to may be used to coerce the resulting data to a particular format; the
following arguments are understood:
  * 'header' will yield just the image header
  * 'data' will yield the image's data-array
  * 'field' will yield a squeezed version of the image's data-array and will raise an error if
    the data object has more than 2 non-unitary dimensions (appropriate for loading surface
    properties stored in image files)
  * 'affine' will yield the image's affine transformation
  * 'image' will yield the raw image object
  * 'auto' is equivalent to 'image' unless the image has no more than 2 non-unitary dimensions,
    in which case it is assumed to be a surface-field and the return value is equivalent to
    the 'field' value.