Skip to content

Commit 98c68af

Browse files
committed
limit stacking to timeseries data only
1 parent 72471a7 commit 98c68af

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nibabel/gifti/gifti.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,13 +706,16 @@ def agg_data(self, intent_code=None):
706706

707707
darrays = self.darrays if intent_code is None else self.get_arrays_from_intent(intent_code)
708708
all_data = tuple(da.data for da in darrays)
709-
all_intent = tuple(intent_codes.niistring[da.intent] for da in darrays)
709+
all_intent = {da.intent for da in darrays}
710710

711711
# Gifti files allows usually one or more data array of the same intent code
712712
# surf.gii is a special case of having two data array of different intent code
713713

714-
if (self.numDA > 1 and all(el == all_intent[0] for el in all_intent)):
715-
return np.column_stack(all_data)
714+
if self.numDA > 1 and len(all_intent) == 1:
715+
if all_intent== 'NIFTI_INTENT_TIME_SERIES': # stack when the gifti is a timeseries
716+
return np.column_stack(all_data)
717+
else:
718+
return all_data
716719
else:
717720
return all_data
718721

0 commit comments

Comments
 (0)