Skip to content

Commit 1ce7a8d

Browse files
committed
fix: ignore empty masks in compcor
1 parent 11820cb commit 1ce7a8d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

examples/rsfmri_conn_preprocessing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ def extract_noise_components(realigned_file, mask_file, num_components=5,
218218
components = None
219219
for filename in filename_to_list(mask_file):
220220
mask = nb.load(filename).get_data()
221+
if len(np.nonzero(mask > 0)[0]) == 0:
222+
continue
221223
voxel_timecourses = imgseries.get_data()[mask > 0]
222224
voxel_timecourses[np.isnan(np.sum(voxel_timecourses, axis=1)), :] = 0
223225
# remove mean and normalize by variance

0 commit comments

Comments
 (0)