Warping template MRI to match head shape from photoscan

Hi BrainStormers,

In my study, rather than using a Polhemus device to digitize headpoints, we made a photoscan of each subject's head to get an individualized headshape. The output of this process is a Wavefront object defining a mesh with the subject's head shape, which I can import into Fieldtrip and save as whatever other format I'd like (e.g. Gifti, etc).

I'm trying to use Brainstorm's MRI warping feature to warp a template MRI to match the subject's headshape. Right now, I'm trying to manually edit the subject's channel file to put the data from the mesh into the HeadPoints field, and then follow the tutorial as if I had points from a Polhemus. Does this seem like a smart way to go about it, or are there other ways of reading the mesh directly into Brainstorm that would let me do this more easily? Any suggestions would be welcome!


This makes sense, but it would be possible to develop easier alternatives.
One solution would be to add this Wavefront file format in the list of supported "channel file formats". This means:

  • Adding an entry to bst_get.m, line 3692:
    `{'.'}, 'Headshape: Wavefront mesh (*.)', 'WAVEFRONT_HS'; ...
  • Adding a case to import_channel.m which contains code to read the file as a ChannelMat structure (with the HeadPoints field filled, and the Channel field empty):
    case 'WAVEFRONT_HS'
  • The function to read the Wavefront can be either directly implemented in import_channel.m if it is only a few lines long or if it's reusing existing functions in Brainstorm (maybe in the in_tess* functions), or implemented as a separate function in_channel_wavefront.m.

If you're interested in working on this: please ask for all the information you need, and feel free to post your code propositions on the Brainstorm GitHub repository.

If you think this is out of your reach technically or time-wise, I can work on this myself over the summer. Please start by sharing an example file.