Skip to content

Commit f382dd1

Browse files
committed
fix: smarter decision to remap input segmentation
1 parent e6b074b commit f382dd1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

niworkflows/utils/timeseries.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _nifti_timeseries(
5656
dataset,
5757
segmentation=None,
5858
labels=("Ctx GM", "dGM", "WM+CSF", "Cb", "Crown"),
59-
remap_rois=True,
59+
remap_rois=False,
6060
lut=None,
6161
):
6262
"""Extract timeseries from NIfTI1/2 datasets."""
@@ -70,6 +70,8 @@ def _nifti_timeseries(
7070
segmentation = nb.load(segmentation) if isinstance(segmentation, str) else segmentation
7171
segmentation = np.asanyarray(segmentation.dataobj, dtype=int).reshape(-1)
7272

73+
remap_rois = remap_rois or (len(np.unique(segmentation[segmentation > 0])) > len(labels))
74+
7375
# Map segmentation
7476
if remap_rois or lut is not None:
7577
if lut is None:

0 commit comments

Comments
 (0)