help > Manually build an overlay with MNI coordinates
Showing 1-5 of 5 posts
May 8, 2020 08:05 PM | lkocneuro
Manually build an overlay with MNI coordinates
Hi, I have a set of nodes I am projecting onto a GII scalp surface
using MNI coordinates in .node files. These nodes are average
locations of TMS stimulation, computed across subjects. Therefore,
I would also like to include an overlay that shows the standard
error of the locations across subjects. From the standard error of
the X, Y and Z MNI coordinates, I can easily grab the nodes that
fit within these bounds by opening my GII file. Now that I have the
MNI coordinates of the overlay I would like to build, I don't know
how to open these as an overlay on my scalp surface.
Is there a way to manually build an overlay, from these coordinates? For example, can I convert MNI coordinates into a NII file that I can then use an overlay?
Thanks very much!
Is there a way to manually build an overlay, from these coordinates? For example, can I convert MNI coordinates into a NII file that I can then use an overlay?
Thanks very much!
May 11, 2020 03:05 PM | Chris Rorden
RE: Manually build an overlay with MNI coordinates
I can think of several ways to do this.
1. Create a .node file (here named ~/tms.node) where the radius reflects the standard error:
60 0 60 1 4 TMS
73 10 40 1 3 TMS2
You can then run the following script to create the attached image:
import gl
gl.resetdefaults()
gl.colorbarvisible(0)
gl.meshload('scalp.mz3')
gl.meshcolor(255,222,180)
gl.overlayload('BrainMesh_ICBM152Right.mz3')
gl.overlaycolorname(1,'surface')
gl.shaderxray(1.0, 0.2)
gl.azimuthelevation(90, 15)
gl.edgeload('~/tms.node')
gl.nodehemisphere(0)
Here is a script that shows this approach.
2. You could make spheres of the radius of your error and save them as obj meshes using this script. This shows an automated SPM analysis script that uses this approach.
3. You could create a NIfTI image where the cortical location has the desired error saved as the voxel value. You could then load this overlay, creating an image similar to Scripting/Python/basic_paint_surface. You would want to make sure you get the cortical location correct for your mesh and determine the radius. While not complete, this script illustrates the process.
1. Create a .node file (here named ~/tms.node) where the radius reflects the standard error:
60 0 60 1 4 TMS
73 10 40 1 3 TMS2
You can then run the following script to create the attached image:
import gl
gl.resetdefaults()
gl.colorbarvisible(0)
gl.meshload('scalp.mz3')
gl.meshcolor(255,222,180)
gl.overlayload('BrainMesh_ICBM152Right.mz3')
gl.overlaycolorname(1,'surface')
gl.shaderxray(1.0, 0.2)
gl.azimuthelevation(90, 15)
gl.edgeload('~/tms.node')
gl.nodehemisphere(0)
Here is a script that shows this approach.
2. You could make spheres of the radius of your error and save them as obj meshes using this script. This shows an automated SPM analysis script that uses this approach.
3. You could create a NIfTI image where the cortical location has the desired error saved as the voxel value. You could then load this overlay, creating an image similar to Scripting/Python/basic_paint_surface. You would want to make sure you get the cortical location correct for your mesh and determine the radius. While not complete, this script illustrates the process.
May 22, 2020 02:05 PM | lkocneuro
RE: Manually build an overlay with MNI coordinates
Thank you so much for your response. What is closest to what I am
looking for is Method 3 that you suggested. If I could manually
build a Nifti file that would have as the "peak activation" the
width of the standard error, I could overlay it very nicely onto my
obj file AND load in my node file to show the average location of
stimulation. However, I am not sure how I can do that using the
script you provided, as it seems to automatically extract peak
activation from an existing nii file, as opposed to write a "peak
activation" (coordinates for width and depth of the standard error)
to a Nifti file. I will play around with the script and see if I
can make this work.
Otherwise, I will just use nodes with different widths, but these cannot reflect different standard errors on the X and Y axes for example, as they are spheres.
Thanks again!
Otherwise, I will just use nodes with different widths, but these cannot reflect different standard errors on the X and Y axes for example, as they are spheres.
Thanks again!
May 22, 2020 04:05 PM | Chris Rorden
RE: Manually build an overlay with MNI coordinates
You can create nodes of smaller diameter to define the error, and
connect them with edges.
Your node file would look like this:
60 0 60 1 2 TMS
73 10 40 1 2 TMS2
50 0 60 1 1 TMS+x
70 0 60 1 1 TMS-x
60 10 60 1 1 TMS+y
60 -10 60 1 1 TMS-y
60 0 50 1 1 TMS+z
60 0 70 1 1 TMS-z
93 10 40 1 1 TMS2+x
53 10 40 1 1 TMS2-x
73 30 40 1 1 TMS2+y
73 -10 40 1 1 TMS2-y
73 10 60 1 1 TMS2+z
73 10 20 1 1 TMS2-z
End your edge file would look like this:
1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 0 0 0 0 0 0 0 0
0 0 0 0 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0 0 0 1 1
Your node file would look like this:
60 0 60 1 2 TMS
73 10 40 1 2 TMS2
50 0 60 1 1 TMS+x
70 0 60 1 1 TMS-x
60 10 60 1 1 TMS+y
60 -10 60 1 1 TMS-y
60 0 50 1 1 TMS+z
60 0 70 1 1 TMS-z
93 10 40 1 1 TMS2+x
53 10 40 1 1 TMS2-x
73 30 40 1 1 TMS2+y
73 -10 40 1 1 TMS2-y
73 10 60 1 1 TMS2+z
73 10 20 1 1 TMS2-z
End your edge file would look like this:
1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 0 0 0 0 0 0 0 0
0 0 0 0 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0 0 0 1 1
May 25, 2020 04:05 PM | lkocneuro
RE: Manually build an overlay with MNI coordinates
That's perfect! Thanks so much for your help.