Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

structural parcellation file #245

Open
sunflower-smile opened this issue Apr 16, 2024 · 7 comments
Open

structural parcellation file #245

sunflower-smile opened this issue Apr 16, 2024 · 7 comments

Comments

@sunflower-smile
Copy link

  1. When I try to calculate power_maps and coh_maps using EEG data after source localization (using the Schaefer2018_200Parcels template), ”Importing Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm.nii.gz results in a 'file not found' error."

  2. In the FAQ section "Can I use a structural parcellation (e.g. AAL or Desikan-Killiany atlas)?" ,it is mentioned that having too many parcels from source localization can also have an impact.

Is there any problem with my understanding? If you can solve the above doubts, thank you very much.

@cgohil8
Copy link
Collaborator

cgohil8 commented Apr 16, 2024

Have you already source localised / parcellated your data? Now you'd like to plot a power map for the source localised data?

  1. The available parcellations (that come with the packages) are listed here: https://osl-dynamics.readthedocs.io/en/latest/autoapi/osl_dynamics/files/parcellation/index.html. If you're using these then you can pass just the name, e.g.
power.save(
    ...
    parcellation_file="fMRI_parcellation_ds8mm.nii.gz",
    ...
)

However, if it's not on the list, you can pass the full path to the file on your computer instead, e.g. if the parcellation was in my "Desktop" directory, i can pass:

power.save(
    ...
    parcellation_file="/Users/cgohil/Desktop/fMRI_parcellation_ds8mm.nii.gz",
    ...
)

Note, this parcellation files must be a 4D image containing the masks for each parcel.

  1. There's nothing stopping you running the code, i.e. you can calculate the source activity at a large number of parcels. However, you will find that the activity of nearby parcels is very similar (due to volume conduction). If you calculated a network, you will find high connectivity ('ghost interactions'). You can only remove these ghost interactions if you have a small number of parcels. There's nothing stopping you from using a high density parcellation as long as you are aware of this issue and don't over interpret the connectivity. If you're only interested in power, then this might not be a problem and you can use a high density parcellation..

@sunflower-smile
Copy link
Author

sunflower-smile commented Apr 16, 2024

Thank you very much for your reply. I did use DyNeMo model and TDE-HMM model to explore the hidden state fireworks dynamics of EEG data after locating the source of EEG data through brainstorm. However, according to your reply, I will:

# Source reconstruction files used to create the source space data
mask_file = "E:/JupyterNoteBook/osl/osl/source_recon/parcellation/files/MNI152_T1_1mm_Brain.nii.gz"
parcellation_file = (
"E:/JupyterNoteBook/osl/osl/source_recon/parcellation/files/Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm.nii.gz "
)

However, the following problems were encountered:

IndexError: boolean index did not match indexed array along dimension 0;  dimension is 39676 but corresponding boolean dimension is 7221032

You mentioned "Note, this parcellation files must be a 4D image containing the masks for each parcel."
So is this the main reason for the error? Or what should I do about it?

@sunflower-smile
Copy link
Author

Thank you very much for your reply!
The code for the DyNeMoC model is not publicly available on your team's home page. With all due respect, would you consider releasing the code for this model?

@cgohil8
Copy link
Collaborator

cgohil8 commented Apr 18, 2024

IndexError: boolean index did not match indexed array along dimension 0;  dimension is 39676 but corresponding boolean dimension is 7221032

I would resample the parcellation file to match MNI152_T1_1mm_Brain.nii.gz with FSL flirt:

flirt -in Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm.nii.gz -ref MNI152_T1_1mm_Brain.nii.gz -out Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm_resampled.nii.gz -applyisoxfm 1

and use Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm_resampled.nii.gz to parcellate your data. Please close this issue if this resolves your issue.

The code for the DyNeMoC model is not publicly available on your team's home page. With all due respect, would you consider releasing the code for this model?

Unfortunately DyNeMoC's not supported in this repo. Note, it's a simple extension to take the inferred alphas and/or mode/state covariances (or means) and use these in a machine learning predictor with sklearn.

@sunflower-smile
Copy link
Author

I'm sorry for the continued issue despite resampling the brain region file as per your guidance. Additionally, I appreciate your assistance with DyNeMoC-related inquiries. I'll delve deeper into these models to enhance my understanding.

@cgohil8
Copy link
Collaborator

cgohil8 commented Apr 19, 2024

Okay, resampling both they should definitely match i think:

flirt -in MNI152_T1_1mm_Brain.nii.gz -ref MNI152_T1_1mm_Brain.nii.gz -out MNI152_T1_1mm_Brain_resampled.nii.gz -applyisoxfm 1
flirt -in Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm.nii.gz -ref MNI152_T1_1mm_Brain.nii.gz -out Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm_resampled.nii.gz -applyisoxfm 1

What do you get for dim1-dim4 when you do:

fslinfo MNI152_T1_1mm_Brain_resampled.nii.gz
fslinfo Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm_resampled.nii.gz

Note, you need to recompute your source reconstruction with this new parcellation file then pass

mask_file="MNI152_T1_1mm_Brain_resampled.nii.gz",
parcellation_file="Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm_resampled.nii.gz",

when you plot.

@sunflower-smile
Copy link
Author

I am truly sorry that despite re-sampling the brain region file according to your instructions, the problem still exists.

# Source reconstruction files mask_file = "E:/JupyterNoteBook/osl-dynamics-main/osl_dynamics/files/mask/MNI152_T1_1mm_Brain_resampled.nii.gz" parcellation_file = "E:/JupyterNoteBook/osl-dynamics-main/osl_dynamics/files/parcellation/Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm_resampled.nii.gz""

IndexError: boolean index did not match indexed array along dimension 0; dimension is 39676 but corresponding boolean dimension is 7221032

其中:
miss@DESKTOP-9FIJ8CQ:~$ fslinfo MNI152_T1_1mm_Brain_resampled.nii.gz
data_type FLOAT32
dim1 182
dim2 218
dim3 182
dim4 1
datatype 16
pixdim1 1.000000
pixdim2 1.000000
pixdim3 1.000000
pixdim4 1.000000
cal_max 0.000000
cal_min 0.000000
file_type NIFTI-1+

miss@DESKTOP-9FIJ8CQ:~$ fslinfo Schaefer2018_200Parcels_7Networks_order_FSLMNI152_1mm_resampled.nii.gz
data_type FLOAT32
dim1 182
dim2 218
dim3 182
dim4 1
datatype 16
pixdim1 1.000000
pixdim2 1.000000
pixdim3 1.000000
pixdim4 0.000000
cal_max 0.000000
cal_min 0.000000
file_type NIFTI-1+

I have also checked the parcellation file of schaefer200MNI, and there is still the same problem. I don't know what the problem is except for the problem. I'm really sorry to bother you for so long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants