From 305bf7578110f7a54ce289f0dd3339174ccb8497 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Fri, 15 Nov 2024 14:18:28 -0500 Subject: [PATCH] fix when empty ids --- scripts/scil_tractogram_filter_by_roi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/scil_tractogram_filter_by_roi.py b/scripts/scil_tractogram_filter_by_roi.py index 3ee4d9d2b..070f9b1ba 100755 --- a/scripts/scil_tractogram_filter_by_roi.py +++ b/scripts/scil_tractogram_filter_by_roi.py @@ -456,7 +456,11 @@ def main(): 'streamlines'.format(roi_opt, len(filtered_sft))) sft = filtered_sft - total_kept_ids = total_kept_ids[kept_ids] + if kept_ids.size == 0: + total_kept_ids = 0 + else: + total_kept_ids = total_kept_ids[kept_ids] + o_dict['streamline_count_after_criteria{}'.format(i)] = \ len(sft.streamlines)