Hello,
Happy New Year!
The process of transitioning from brainstorm to fieldtrip from this code:[ftHeadmodel, ftLeadfield, iChannels] = out_fieldtrip_headmodel(HeadModelFile, ChannelFile, iChannels, isIncludeRef); however, I currently require assistance in reversing this transition—from fieldtrip back to brainstorm. can you help me which code to use for this?
I possess the information for the EEG channel and signal, along with the head model; however, I lack the cortext. I would greatly appreciate your guidance on how I might generate it to align with these specific features, particularly given the limited number of simulated sources, which stands at 200.
If your data is in FieldTrip, you can convert it to Brainstorm format, but it’s essential to understand the data format supported by Brainstorm. To do this, you need to familiarize yourself with Brainstorm's data structure and use a script for the conversion.
A practical and simpler approach is to follow @Sylvain's recommendation; you can simply import your raw data (including recordings and channels) into Brainstorm, then use a template to compute the lead field (LF) and perform further analyses in Brainstorm.
Thank you for your thorough response. I have a specific issue; I possess all my data but require the cortex to align with my simulated datasets. I currently have 66 simulated sources and would like the cortex tailored to match these, rather than the 15002 provided.
Could you please advise on the steps I can take to achieve this?
I have the Leadfield corresponding to 66 sources and would like to inquire about how I can obtain the corresponding cortex. Is it possible?
In Brainstorm, if we calculate the Leadfield using the OpenMEEG BME method, it appears to use 15002 vertices. Can I derive a logical representation with these 66 sources?
I would greatly appreciate your guidance on this matter.
I have the Leadfield corresponding to 66 sources and would like to inquire about how I can obtain the corresponding cortex. Is it possible?
a cortex with 66 vertices will not look like a cortex but just a weird bulbe surface.
15,000 vertices is the default and recommended number for achieving acceptable accuracy in computations and a realistic representation of the cortex shape. However, you can use any number of vertices as needed.
If you want less, You can simply click on the cortex and then downsample the surface to the desired number of vertices.
Is there any reason why you want to use only 66 sources?
I have data encompassing 66 sources, some of which are currently active. I possess a lead field with dimensions of 66x64, corresponding to the 66 number of sources. I want information from Cortex that aligns with this lead field(66*64), as it would be highly beneficial for my analysis. Specifically, I need the related data on vertconn and vertices. Having all this information consolidated from the attached Cortex image would be greatly beneficial to me.
You can do that by following these steps, but I'm not sure how you will explore a cortex with 66 vertices.
3D Coordinates Import:
The 3D coordinates of your 66 sources and 64 channels can indeed be imported into Brainstorm.
Building a Brainstorm Surface File:
Using the provided function db_template('surfacemat') generates a surface template in Brainstorm. The variable template will contain the structure for the surface file.
Using a Cortex Surface:
Exporting the cortex surface to MATLAB via the Brainstorm interface (Right-click > Export to MATLAB) is a valid way to work with an existing structure.
Modifying Vertices:
Setting Vertices = your 66 sources [x, y, z] in the exported structure is correct. Ensure the source data matches the expected format (Nx3 array for x, y, z).
Generating Faces with delaunayTriangulation:
Using the delaunayTriangulation function to compute the triangular faces of the surface is appropriate. Here's a quick MATLAB example:
Assign Faces back to the Faces field of your surface structure.
Importing Back to Brainstorm:
After modifying the structure, import it back to Brainstorm using Right-click > Import from MATLAB. Ensure the modified structure follows the Brainstorm surface file format.
Once imported back to Brainstro, vertconn will be computed automatically.