Skip to content

Commit 353dc6f

Browse files
committed
streamlines_to_voxel_coordinates requires float32, loose precision
1 parent 095637c commit 353dc6f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/scilpy/cli/scil_tractogram_segment_connections_from_labels.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ def main():
284284
# Get the indices of the voxels traversed by each streamline
285285
logging.info('*** Computing voxels traversed by each streamline ***')
286286
time1 = time.time()
287+
sft.streamlines._data = sft.streamlines._data.astype(np.float32)
287288
indices, points_to_idx = streamlines_to_voxel_coordinates(
288289
sft.streamlines,
289290
return_mapping=True

src/scilpy/tractograms/streamline_and_mask_operations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def get_head_tail_density_maps(sft, point_to_select=1, to_millimeters=False,
114114

115115
dimensions = sft.dimensions
116116
# Get the indices of the voxels intersected
117+
streamlines._data = streamlines._data.astype(np.float32)
117118
list_indices, points_to_indices = streamlines_to_voxel_coordinates(
118119
streamlines, return_mapping=True)
119120

@@ -328,6 +329,7 @@ def cut_streamlines_with_mask(sft, mask,
328329

329330
# Get the indices of the voxels
330331
# intersected by the streamlines and the mapping from points to indices
332+
sft.streamlines._data = sft.streamlines._data.astype(np.float32)
331333
indices, points_to_idx = streamlines_to_voxel_coordinates(
332334
sft.streamlines,
333335
return_mapping=True
@@ -429,6 +431,7 @@ def cut_streamlines_between_labels(
429431
mask = label_data_2 != unique_vals[1]
430432
label_data_2[mask] = 0
431433

434+
sft.streamlines._data = sft.streamlines._data.astype(np.float32)
432435
(indices, points_to_idx) = streamlines_to_voxel_coordinates(
433436
sft.streamlines,
434437
return_mapping=True

0 commit comments

Comments
 (0)