nipy / nibabel

Python package to access a cacophony of neuro-imaging file formats
http://nipy.org/nibabel/
Other
646 stars 257 forks source link

cluster_stats (or below) seems too heavily rely on data dtypes #150

Closed yarikoptic closed 11 years ago

yarikoptic commented 11 years ago
In [14]: ni.get_data_dtype()
Out[14]: dtype('float32')

In [15]: ni
Out[15]: <nibabel.nifti1.Nifti1Image at 0x3ff3250>

In [16]: cluster_stats(ni, ni, height_th=4., height_control='None', cluster_th=0, nulls={})
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-16-8d6c94597ab2> in <module>()
----> 1 cluster_stats(ni, ni, height_th=4., height_control='None', cluster_th=0, nulls={})

/home/yoh/proj/nipy/nipy-suite/nipy/nipy/labs/statistical_mapping.pyc in cluster_stats(zimg, mask, height_th, height_control, cluster_th, nulls)
     84     ## Extract local maxima and connex components above some threshold
     85     ff = field_from_graph_and_data(wgraph_from_3d_grid(xyz_th, k=18), zmap_th)
---> 86     maxima, depth = ff.get_local_maxima(th=zth)
     87     labels = ff.cc()
     88     ## Make list of clusters, each cluster being a dictionary

/home/yoh/proj/nipy/nipy-suite/nipy/nipy/algorithms/graph/field.pyc in get_local_maxima(self, refdim, th)
    231                depth[idx[i]] = q means that idx[i] is a q-order maximum
    232         """
--> 233         depth_all = self.local_maxima(refdim, th)
    234         idx = np.ravel(np.where(depth_all))
    235         depth = depth_all[idx]

/home/yoh/proj/nipy/nipy-suite/nipy/nipy/algorithms/graph/field.pyc in local_maxima(self, refdim, th)
    270         for k in range(sf.V):
    271             dilated_field_old = sf.field.ravel().copy()
--> 272             sf.dilation(1)
    273             non_max = sf.field.ravel() > dilated_field_old
    274             ldepth[non_max] = np.minimum(k, ldepth[non_max])

/home/yoh/proj/nipy/nipy-suite/nipy/nipy/algorithms/graph/field.pyc in dilation(self, nbiter, fast)
    168                 idx, neighb, _ = self.compact_neighb()
    169                 for i in range(nbiter):
--> 170                     dilation(self.field, idx, neighb)
    171         else:
    172             from scipy.sparse import dia_matrix

/home/yoh/proj/nipy/nipy-suite/nipy/nipy/algorithms/graph/_graph.so in nipy.algorithms.graph._graph.dilation (nipy/algorithms/graph/_graph.c:1217)()

ValueError: Buffer dtype mismatch, expected 'DOUBLE' but got 'float'
matthew-brett commented 11 years ago

Er - isn't this a nipy issue?

yarikoptic commented 11 years ago

yeah -- late in the evening ... was dreaming about nibabel ;-) please "reassign"

On Sat, 26 Jan 2013, Matthew Brett wrote:

Er - isn't this a nipy issue?

Yaroslav O. Halchenko Postdoctoral Fellow, Department of Psychological and Brain Sciences Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419 WWW: http://www.linkedin.com/in/yarik

matthew-brett commented 11 years ago

Didn't know how to reassign, so - copied! https://github.com/nipy/nipy/issues/256