noahbenson / neuropythy

A neuroscience library for Python, intended to complement the existing nibabel library.
GNU Affero General Public License v3.0
115 stars 21 forks source link

Bayesian Inference of Retinotopic Maps #23

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello Dr. Benson,

Hope all is well. I am a PhD student in the lab of Dr. Marieke Mur at the University of Western Ontario and I am interested in using your methodology to predict subject retinotopic maps using a Bayesian approach. However, I do have a few questions that I hope you can help me with.

Some context: We collected some data using Kendrick Kay's retinotopy experiment and analyzed the data using the analyzePRF MATLAB scripts (the same stimulus protocol and analysis scripts you used for creating the 7T HCP Retinotopy Dataset). We acquired 12 runs of data (4 runs of each of the CCW, Expand, and Multibar conditions) in a single subject. We used SPM12 to pre-process the data and CAT12 to perform segmentation and surface-based analysis. I am now at the point where I have NIfTI files describing the explained variance of gray matter voxel time courses by the fit pRF model, the size (radius) of the fit pRF for each gray matter voxel, and the x- and y-coordinates of the pRF centers (as described in your retinotopy tutorials).

As mentioned, so far I have used SPM12 in combination with CAT12 (rather than Freesurfer as described in your tutorials) for the analysis and the generation of these NIfTI files. I am now moving to use your neuropythy toolbox (specifically, the postproc_pRFs.py script) and was wondering if this will pose any problems downstream? For example, the postproc_pRFs script requires a Freesurfer subject ID but I was wondering whether this is a strict requirement or whether it is possible to work around it if I have the output folder containing the required zipped NIfTI files (attached)? Also, do these scripts (postproc_pRFs.py and register_retinotopy.py) require Freesurfer to be set up on the device or can they run independently if I have the necessary files? For instance, I can use CAT12 to generate surface files describing polar angle, eccentricity, explained variance etc. (by projecting the retinotopy data onto the fsaverage template for example), but the caveat is that files will be generated in GIfTI format.

To add, CAT12 does produce a Freesurfer like directory with the required label, surf, and mri files (attached images)

I hope I have provided you with sufficient information. Please let me know if you need any additional information or materials from my end.

Thank you!

Best, Reebal exampleOutputs.zip image image image image

noahbenson commented 3 years ago

Hi Reebal,


TL;DR—neuropythy doesn't support CAT12 (I have never heard of CAT12). Even if CAT12 produces outputs similar to FreeSurfer, I cannot guarantee that running the Bayesian inference on it would produce correct answers—it could perform fsaverage registration differently than FreeSurfer and this would break the entire Bayesian Inference tool. This page (the section on "Performing Bayesian Inference on a subject") explains what files you need in addition to a FreeSurfer subject directory in order to use the Bayesian Inference tools.


Unfortunately, I have never heard of CAT12 and have no idea whether it would work. In order to work with neuropythy, it would need to produce a directory structure for the subject that is either the same as a freesurfer directory with the same file formats or the same as a Human Connectome Project subject directory. Gifti files will not work in a freesurfer directory with neuropythy because gifti files aren't part of freesurfer's standard directory structure. Neuropythy can read Gifti files, but because Gifti files can hold just about any kind of data, they often can't be used in the neuropythy command lines (either because they hold the wrong kind of data or because neuropythy can't by itself figure out which kind of data in the gifti file you want it to operate on). It sounds like CAT12 might produce a compatible output, but I won't be able to help you figure this out or debug this if it doesn't just work.

Additionally, if CAT12 performs registration to the fsaverage subject differently than FreeSurfer, there's a strong possibility that the Bayesian Inference would run without error on a CAT12 directory but produce wrong answers. This isn't even something I am able to check using the files you sent me.

Further, the scripts you reference (postproc_pRFs.py and register_retinotopy.py) aren't part of neuropythy. As a warning, these scripts are part of a set of scripts I wrote for use specifically with the NYU Center for Brain imaging several years ago, prior to the release of the BIDS spec (and NYU's adoption of it). I don't recommend using these scripts verbatim anymore, even if you are at NYU; though you might be able to get them to work or to to get useful code out of them. In particular, the postproc_pRFs.py script is meant to be run on pRFs processed with VistaSoft, not analyzePRFs, and I do not believe that the two output formats will be 100% compatible even if CAT12 and FreeSurfer directories are compatible (I think VistaSoft outputs y coordinates as image coordinates, not visual field coordinates). Again, it might work if you have organized your files just right, but even if so, I would be very careful and would check that it's not doing anything strange like inverting your y-coordinate.

Instead of trying to get these old scripts to work, I would try to read through this page (the section on "Performing Bayesian Inference on a subject") and try running the registration algorithm directly using neuropythy. There are example command-lines there, and there are explanations for how to format all of your data, independent of the tool you used to process the pRFs. Again, though, I would not assume that this will work with CAT12 directories.

Good luck. -Noah