Skip to content
Snippets Groups Projects
Commit 7b6144d2 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Little bugfixes to Notifier and Image classes.

parent 1e8c9315
No related branches found
No related tags found
No related merge requests found
...@@ -384,6 +384,7 @@ class Image(Nifti1, notifier.Notifier): ...@@ -384,6 +384,7 @@ class Image(Nifti1, notifier.Notifier):
nibImage = None nibImage = None
dataSource = None dataSource = None
fileobj = None
# The image parameter may be the name of an image file # The image parameter may be the name of an image file
if isinstance(image, six.string_types): if isinstance(image, six.string_types):
...@@ -413,13 +414,12 @@ class Image(Nifti1, notifier.Notifier): ...@@ -413,13 +414,12 @@ class Image(Nifti1, notifier.Notifier):
fmap['image'].fileobj = fobj fmap['image'].fileobj = fobj
nibImage = nib.Nifti1Image.from_file_map(fmap) nibImage = nib.Nifti1Image.from_file_map(fmap)
self.__fileobj = fobj fileobj = fobj
# Otherwise we let nibabel # Otherwise we let nibabel
# manage the file reference(s) # manage the file reference(s)
else: else:
nibImage = nib.load(image) nibImage = nib.load(image)
self.__fileobj = None
dataSource = image dataSource = image
...@@ -460,6 +460,7 @@ class Image(Nifti1, notifier.Notifier): ...@@ -460,6 +460,7 @@ class Image(Nifti1, notifier.Notifier):
self.name = name self.name = name
self.__dataSource = dataSource self.__dataSource = dataSource
self.__fileobj = fileobj
self.__nibImage = nibImage self.__nibImage = nibImage
self.__saveState = dataSource is not None self.__saveState = dataSource is not None
self.__suppressDataRange = False self.__suppressDataRange = False
......
...@@ -94,7 +94,7 @@ class Notifier(object): ...@@ -94,7 +94,7 @@ class Notifier(object):
if listeners is None: if listeners is None:
return return
callback, _ = listeners.pop(name, None) callback, _ = listeners.pop(name, (None, None))
# Silently absorb invalid names - the # Silently absorb invalid names - the
# notify function may have removed gc'd # notify function may have removed gc'd
......
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