-
Notifications
You must be signed in to change notification settings - Fork 111
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
Computation of Local Connectivity matrix with own cortex data #694
Comments
Thanks for the code sample, the issue is that a CorticalSurface only represents the geometry of a surface and is actually an attribute of a LocalConnectivity instance and not vice versa. The LocalConnectivity instance should then become an attribute of the Cortex. With 10+ years hindsight we can say this is not the obvious way to do it, but once you are aware of TVB's hierarchical classes, you can just check the classes and see how to compose the pieces. Please give it a try, looking at the demos/classes and otherwise we can write it out. |
Dear Marmaduke, thank you for your reply, I am looking into the details and will revert asap! |
Dear @maedoc, I worked with the above references as you suggested, to my eyes this look working, however I would kindly ask you if in your opinion the below is correct.
Steps to reproduce ctx_surface = surfaces.CorticalSurface.from_file("/TVB_output/sub-01_Cortex.zip") white_matter = connectivity.Connectivity.from_file('/TVB_output/sub-01_Connectome.zip') ctx= Cortex.from_file(region_mapping_file="/TVB_output/sub-01_region_mapping.txt") #ctx.local_connectivity.matrix = None #should not be needed as I stated matrix=None above sio.savemat('local_connectivity'+ '.mat', {'local_connectivity': ctx.local_connectivity.matrix}) from tvb.core.neocom import h5 |
A last question: could you help to clarify what the matrix n x m generated for the local connectivity represents exactly when imported in Matlab and made from sparse to full matrix? |
I think this should force recomputation yes; if it pauses a bit at that step then it's recomputing.
a sigmoid is not a good connectivity kernel because it's usually not compact (ie. going to zero with radius quickly). you should look at the equations module for the other options. for the syntax it should be
good question but I defer to a colleague on it @liadomide can you look plz ?
it's the connectivity between the n vertices on the surface, due to lateral gray fiber connectivity along the cortical surface. please see Sanz Leon 2015 NeuroImage paper fro more details. |
Dear @maedoc , first of all let me thank for your help and kindness. I had a further look, the code above works if I load my own data but do not use my cortex: this made me double check my cortex surface (cortex.zip) that has been generated using the TVB Processing Pipeline "Convert2TVB" ( https://github.com/BrainModes/tvb-pipeline-converter/blob/master/convert2TVB_format.py ). This script removes all the triangles and vertices that were generated by Freesurfer as pial surfaces but actually do not correspond to a cortical surface (lines 131-153 of the above referenced script), meaning they correspond to a point in space where a subcortical region or white matter (e.g. Corpus Callosum) are present. This creates a warning also in the GUI (see attached) Comparing it with the TVB default cortex, it looks quite evident that this latter is instead a closed surface for each hemisphere (also as shown in Sanz Leon 2015). I had a look also to the TVB Users Google Forum, finding the following discussion https://groups.google.com/g/tvb-users/c/Hs8ZmkmT59E/m/Ughj9ET4SCIJ , where a similar topic was treated. I would be grateful if you could suggest an answer to the below points:
I hope the above was not too much, and would be grateful if you could kindly reply, or point me to the proper direction. Greatly appreciated, thanks again, M |
The error message suggests that you can not upload the LocalConnectivity alone in web GUI, but you need to export and upload the linked datatypes also. For this case, linked it would be the CorticalSurface object (same GUI are referred by the LocalConnectivity). |
Describe the bug
Dear all, I am trying to use my own data for the cortex (not the default values), compute the local connectivity matrix with different parameters and save it to a matlab file. For the default cortex it was shown how to do it at (https://groups.google.com/g/tvb-users/c/cyHKATuXfTU/m/CI-H9_kKBgAJ) .
In order to make it work with my data it was suggested at this post (https://groups.google.com/g/tvb-users/c/8RNS6cNxUzs) to use the class "surfaces.CorticalSurface" to load my cortex.
So I am trying with the below code, derived from the link above, however I get an error 'CorticalSurface' object has no attribute 'local_connectivity'
Steps to reproduce
*%matplotlib widget
import matplotlib.pyplot as plt
import numpy
from tvb.simulator.plot.head_plotter_3d import HeadPlotter3D
from tvb.datatypes import surfaces, connectivity, local_connectivity
from scipy import io as sio
ctx = surfaces.CorticalSurface.from_file("/sub-01_cortex.zip")
loc_conn = local_connectivity.LocalConnectivity(cutoff=20.0, surface=ctx)
loc_conn.equation.parameters['sigma'] = 10.0
loc_conn.equation.parameters['amp'] = 1.0
loc_conn.equation.parameters['midpoint'] = 0.0
loc_conn.equation.parameters['offset'] = 0.0
ctx.local_connectivity.matrix = None
ctx.local_connectivity = loc_conn
ctx.coupling_strength = numpy.array([0.0115])
ctx.configure()
ctx.compute_local_connectivity()
sio.savemat('local_connectivity'+ '.mat', {'local_connectivity': ctx.local_connectivity.matrix})*
Expected results
Compute the local connectivity matrix with my cortex and the parameters above and save the computed matrix to a file in matlab format
Actual results
See screenshot of code and error.
Additional information
TVB2.7.2
MacOS12.6.8
I can provide the cortex.zip file if you provide an email
The text was updated successfully, but these errors were encountered: