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

MGHImage retains the original file name

parent 577a0c6a
No related branches found
No related tags found
No related merge requests found
......@@ -40,13 +40,28 @@ class MGHImage(fslimage.Image):
"""
if isinstance(image, six.string_types):
image = nib.load(image)
filename = image
image = nib.load(image)
else:
filename = None
data = image.get_data()
affine = image.affine
fslimage.Image.__init__(self, data, xform=affine)
if filename is not None:
self.setMeta('mghImageFile', filename)
@property
def mghImageFile(self):
"""If this ``MGHImage`` was loaded from a file, returns the file
name. Otherwise returns ``None``.
"""
return self.getMeta('mghImageFile', None)
ALLOWED_EXTENSIONS = ['.mgz', '.mgh']
"""List of file extensions interpreted as MGH image files.
......
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