One click in bst

Yes... I looked at it for 1-2 days and could not make sense of how Brainstorm expected the data to be provided so that it can import it consistently. I can try to have a look at it again when I will have a bit of time. In the meantime, if you want to have a look at the import script ( https://github.com/christian-oreilly/infant_template_paper/blob/master/import_to_brainstorm/import_template_to_brainstorm.m ) and check if you can figure out what is going wrong, your help would be appreciated. I just committed and pushed this file, as it was last time I worked on this... so it is not a "clean" commit but it should give you the current state of the code I was trying to fix.

If I remember well, the different data could not be set on a correct scale... I started to write you a message back then and I was trying to make sure everything made sense before sending it and I guess I just did not manage to reach a level of understanding of what was going on that was satisfying for me to complete the message... Here was the (unfinished) message in case it can help explain the issue (that was in continuation of a discussion at https://github.com/christian-oreilly/infant_template_paper/issues/1# :

I will phrase it in my own words (which might end up being just what you are trying to tell me, but please bear with me) so that I can be sure that I understand: The only way I see that it can work is with sMri.SCS.T in mm (as mentioned by the comment "This hack was added becaue cs_convert() is intended to work on sMri structures, in which NAS/LPA/RPA/T fields are in millimeters") and consequently sMri.SCS.T./1000 is in m. The transform is therefore applied to coordinates that need to be in m. So, in

    ChannelMat.SCS.NAS = cs_convert(ChannelMat, 'mri', 'scs', ChannelMat.SCS.NAS ./ 1000) .* 1000;

of channel_detect_type, ChannelMat.SCS.NAS needs to be in mm so that ChannelMat.SCS.NAS ./ 1000 is m and is in compatible unit with sMri.SCS.T./1000. So... the last place that seems not to work for me is when you way "ChannelMat.SCS.NAS / .LPA / .RPA are in SCS coordinates (meters)".

Again, as per the comment "NAS/LPA/RPA/T fields are in millimeters, while in ChannelMat they are in meters", if ChannelMat.SCS.NAS is in meters, then ChannelMat.SCS.NAS ./ 1000 is in km, whereas sMri.SCS.T being in mm, then sMri.SCS.T./1000 is in m and these two things are off by a factor 1000.

That part works if we do something like (with sFid as used for import_anatomy_fs(iSubject, FsDir, 15000, 0, sFid)):

        ChannelMat.SCS.LPA = sFid.LPA; 
        ChannelMat.SCS.NAS = sFid.NAS;
        ChannelMat.SCS.RPA = sFid.RPA;     

which fits with your previous statement "When you import the MRI (before importing the surfaces), the NAS/LPA/RPA must be set to points that are matching EXACTLY the positions of the NAS/LPA/RPA defined in the .tsv positions file."... but in that case, ChannelMat.SCS.NAS is indeed in mm, not in m. With that, I obtain channels and surfaces that are on the same scale (obviously the transformation is still wrong though, for whatever reason...):

But if instead I use

        ChannelMat.SCS.LPA = sFid.LPA / 1000.0; 
        ChannelMat.SCS.NAS = sFid.NAS / 1000.0;
        ChannelMat.SCS.RPA = sFid.RPA / 1000.0;     

so that these are in m, then I get [... and I am afraid I stopped writing there...]