From 6fc13b8ec2b903b8c167ff42af99a648fb9d7147 Mon Sep 17 00:00:00 2001 From: Omer Faruk Gulban Date: Tue, 21 Feb 2023 11:32:13 +0100 Subject: [PATCH] Complete working example. Min max range of data_SS looks incorrect in ITKSNAP --- wip/read_glm_export_nifti.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/wip/read_glm_export_nifti.py b/wip/read_glm_export_nifti.py index 977b3ea..c62bec6 100644 --- a/wip/read_glm_export_nifti.py +++ b/wip/read_glm_export_nifti.py @@ -10,15 +10,38 @@ # ============================================================================= # Load vmr -header, data = bvbabel.glm.read_glm(FILE) +header, data_R2, data_SS, data_beta, data_fitted, data_arlag = bvbabel.glm.read_glm(FILE) # See header information pprint.pprint(header) +# ----------------------------------------------------------------------------- # Export nifti basename = FILE.split(os.extsep, 1)[0] -outname = "{}_bvbabel.nii.gz".format(basename) -img = nb.Nifti1Image(data, affine=np.eye(4)) + +# Multiple regression R value +outname = "{}_R2_bvbabel.nii.gz".format(basename) +img = nb.Nifti1Image(data_R2, affine=np.eye(4)) +nb.save(img, outname) + +# Sum of squares values +outname = "{}_SS_bvbabel.nii.gz".format(basename) +img = nb.Nifti1Image(data_SS, affine=np.eye(4)) +nb.save(img, outname) + +# Beta values +outname = "{}_beta_bvbabel.nii.gz".format(basename) +img = nb.Nifti1Image(data_beta, affine=np.eye(4)) +nb.save(img, outname) + +# Fitted data after regression +outname = "{}_fitted_bvbabel.nii.gz".format(basename) +img = nb.Nifti1Image(data_beta, affine=np.eye(4)) +nb.save(img, outname) + +# Auto-regression lag value +outname = "{}_atrlag_bvbabel.nii.gz".format(basename) +img = nb.Nifti1Image(data_beta, affine=np.eye(4)) nb.save(img, outname) print("Finished.")