From 32b5cf00c52b5561c27465a162db487fd406df8a Mon Sep 17 00:00:00 2001 From: sciqd Date: Mon, 4 Sep 2023 11:55:10 +0300 Subject: [PATCH] For week 4 excercise --- spm_funcs.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spm_funcs.py b/spm_funcs.py index 450c1ab..016d9f2 100644 --- a/spm_funcs.py +++ b/spm_funcs.py @@ -55,6 +55,13 @@ def get_spm_globals(fname): SPM global metric for each 3D volume in the 4D image. """ # +++your code here+++ + img = nib.load(fname) #- Load the image given by "fname". + data = img.dataobj #- Get the data + spm_vals = [] #- Calculate the SPM global value for each volume. + for i in range(data.shape[-1]): + vol = data[..., i] + spm_vals.append(spm_global(vol)) + return spm_vals # Return the result. # return