From 353dc6f55a89f821472ff26fb5ccb38465b6e058 Mon Sep 17 00:00:00 2001 From: frheault Date: Thu, 6 Nov 2025 10:33:05 -0500 Subject: [PATCH] streamlines_to_voxel_coordinates requires float32, loose precision --- .../cli/scil_tractogram_segment_connections_from_labels.py | 1 + src/scilpy/tractograms/streamline_and_mask_operations.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/scilpy/cli/scil_tractogram_segment_connections_from_labels.py b/src/scilpy/cli/scil_tractogram_segment_connections_from_labels.py index 102519f78..ff9e690e0 100755 --- a/src/scilpy/cli/scil_tractogram_segment_connections_from_labels.py +++ b/src/scilpy/cli/scil_tractogram_segment_connections_from_labels.py @@ -284,6 +284,7 @@ def main(): # Get the indices of the voxels traversed by each streamline logging.info('*** Computing voxels traversed by each streamline ***') time1 = time.time() + sft.streamlines._data = sft.streamlines._data.astype(np.float32) indices, points_to_idx = streamlines_to_voxel_coordinates( sft.streamlines, return_mapping=True diff --git a/src/scilpy/tractograms/streamline_and_mask_operations.py b/src/scilpy/tractograms/streamline_and_mask_operations.py index faa0fcce5..93192fcab 100644 --- a/src/scilpy/tractograms/streamline_and_mask_operations.py +++ b/src/scilpy/tractograms/streamline_and_mask_operations.py @@ -114,6 +114,7 @@ def get_head_tail_density_maps(sft, point_to_select=1, to_millimeters=False, dimensions = sft.dimensions # Get the indices of the voxels intersected + streamlines._data = streamlines._data.astype(np.float32) list_indices, points_to_indices = streamlines_to_voxel_coordinates( streamlines, return_mapping=True) @@ -328,6 +329,7 @@ def cut_streamlines_with_mask(sft, mask, # Get the indices of the voxels # intersected by the streamlines and the mapping from points to indices + sft.streamlines._data = sft.streamlines._data.astype(np.float32) indices, points_to_idx = streamlines_to_voxel_coordinates( sft.streamlines, return_mapping=True @@ -429,6 +431,7 @@ def cut_streamlines_between_labels( mask = label_data_2 != unique_vals[1] label_data_2[mask] = 0 + sft.streamlines._data = sft.streamlines._data.astype(np.float32) (indices, points_to_idx) = streamlines_to_voxel_coordinates( sft.streamlines, return_mapping=True