Skip to content
Snippets Groups Projects
Commit f8a52e27 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Change MGHImage default name

parent 778f71bd
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,9 @@ Freesurfer ``mgh``/``mgz`` image files.
"""
import six
import os.path as op
import six
import nibabel as nib
import fsl.data.image as fslimage
......@@ -49,15 +50,20 @@ class MGHImage(fslimage.Image):
"""
if isinstance(image, six.string_types):
filename = image
filename = op.abspath(image)
name = op.basename(filename)
image = nib.load(image)
else:
name = None
filename = None
data = image.get_data()
affine = image.affine
fslimage.Image.__init__(self, data, xform=affine)
fslimage.Image.__init__(self,
data,
xform=affine,
name=name)
if filename is not None:
self.setMeta('mghImageFile', filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment