@@ -1084,6 +1084,8 @@ def is_outlier(points, thresh=3.5):
10841084def cosine_filter (data , timestep , period_cut , remove_mean = True , axis = - 1 ):
10851085 datashape = data .shape
10861086 timepoints = datashape [axis ]
1087+ if datashape [0 ] == 0 :
1088+ return data , np .array ([])
10871089
10881090 data = data .reshape ((- 1 , timepoints ))
10891091
@@ -1115,6 +1117,8 @@ def regress_poly(degree, data, remove_mean=True, axis=-1):
11151117
11161118 datashape = data .shape
11171119 timepoints = datashape [axis ]
1120+ if datashape [0 ] == 0 :
1121+ return data , np .array ([])
11181122
11191123 # Rearrange all voxel-wise time-series in rows
11201124 data = data .reshape ((- 1 , timepoints ))
@@ -1261,7 +1265,7 @@ def compute_noise_components(imgseries, mask_images, components_criterion=0.5,
12611265 components_criterion = - 1
12621266 mask_names = mask_names or range (len (mask_images ))
12631267 for name , img in zip (mask_names , mask_images ):
1264- mask = img .get_data ().astype (np .bool )
1268+ mask = nb . squeeze_image ( img ) .get_data ().astype (np .bool )
12651269 if imgseries .shape [:3 ] != mask .shape :
12661270 raise ValueError (
12671271 'Inputs for CompCor, timeseries and mask, do not have '
0 commit comments