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

Image using Notifier.skip instead of storing its own flag.

parent 71826cc2
No related branches found
No related tags found
No related merge requests found
...@@ -479,11 +479,11 @@ class Image(Nifti, notifier.Notifier): ...@@ -479,11 +479,11 @@ class Image(Nifti, notifier.Notifier):
Nifti.__init__(self, nibImage.get_header()) Nifti.__init__(self, nibImage.get_header())
self.name = name self.name = name
self.__lName = '{}_{}'.format(id(self), self.name)
self.__dataSource = dataSource self.__dataSource = dataSource
self.__fileobj = fileobj 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.__imageWrapper = imagewrapper.ImageWrapper(self.nibImage, self.__imageWrapper = imagewrapper.ImageWrapper(self.nibImage,
self.name, self.name,
loadData=loadData, loadData=loadData,
...@@ -492,9 +492,7 @@ class Image(Nifti, notifier.Notifier): ...@@ -492,9 +492,7 @@ class Image(Nifti, notifier.Notifier):
if calcRange: if calcRange:
self.calcRange() self.calcRange()
self.__imageWrapper.register( self.__imageWrapper.register(self.__lName, self.__dataRangeChanged)
'{}_{}'.format(id(self), self.name),
self.__dataRangeChanged)
def __hash__(self): def __hash__(self):
...@@ -588,8 +586,7 @@ class Image(Nifti, notifier.Notifier): ...@@ -588,8 +586,7 @@ class Image(Nifti, notifier.Notifier):
Notifies any listeners of this ``Image`` (registered through the Notifies any listeners of this ``Image`` (registered through the
:class:`.Notifier` interface) on the ``'dataRange'`` topic. :class:`.Notifier` interface) on the ``'dataRange'`` topic.
""" """
if not self.__suppressDataRange: self.notify(topic='dataRange')
self.notify(topic='dataRange')
def calcRange(self, sizethres=None): def calcRange(self, sizethres=None):
...@@ -720,13 +717,11 @@ class Image(Nifti, notifier.Notifier): ...@@ -720,13 +717,11 @@ class Image(Nifti, notifier.Notifier):
sliceobj, sliceobj,
values.shape)) values.shape))
self.__suppressDataRange = True with self.__imageWrapper.skip(self.__lName):
oldRange = self.__imageWrapper.dataRange
self.__imageWrapper.__setitem__(sliceobj, values) oldRange = self.__imageWrapper.dataRange
self.__imageWrapper.__setitem__(sliceobj, values)
newRange = self.__imageWrapper.dataRange newRange = self.__imageWrapper.dataRange
self.__suppressDataRange = False
if values.size > 0: if values.size > 0:
......
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