Commit 7167df85 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Image.save has to create a new ImageWrapper instance when saving an indexed

gzip image.
parent f2fe0c0c
......@@ -792,6 +792,7 @@ class Image(Nifti):
self.__lName = '{}_{}'.format(id(self), self.name)
self.__dataSource = dataSource
self.__fileobj = fileobj
self.__threaded = threaded
self.__nibImage = nibImage
self.__saveState = dataSource is not None
self.__imageWrapper = imagewrapper.ImageWrapper(self.nibImage,
......@@ -1025,6 +1026,19 @@ class Image(Nifti):
self.__nibImage, self.__fileobj = loadIndexedImageFile(filename)
self.header = self.__nibImage.get_header()
# We have to create a new ImageWrapper
# instance too, as we have just destroyed
# the nibabel image we gave to the last
# one.
self.__imageWrapper.deregister(self.__lName)
self.__imageWrapper = imagewrapper.ImageWrapper(
self.nibImage,
self.name,
loadData=False,
dataRange=self.dataRange,
threaded=self.__threaded)
self.__imageWrapper.register(self.__lName, self.__dataRangeChanged)
self.__dataSource = filename
self.__saveState = True
......
......@@ -244,7 +244,7 @@ class ImageWrapper(notifier.Notifier):
:arg dataRange: A tuple containing the initial ``(min, max)`` data
range to use. See the :meth:`reset` method.
range to use.
.. note:: The ``dataRange`` parameter is intended for situations where
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment