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

Closed
matthew-brett opened this Issue Jan 27, 2013 · 0 comments

Projects

None yet

2 participants

@matthew-brett
NIPY developers member

For Yarik, brought over from nipy/nibabel#150

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'

@bthirion bthirion was assigned Feb 6, 2013
@bthirion bthirion closed this Aug 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment