New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline_tools example stops working when I change density from 1 to 2 #307

Closed
Garyfallidis opened this Issue Jan 4, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@Garyfallidis
Member

Garyfallidis commented Jan 4, 2014

I just changed this line in the streamline_tools example

seeds = utils.seeds_from_mask(white_matter, density=2)

and I am getting this error. Please also after solving this problem write a better docstring for seeds_from_mask

All files already in /home/user/.dipy/stanford_hardi.

AttributeError Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
176 else:
177 filename = fname
--> 178 builtin.execfile(filename, *where)

/home/user/Documents/dipy_paper/code/streamline_tools.py in ()
53 """
54
---> 55 seeds = utils.seeds_from_mask(white_matter, density=2)
56 streamline_generator = EuDX(csapeaks.peak_values, csapeaks.peak_indices,
57 odf_vertices=peaks.default_sphere.vertices,

/home/user/Devel/dipy/dipy/tracking/_utils.pyc in seeds_from_mask(mask, density, voxel_size, affine)
406 where = np.argwhere(mask)
407 seeds = where[:, np.newaxis, :] + grid[np.newaxis, :, :]
--> 408 seeds.shape = (-1, 3)
409
410 # Apply the spacial transform

AttributeError: incompatible shape for a non-contiguous array

@MrBago

This comment has been minimized.

Contributor

MrBago commented Jan 8, 2014

Based on the trace it looks like line 408 should be replaced with seeds = seeds.reshape((-1, 3)). I'll have time to work on this maybe Friday or Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment