jbburt / wbplot

Automated plotting of neuroimaging maps from Python using Connectome Workbench.
GNU General Public License v3.0
13 stars 6 forks source link

Plotting with different meshes? #6

Closed tmspvn closed 2 years ago

tmspvn commented 3 years ago

Would be possible to add the ability to change S1200.L.very_inflated_MSMAll.32k_fs_LR.surf.gii (or right) to an arbitrary .surf.gii?

jbburt commented 3 years ago

It might be possible in theory, but I'm not entirely sure. Is there a specific use case that you have in mind? Because if you just want to swap out the default surfaces for your surfaces of choice, that would be much easier and I could walk you through the steps you would need to take to do it (I just did it myself, to be sure).

As far as I can tell, to specify the surface files programmatically would require editing the data inside the Human.scene file to change which surface file is currently loaded in the scene(s) for which you wish to auto-generate images. I poked around a bit but there is a lot going on inside scene files and I don't really understand the structure...

tmspvn commented 3 years ago

I do work with neonates that is why I need to change the surface!

I tried myself to swap the surface and the .scene file but it did not work. Assuming I want to do it non-programmatically what would be the way?

jbburt commented 3 years ago

are you able to manually open your surface file in Connectome Workbench and visualize a brain map on it (ie, outside of wbplot)? and do you know if your surface file uses a standard 32k mesh?

tmspvn commented 3 years ago

Of course I do, my surface are not 32k meshes but I know how to resample them in case of need

jbburt commented 3 years ago

Sorry for the delay in getting back to you. Maybe it would help if I explained how wbplot actually works. When you provide dscalar or pscalar values, those data are written (programmatically) to neuroimaging files which have been pre-loaded into a scene file. To change the surface files, you just need to change the surface files which are pre-loaded in the scenes inside the scene file. All of the data files exist in the data directory inside the package.

If you want to change the surface file, the most straightforward way to do it would probably be the following:

  1. Navigate to the location of the data directory in your local wbplot package. If you don't know where it is, open an interactive Python shell and run import wbplot followed by print(wbplot.__file__).
  2. Open the Human.scene file from the data directory in Connectome Workbench and show the scene you plan to use (e.g., bilateral cortex dense).
  3. Copy your new surface files to the HumanCorticalParcellations directory.
  4. Open your new surface files in Connectome Workbench (File > Open File).
  5. Change the surface files shown in the scene (at the top of the application window).
  6. Overwrite the existing scene with your new scene. To do this, navigate back to the scene window and click "Replace" on the right-hand side.
  7. Save the edited scene file.
  8. Overwrite the existing scene.zip file. The easiest way to do this is probably to unzip the current scene.zip file, replace the contents of that directory which you have changed (in particular, the HumanCorticalParcellations directory and the new scene file), and then re-zip it.

For this procedure to work I think you'll need your data to be on a 32k mesh. Otherwise, you'll need to change both the surface file as well as the template file.

tmspvn commented 3 years ago

Thank you!

I have followed the suggestions of the developers of connectome workbench and it seems .scene files just contains a lot of info regarding the connectome workbench interface. Hence, by just changing the file names (surfaces and metrices) inside the .scene file you can change systematically what is being plotted