xxlya / BrainGNN_Pytorch

A preliminary implementation of BrainGNN
145 stars 34 forks source link

Interpretability of BrainGNN #4

Closed mariliarosa4 closed 3 years ago

mariliarosa4 commented 3 years ago

How can I get the interpretability from ROIs activation?

xxlya commented 3 years ago

From score1 and score2 shown on line 75 at https://github.com/xxlya/BrainGNN_Pytorch/blob/main/net/braingnn.py. Thx! X

mariliarosa4 commented 3 years ago

From score1 and score2 shown on line 75 at https://github.com/xxlya/BrainGNN_Pytorch/blob/main/net/braingnn.py. Thx! X

How can I associate the scores with respective ROI?How can I associate the scores with respective ROI? I would like to generate a view as in Fig 6 of your amazing article. Could you help me?

xxlya commented 3 years ago

You can save the scores as stats map in nii format then use any visualization tool to overlay it to a standard brain. We used https://nilearn.github.io/ https://nilearn.github.io/ for visualization. Thanks :)

On Oct 2, 2021, at 10:54 AM, Marilia Rosa @.***> wrote:

From score1 and score2 shown on line 75 at https://github.com/xxlya/BrainGNN_Pytorch/blob/main/net/braingnn.py https://github.com/xxlya/BrainGNN_Pytorch/blob/main/net/braingnn.py. Thx! X

How can I associate the scores with respective ROI?How can I associate the scores with respective ROI? I would like to generate a view as in Fig 6 of your amazing article. Could you help me?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/xxlya/BrainGNN_Pytorch/issues/4#issuecomment-932792995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIYS2KWMGY5F65QBQZMBZLUE5BMJANCNFSM5FBGQISQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mariliarosa4 commented 3 years ago

The variable score1 and score 2 are tensors and generate a 1D nii image each one. Most nilearn functions expects 3D file. Is that correct? I think I'm missing something

xxlya commented 3 years ago

For example, given a 3D atlas with N regions, for n in [N], you replace the voxel value of n with score1[n].

On Oct 2, 2021, at 11:56 AM, Marilia Rosa @.***> wrote:

The variable score1 and score 2 are tensors and generate a 1D nii image each one. Most nilearn functions expects 3D file. Is that correct? I think I'm missing something

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/xxlya/BrainGNN_Pytorch/issues/4#issuecomment-932803748, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIYS2P2SLUKE42LW2SRR3LUE5IXXANCNFSM5FBGQISQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mariliarosa4 commented 3 years ago

During the training, variable score1 has shape (10000,) and I'm using the original code based on cc200 atlas. How can I convert this array into a brain visualization as you said?

I've been tried this: from nilearn.input_data import NiftiMasker import nibabel as nib import numpy as np masker = NiftiMasker() atlas_image = nib.load('cc200_roi_atlas.nii.gz') fmri_masked = masker.fit(atlas_image) score1_nii = nib.load('score1.nii.gz').get_fdata() score1_nii_xpand = np.expand_dims(score1_nii, axis=0) weight_img = masker.inverse_transform(score1_nii_xpand)

but I got TypeError: X must be of shape (samples, 43413).

xdjwolf commented 2 years ago

image