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

RF: Newly created images are only considered "saved" if they were created from

a file name. Bitmap.asImage passes dataSource through to Image.__init__
parent ef3113d2
No related branches found
No related tags found
No related merge requests found
...@@ -167,4 +167,6 @@ class Bitmap(object): ...@@ -167,4 +167,6 @@ class Bitmap(object):
data = np.array(data, order='F', copy=False) data = np.array(data, order='F', copy=False)
return fslimage.Image(data, name=self.name) return fslimage.Image(data,
name=self.name,
dataSource=self.dataSource)
...@@ -809,6 +809,7 @@ class Image(Nifti): ...@@ -809,6 +809,7 @@ class Image(Nifti):
""" """
nibImage = None nibImage = None
saved = False
if indexed is not False: if indexed is not False:
warnings.warn('The indexed argument is deprecated ' warnings.warn('The indexed argument is deprecated '
...@@ -841,10 +842,10 @@ class Image(Nifti): ...@@ -841,10 +842,10 @@ class Image(Nifti):
# 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):
image = op.abspath(addExt(image)) image = op.abspath(addExt(image))
nibImage = nib.load(image, **kwargs) nibImage = nib.load(image, **kwargs)
dataSource = image dataSource = image
saved = True
# Or a numpy array - we wrap it in a nibabel image, # Or a numpy array - we wrap it in a nibabel image,
# with an identity transformation (each voxel maps # with an identity transformation (each voxel maps
...@@ -906,7 +907,7 @@ class Image(Nifti): ...@@ -906,7 +907,7 @@ class Image(Nifti):
self.__dataSource = dataSource self.__dataSource = dataSource
self.__threaded = threaded self.__threaded = threaded
self.__nibImage = nibImage self.__nibImage = nibImage
self.__saveState = dataSource is not None self.__saveState = saved
self.__imageWrapper = imagewrapper.ImageWrapper(self.nibImage, self.__imageWrapper = imagewrapper.ImageWrapper(self.nibImage,
self.name, self.name,
loadData=loadData, loadData=loadData,
......
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