From cd9a9df0817ed229f30d63eaf80c309135d2fc6e Mon Sep 17 00:00:00 2001 From: emmanuellebeau Date: Thu, 1 Sep 2022 00:58:18 -0400 Subject: [PATCH] Fixed the spm-funcs python file for the Homework. Sorry being late, was very buse the last two weeks. --- spm_funcs.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spm_funcs.py b/spm_funcs.py index 450c1ab..7be33cb 100644 --- a/spm_funcs.py +++ b/spm_funcs.py @@ -54,8 +54,18 @@ def get_spm_globals(fname): spm_vals : array SPM global metric for each 3D volume in the 4D image. """ - # +++your code here+++ - # return + #- Load the image given by "fname". + img = nib.load(image_fname) + + #- Get the data + data = img.get_fdata() + + #- Calculate the SPM global value for each volume. + spm_vals = [] + for i in range(data.shape[-1]): + spm_vals.append(spm_global(data[..., i])) + + return spm_vals # Return the result. def main():