gallantlab / pycortex

Pycortex is a python-based toolkit for surface visualization of fMRI data
https://gallantlab.github.io/pycortex
BSD 2-Clause "Simplified" License
584 stars 137 forks source link

the problem when the brain is flatten #376

Open luoying050601 opened 4 years ago

luoying050601 commented 4 years ago

Hello, does anyone here to help me? Currently, I am learning to use pycortex for create a flatten map for specific subjects. I used the freesurfer to cut the full surface. But when I using brain viewer to display the flatten brain, it looks so odd. Can you tell me what the problem is if you knew it?

flatted
drorcohengithub commented 4 years ago

I'm not an expert, but it looks to me like the flattening did not succeed. It often takes a couple (or more) times to get this right. After mris_flatten is finished you can view the flattened surface on tksurfer (File->Patch->Load Patch and load the output of your mris_flatten command). If the curvature is highly discontinuous - like you have here - then flattening did not succeed. You need to recut and reflatten. I have a sneaky feeling something more may be wrong here but I'd start with that.

luoying050601 commented 4 years ago

I'm not an expert, but it looks to me like the flattening did not succeed. It often takes a couple (or more) times to get this right. After mris_flatten is finished you can view the flattened surface on tksurfer (File->Patch->Load Patch and load the output of your mris_flatten command). If the curvature is highly discontinuous - like you have here - then flattening did not succeed. You need to recut and reflatten. I have a sneaky feeling something more may be wrong here but I'd start with that.

Thanks for your reply. Cause I am a newer with freesurfer, I'm not sure how to cut it correctly. This is the cutting result of my operation by freesurfer. Can you give me some advices? image

drorcohengithub commented 4 years ago

Our lab has a "custom" way of doing it but I cannot easily share that. Perhaps the authors can direct you to some examples.

Alternatively you can try to replicate some of the published cuts, for example from here https://gallantlab.org/huth2016/, or from one of the subjects provided with pycortex. There is also a bit of info here https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOccipitalFlattenedPatch, but the image there only shows the medial view, making the cuts seem much shorter then they are.

It took me several times before I got it right so don't despair ;)

luoying050601 commented 4 years ago

Our lab has a "custom" way of doing it but I cannot easily share that. Perhaps the authors can direct you to some examples.

Alternatively you can try to replicate some of the published cuts, for example from here https://gallantlab.org/huth2016/, or from one of the subjects provided with pycortex. There is also a bit of info here https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOccipitalFlattenedPatch, but the image there only shows the medial view, making the cuts seem much shorter then they are.

It took me several times before I got it right so don't despair ;)

Thanks anyway! I have visited this link before, and I wondered if the grey area is useless? So I just cut up the surface. image

alexhuth commented 4 years ago

Hi @luoying050601! It looks like you didn't remove the medial wall (the "gray area") when you were making cuts. In freesurfer-speak, I think you need to "fill" the part of the surface you want to keep (i.e. everything BUT the medial wall), as they very vaguely say in the instructions here: https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all#Flattening

I'm sorry we don't have better docs on how to do this with Blender (instead of freesurfer), which has been our preferred method in pycortex for a while.

luoying050601 commented 4 years ago

Hi @luoying050601! It looks like you didn't remove the medial wall (the "gray area") when you were making cuts. In freesurfer-speak, I think you need to "fill" the part of the surface you want to keep (i.e. everything BUT the medial wall), as they very vaguely say in the instructions here: https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all#Flattening

I'm sorry we don't have better docs on how to do this with Blender (instead of freesurfer), which has been our preferred method in pycortex for a while.

Thanks for your reply. Actually, I did not use the Blender throughout the whole process, which makes confused for I saw the documentation referred it. Your suggestion is that I use Blender instead of Freesurfer to complete the task of cutting the surface, right? I tried to find Blender-related code execution before, but I got an error msg. Probably the order of execution is not correct.

the code I called: cortex.segment.cut_surface(sub-id,'lh') the related error message: blender -b build/bdist.macosx-10.9-x86_64/wheel/pycortex-1.1.1.data/data/share/pycortex/db/sub-18/anatomicals/cutsurf[hemi=lh,name=flatten].blend -P /var/folders/5m/pn0rbrj14078l93nbcqkz1sr0000gn/T/tmpjfx7349z Traceback (most recent call last): File "/Users/sakura/PycharmProjects/BrainBERT/src/com/sakura/test/pycortex_2D.py", line 74, in <module> cortex.segment.cut_surface('sub-18', 'lh') File "/opt/anaconda3/envs/untitled/lib/python3.8/site-packages/cortex/segment.py", line 183, in cut_surface blender.fs_cut(fname, fs_subject, hemi, freesurfer_subject_dir) ...... FileNotFoundError: [Errno 2] No such file or directory: b'blender'

It's true that the file doesn't exist.

I wonder if you could tell me which method should be called to use Blender to process Freesurfer surface data.

luoying050601 commented 4 years ago

@alexhuth I am sorry to bother you again.(Cause I don't know who else I can consult with. Actually, I got the way to open the Blender with the data from Freesurfer. And I found out how to cut the surface. Just a little question, that is I just can't figure out where the medial wall is, as the 3D image look like this: image or this: image How can I cut them out? If you could offer me some tips, it would be definitely grateful.

luoying050601 commented 4 years ago

@alexhuth Sorry to disturb you again. I wanna confirm whether the processing so far are what you suggest? Did I miss something?

image

JannaKo-med commented 1 year ago

Dear user luoying050601, I couldn't contact you for asking that's why I ask here: I really like your picture (https://user-images.githubusercontent.com/65337942/95973665-ee1c4480-0e4e-11eb-9f38-4595dd948287.png)! I am writing my dissertation at the moment for a medical PhD at LMU in Germany. Would you give me the permission to use this picture in my thesis, please? I would be very happy!

jesselb commented 1 year ago

Hi @luoying050601 did you ever figure this out? I made my cuts in Blender and am fairly certain I made my cuts correctly but my flattened brain looks very similar to yours. This should be showing pretty retinotopy angle data:

image

mvdoc commented 6 months ago

We recently found out that mris_flatten produces different results in freesurfer >= 7.0 compared to freesurfer 6. The flatmaps resulting from freesurfer 7 look exactly as the one posted above by @jesselb. We haven't figured out what changed exactly, but one solution seems to be increasing the distance matrix by passing the argument -distances 20 20 to mris_flatten. It also looks like there's no fixed parameter setting that would work in all cases. For more information, see these threads in the freesurfer's mailing list: