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

BF: Earlier changes broke support for GiftiImage objects

parent 88fa6a17
No related branches found
No related tags found
1 merge request!34Restore support for storing Gifti surfaces in ImageCache
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com> # Author: Paul McCarthy <pauldmccarthy@gmail.com>
# #
__version__ = '0.12.0' __version__ = '0.12.1'
"""The pyfeeds version number. """ """The pyfeeds version number. """
......
...@@ -597,8 +597,8 @@ def evalGiftiVertices(pyf, testfile, benchmark): ...@@ -597,8 +597,8 @@ def evalGiftiVertices(pyf, testfile, benchmark):
function. function.
""" """
surf1 = pyf.imageCache[testfile][1] surf1 = pyf.imageCache[testfile][0]
surf2 = pyf.imageCache[benchmark][1] surf2 = pyf.imageCache[benchmark][0]
# NIFTI_INTENT_POINTSET == 1008 # NIFTI_INTENT_POINTSET == 1008
verts1 = [d for d in surf1.darrays if d.intent == 1008][0].data verts1 = [d for d in surf1.darrays if d.intent == 1008][0].data
......
...@@ -88,9 +88,8 @@ class ImageCache: ...@@ -88,9 +88,8 @@ class ImageCache:
return image return image
image = nib.load(imagefile) image = nib.load(imagefile)
data = np.asanyarray(image.dataobj) self[imagefile] = image
self[imagefile] = image, data return self[imagefile]
return image, data
def __setitem__(self, imagefile, image): def __setitem__(self, imagefile, image):
...@@ -98,12 +97,10 @@ class ImageCache: ...@@ -98,12 +97,10 @@ class ImageCache:
storing derived, in-memory-only images. storing derived, in-memory-only images.
""" """
# assignments through __getitem__ will
# be an (image, ndarray) tuple
if isinstance(image, nib.Nifti1Image): if isinstance(image, nib.Nifti1Image):
data = np.asanyarray(image.dataobj) data = np.asanyarray(image.dataobj)
else: else:
image, data = image data = None
# imagefile may not be a valid # imagefile may not be a valid
# file system path, but we transform # file system path, but we transform
......
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