Find Direction Normal to Cortical Surface at Defined Point

Hi everyone,

I'm trying to perform dipole fitting in the vein of what the Human Neocortical Neurosolver (HNN) requires as input. That is, the dipole has a fixed position defined as having the greatest GOF to the overall data in the time window, fixed orientation defined as being normal to the cortical surface at the fixed position, and time-varying amplitude. I understand that this sort of analysis is not the intended purpose of Brainstorm due to how restrictive the conditions are and the low GOF that it results in compared to other analyses.

Using the FieldTrip dipole fitting method with a single regional dipole, I can get pretty close to my objective, except for a moving direction of the dipole. To fix this, I would only need to know the direction normal to the cortical surface at the fixed dipole position, allowing me to project the dipole vectors onto this axis to produce the data I want.

My question is how I can take the MRI or cortical surface data and find the direction normal to the cortical surface at a given point that is on/near the surface. Is there a built-in method that could produce this (in Brainstorm or other software package)? Is there another method besides ft_dipolefitting that would produce the dipole data I want directly?

The normal direction (wrt the surface) for each vertex is found in the filed VertNormals in each surface file. More info:
https://neuroimage.usc.edu/brainstorm/Tutorials/ExploreAnatomy#On_the_hard_drive:_Surface