[Neuroimaging] trouble with fileslice

Natalia Mesa v-nataliam at alleninstitute.org
Tue Aug 30 13:05:27 EDT 2016


I'm trying to extract an ROI from a large binary file. Whenever I run nibabel.fileslice.fileslice, I'm getting the following error:

C:\Anaconda2\lib\site-packages\nibabel\fileslice.pyc in optimize_read_slicers(sliceobj, in_shape, itemsize, heuristic)

    560         if not isinstance(read_slicer, Integral):

    561             post_slicers.append(post_slicer)

--> 562         stride*=dim_len


    564     return tuple(read_slicers), tuple(post_slicers)

TypeError: unsupported operand type(s) for *=: 'getset_descriptor' and 'int'

I'm calling this function with the following:
filepath = filepath
dtype = 'uint16'
chunksize = int((npix*nframes))


f = open(filepath, 'r')

dat=nibabel.fileslice.fileslice(f, sliceobj=sliceobj, shape=(2048,2048,100), dtype=np.uint16)

The binary file I'm trying to analyze is imaging data, and thus the final shape of the array is 3D. The slice object I'm inputting is a 20 by 20 pixel ROI.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20160830/0910037b/attachment.html>

More information about the Neuroimaging mailing list