We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c0b6a6 commit ac54f47Copy full SHA for ac54f47
niworkflows/utils/timeseries.py
@@ -66,7 +66,10 @@ def _nifti_timeseries(
66
if segmentation is None:
67
return data, None
68
69
+ # Open NIfTI and extract numpy array
70
segmentation = nb.load(segmentation) if isinstance(segmentation, str) else segmentation
71
+ segmentation = np.asanyarray(segmentation.dataobj, dtype=int).reshape(-1)
72
+
73
# Map segmentation
74
if remap_rois or lut is not None:
75
if lut is None:
@@ -76,7 +79,7 @@ def _nifti_timeseries(
76
79
lut[1:11] = 3 # WM+CSF
77
80
lut[255] = 4 # Cerebellum
78
81
# Apply lookup table
- segmentation = lut[np.asanyarray(segmentation.dataobj, dtype=int)].reshape(-1)
82
+ segmentation = lut[segmentation]
83
84
fgmask = segmentation > 0
85
segmentation = segmentation[fgmask]
0 commit comments