From 3930ad31592cd909c9000d8dbe4e10796ea20108 Mon Sep 17 00:00:00 2001 From: Nauman702 Date: Mon, 19 Sep 2022 22:15:34 +0100 Subject: [PATCH] spm func fix --- spm_funcs.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spm_funcs.py b/spm_funcs.py index 450c1ab..7298b0b 100644 --- a/spm_funcs.py +++ b/spm_funcs.py @@ -54,8 +54,16 @@ def get_spm_globals(fname): spm_vals : array SPM global metric for each 3D volume in the 4D image. """ - # +++your code here+++ - # return + spm_vals_list=[] + img=nib.load(fname) + #- Get the data + data=img.get_fdata() + #- Calculate the SPM global value for each volume. + for i in range(data.shape[-1]): + spm_vals_list.append (spm_global(data[:,:,:,i])) + + spm_vals=np.array(spm_vals_list) + return spm_vals # Return the result. def main():