Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions spm_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
%run spm_funcs.py
"""





import numpy as np

import nibabel as nib
Expand All @@ -42,8 +46,23 @@ def spm_global(vol):


def get_spm_globals(fname):

img = nib.load(fname)

data = img.get_fdata()

spm_vals = []

for k in range (data.shape[-1]):
vol = data[...,k]
spm_vals.append(spm_global(vol))
return spm_vals


""" Calculate SPM global metrics for volumes in image filename `fname`



Parameters
----------
fname : str
Expand All @@ -54,6 +73,9 @@ def get_spm_globals(fname):
spm_vals : array
SPM global metric for each 3D volume in the 4D image.
"""



# +++your code here+++
# return

Expand Down