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

Bugfix in imagewrapper data range update - was not notifying on range

changes. Bugfix in Image.__getitem__ - was potentially returning data
with trailing dimensions of size 1.
parent 447ca17f
No related branches found
No related tags found
No related merge requests found
......@@ -564,7 +564,15 @@ class Image(Nifti1, notifier.Notifier):
:arg sliceobj: Something which can slice the image data.
"""
return self.__imageWrapper.__getitem__(sliceobj)
data = self.__imageWrapper.__getitem__(sliceobj)
if len(data.shape) > len(self.shape):
shape = data.shape[:len(self.shape)]
data = np.reshape(data, shape)
return data
class ProxyImage(Image):
......
......@@ -197,14 +197,11 @@ class ImageWrapper(notifier.Notifier):
dmin = float(np.nanmin(data))
dmax = float(np.nanmax(data))
if oldmin is None: oldmin = dmin
if oldmax is None: oldmax = dmax
if oldmin is None or dmin < oldmin: newmin = dmin
else: newmin = oldmin
if dmin < oldmin: newmin = dmin
else: newmin = oldmin
if dmax > oldmax: newmax = dmax
else: newmax = oldmax
if oldmax is None or dmax > oldmax: newmax = dmax
else: newmax = oldmax
self.__range = (newmin, newmax)
self.__updateSliceCoverage(slices)
......
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