Skip to content

Commit

Permalink
Switch to uint16
Browse files Browse the repository at this point in the history
  • Loading branch information
frheault committed Sep 23, 2020
1 parent 6d23603 commit dd637da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions scilpy/tractanalysis/quick_tools.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_next_real_point(points_to_index, vox_index):
int map_idx = -1
int nb_points_to_index
int internal_vox_index
cnp.npy_ulong[:] pts_to_index_view
cnp.npy_uint16[:] pts_to_index_view

nb_points_to_index = len(points_to_index)
internal_vox_index = vox_index
Expand All @@ -35,7 +35,7 @@ def get_previous_real_point(points_to_index, vox_index):
int map_index
int nb_points_to_index
int internal_vox_index
cnp.npy_ulong[:] pts_to_index_view
cnp.npy_uint16[:] pts_to_index_view

nb_points_to_index = len(points_to_index)
previous_point = nb_points_to_index
Expand Down
6 changes: 3 additions & 3 deletions scilpy/tractanalysis/uncompress.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cdef struct Pointers:
# To bookkeep the final index related to a streamline point
cnp.npy_intp *pti_lengths_out
cnp.npy_intp *pti_offsets_out
cnp.uint64_t *points_to_index_out
cnp.uint16_t *points_to_index_out


@cython.boundscheck(False)
Expand Down Expand Up @@ -61,7 +61,7 @@ def uncompress(streamlines, return_mapping=False):
points_to_index = nib.streamlines.array_sequence.ArraySequence()
points_to_index._lengths.resize(nb_streamlines)
points_to_index._offsets.resize(nb_streamlines)
points_to_index._data = np.zeros(int(streamlines.get_data().size / 3), np.uint64)
points_to_index._data = np.zeros(int(streamlines.get_data().size / 3), np.uint16)

cdef:
cnp.npy_intp[:] lengths_view_in = streamlines._lengths
Expand All @@ -72,7 +72,7 @@ def uncompress(streamlines, return_mapping=False):
cnp.uint16_t[:] data_view_out = new_array_sequence._data
cnp.npy_intp[:] pti_lengths_view_out = points_to_index._lengths
cnp.npy_intp[:] pti_offsets_view_out = points_to_index._offsets
cnp.uint64_t[:] points_to_index_view_out = points_to_index._data
cnp.uint16_t[:] points_to_index_view_out = points_to_index._data

cdef Pointers pointers
pointers.lengths_in = &lengths_view_in[0]
Expand Down

0 comments on commit dd637da

Please sign in to comment.