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

Wrong input type for `_voxel2stream` on 64-bit Windows #810

Closed
matthew-brett opened this Issue Dec 13, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@matthew-brett
Member

matthew-brett commented Dec 13, 2015

We're getting several errors of form:

======================================================================
ERROR: dipy.tracking.tests.test_life.test_voxel2streamline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildslaves\mike-win7-64\dipy-bdist64-35\build\venv\lib\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\buildslaves\mike-win7-64\dipy-bdist64-35\build\venv\lib\site-packages\dipy\tracking\tests\test_life.py", line 89, in test_voxel2streamline
    v2f, v2fn = life.voxel2streamline(streamline, False, affine)
  File "C:\buildslaves\mike-win7-64\dipy-bdist64-35\build\venv\lib\site-packages\dipy\tracking\life.py", line 313, in voxel2streamline
    return _voxel2streamline(transformed_streamline, unique_idx)
  File "dipy\tracking\vox2track.pyx", line 20, in dipy.tracking.vox2track._voxel2streamline (dipy\tracking\vox2track.c:1562)
ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long'

In fact, long and int on Windows 64 are length 4 integers.

Here's the relevant part of voxel2streamline:

    if unique_idx is None:
        all_coords = np.concatenate(transformed_streamline)
        unique_idx = unique_rows(all_coords.astype(int))
    else:
        unique_idx = unique_idx

    return _voxel2streamline(transformed_streamline, unique_idx)

So, an obvious fix would be to cast unique_idx to np.intp, but - is the previous cast to int a good idea? Shouldn't it be round instead?

@arokem

This comment has been minimized.

Member

arokem commented Dec 16, 2015

I am still thinking about this, but the best solution might actually be in the direction of #811

arokem added a commit to arokem/dipy that referenced this issue Dec 24, 2015

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