Extract Electric Field Intensity at certain ROI

118 views
Skip to first unread message

Rajat Joshi

unread,
Sep 10, 2021, 1:39:16 PM9/10/21
to roast-users
Dear sir/madam,
I was wondering if there is a way to know the electric field intensity (V/m) at a certain region of interest (in my case - left M1 (MNI: -38, -20, 50) ). 
I tried using the commands:

ef_all(-38, -20, 50) 
ef_mag(-38, -20, 50) 

I got an error saying "Index in position 1 is invalid. Array indices must be positive integer or logical values."

I would be grateful if you could provide me with a solution to this problem.

Regards
Rajat Joshi
National Brain Research Centre, India

Yu (Andy) Huang

unread,
Sep 19, 2021, 3:11:38 PM9/19/21
to Rajat Joshi, roast-users
Hi Rajat,

Sorry for the late reply as I was on vacation.

Unfortunately the current version of ROAST does not support reading ROI using the MNI coordinates. For now you need to convert the MNI coordinates to the voxel coordinates first and then read the corresponding values in ef_all and ef_mag.

To convert the MNI coordinates to the voxel coordinates of the model, follow this line and this line; the transformation matrix is loaded here.

Hope this helps.

--
You received this message because you are subscribed to the Google Groups "roast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to roast-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/roast-users/a046570d-6823-4048-8539-5bdddf79908en%40googlegroups.com.


--
Yu (Andy) Huang, Ph.D.

Research Fellow, Radiology Dept., Memorial Sloan Kettering Cancer Center
Rm. 321-G17P, 321 East 61st Street, New York, NY 10065
Office: 646-608-7608

Research Associate, CCNY-MSK Partnership for Artificial Intelligence
Center for Discovery and Innovation, Rm. 3.320,
85 St Nicholas Terrace, New York, NY 10031
Email: yhua...@citymail.cuny.edu; andypo...@gmail.com
Web: http://www.parralab.org/people/yu-andy-huang/

Benjamin Gibson

unread,
Oct 6, 2022, 2:17:17 PM10/6/22
to roast-users
Hello,
I am finding the code to convert MNI coordinates to voxel coordinates difficult to understand. Does anyone have an example of these in action they could share? I am trying to find electric field magnitude at MNI coordinates 49,39,-14. 

Yu (Andy) Huang

unread,
Oct 8, 2022, 9:04:40 AM10/8/22
to Benjamin Gibson, roast-users
Hi Benjamin,

Once you have the transform matrix mni2mri (see below on how to get it), simply do mni2mri*[49,39,-14,1]' to get the voxel coordinates, then you can use the voxel coordinates to query the E-field magnitude at that location.

Hope this helps.

Marija Stankovic

unread,
Nov 17, 2023, 3:31:35 PM11/17/23
to roast-users

Dear ROAST community,

We are new users of ROAST. So far, we have found it extremely useful for our research questions, so first, we would like to thank the creators for this great tool.

We would really appreciate if anyone who managed to extract the exact e-field intensity in ROI based on transforming MNI coordinate to voxels help us on this matter. Unfortunately, we lack coding experience, and navigating through the steps outlined has proven challenging for us.

Namely, what me and my colleagues are trying to do is compare different electrode montages to figure out which one produces the strongest electrical field in the ACC – MNI coordinates 5 14 42.

We are using ROAST function to test the montages from the literature with the sample file provided within ROAST (example/subject1.nii).

We tried to copy the code lines that you referred to above in Matlab, however, we got multiple errors when trying to run them. Could you please provide us with detailed steps or any insights that would guide us through these steps?

Marija Stankovic and Uros Konstantinovic

University of Belgrade

Yu (Andy) Huang

unread,
Nov 18, 2023, 4:18:22 PM11/18/23
to Marija Stankovic, roast-users
Hi Marija,

Not sure what errors you got, so I could not help you more.

If all you need is to find out which montage gives you the strongest electric field at the MNI coordinates you specified, you can simply run roast with the "leadfile" as the recipe, and then run roast_target. Please follow the documentation for details.

Hope this helps.

Marija Stankovic

unread,
Nov 20, 2023, 6:27:55 AM11/20/23
to roast-users
Hi Andy,

Thank you for your response. We did run the roast_target function first, but since we have the electrodes that are bigger than ones used within the function, and we want to test the montage with odd number of electrodes (whereas roast_target supports only the even number), we wanted to test the montages with slightly different parameters.

As for the errors - we did the following: First, we ran this code, to get the transformation matrix (if we understood well that this would be the first step) - mappingFile = ['example/subject1_seg8.mat']; - This made another file in the Workspace, named mapping file. 

Second, we ran this code: mni2mri = inv(image(1).mat)*inv(Affine) . We got this error: Unrecognized method, property, or field 'mat' for class 'matlab.graphics.primitive.Image'.

We also tried to run the third code provided and we typed this - temp = mni2mri*[targetCoord(i,:) 1]'; , but we got the error Unrecognized function or variable 'mni2mri'. 

We again tried to do just this - mni2mri*[5 14 42]',  and we got the error again - Unrecognized function or variable 'mni2mri'. 

We are not sure if the order of our codes was correct or if we needed to make only one line of code based on the instructions provided... Sorry if I am not explaining myself properly.

Kind regards,

Marija and Uros 

Marija Stankovic

unread,
Nov 20, 2023, 8:13:53 AM11/20/23
to roast-users
So, we now added the file subject1_T1orT2_seg8.mat into the Workspace, and the code:   mni2mri = inv(image(1).mat)*inv(Affine)  worked. 

After that we ran  mni2mri*[5 14 42]' and we got the numbers that looked like voxels.

We then ran  ef_mag with those voxels in the brackets, and got the number ans = 0.28, which seemed like the e-field magnitude that we needed. 

Is this the thing we should have done? 

Thank you once again. 

Yu (Andy) Huang

unread,
Nov 24, 2023, 11:30:45 AM11/24/23
to Marija Stankovic, roast-users
Hi Marija, yes, what you did is correct. Glad to hear you figured it out!

Reply all
Reply to author
Forward
0 new messages