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

Issue transforming fsaverage164k to fslr32k #169

Open
1 task done
VictorBarnes opened this issue Aug 1, 2024 · 1 comment
Open
1 task done

Issue transforming fsaverage164k to fslr32k #169

VictorBarnes opened this issue Aug 1, 2024 · 1 comment

Comments

@VictorBarnes
Copy link

VictorBarnes commented Aug 1, 2024

Description of issue

Hi team,

I'm encountering some issues when transforming fsaverage 164k annotations to fslr 32k.

Here I load the flumazenil annotation (in fsaverage 164k), mask out the medial wall vertices, and plot the distribution.

import nibabel as nib
import matplotlib.pyplot as plt
from neuromaps.datasets import fetch_annotation, fetch_atlas

flum_files = fetch_annotation(desc="flumazenil", space="fsaverage", den="164k")
flum_lh = nib.load(flum_files[0]).darrays[0].data
fsavg = fetch_atlas(atlas="fsaverage", density="164k")
medmask = nib.load(fsavg["medial"][0]).darrays[0].data.astype(bool)

plt.hist(flum_lh[medmask], bins=100)
plt.show()

image

Everything looks fine so far but when I transform to fslr 32k, mask the medial wall, and plot the distribution I get a bunch of vertices with a value of 0 (which I assume to be medial wall vertices).

from neuromaps.transforms import fsaverage_to_fslr

flum_fslr = fsaverage_to_fslr(flum_files, "32k")
fslr = fetch_atlas(atlas="fsLR", density="32k")
medmask = nib.load(fslr["medial"][0]).darrays[0].data.astype(bool)

plt.hist(flum_fslr[0].darrays[0].data[medmask], bins=100)
plt.show()

image

So the fslr 32k mask isn't properly masking out all the medial wall vertices. Plotting these zero indices on the surface seems to indicate that these are medial vertices that just haven't been masked out properly.

image

Do you know what might be the issue? There could be something wrong with the way I'm doing the transforms so do let me know if that's the case. Also, I'm not sure if this is related to #135 ?

Which fsaverage template version does neuromaps use? Maybe the issue is due to the flumazenil data having a different fsaverage version?

Thanks in advance!

Code of Conduct

  • I agree to follow the neuromaps Code of Conduct
@PigeonXiong
Copy link

Hi Vector,

I have encountered similar issues like you, and I think these were caused by:

  • In the original files, missing vertex are marked as NaN for their value, and wouldn't be displayed in histogram
  • In the transferred data, these vertex are marked as 0, which results in more 0s coming out in your histogram

If you check the index of these 0/NaN vertex, you will see that they are corresponding to each other.

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