Importing different EEG channels from EEGLAB .set chanlocs file

Hi!
I am kinda new with Brainstorm. I currently have some pre-processed EEGs in EEGLAB format (.set). I can easily import them in Brainstorm, but, during the MRI co-registration, I noticed that they are rotated of a certain angle from the expected position (more specifically, they are rotate of about 180° or -90° among the Z axis from the desired position). Is there a way in Brainstorm, using the GUI, to correctly rotate the sensors?
I tried even extracting the information I needed using the following code:

chanlocs = readtable('Micromed31.ced', 'Filetype', 'text');
chanlocs.Properties.VariableNames = {'Number', 'labels', 'theta', ['' ...
'radius'], 'X', 'Y', 'Z', 'sph_theta', 'sph_phi', 'sph_radius', 'type'};
Positions = [chanlocs.Y chanlocs.X chanlocs.Z];
Labels = upper(chanlocs.labels);
num_chans = length(Labels);

% "Create" .elc file. Base structure taken from the epilepsy tutorial channel position file
fileID = fopen('Micromed_Brainstorm.elc', 'w');
fprintf(fileID, '#\n');
fprintf(fileID, ['# electrodes labels should be upper case by definition to' ...
' allow a proper matching of electrodes and channel labels.\n']);
fprintf(fileID, '# File generated by electrodes export feature.\n')
fprintf(fileID, '#\n');
fprintf(fileID, '# %d electrodes\n', num_chans);
fprintf(fileID, 'NumberPositions= \t%d\n', num_chans);
fprintf(fileID, 'UnitPosition \tmm\n');
fprintf(fileID, 'HSPTransformed false\n');
fprintf(fileID, 'Positions\n');
for i = 1:num_chans
    fprintf(fileID, '%s:\t%.1f\t%.1f\t%.1f\n',Labels{i}, Positions(i,1), Positions(i,2), Positions(i,3));
end
fprintf(fileID, 'Labels\n');
fprintf(fileID, '%s\t', Labels{:});
fprintf(fileID,'\n');
fclose(fileID);

% Test with a struct
chanlocs_bsm = struct();
chanlocs_bsm.Label = Labels;
chanlocs_bsm.X = Positions(:,1);
chanlocs_bsm.Y = Positions(:,2);
chanlocs_bsm.Z = Positions(:,3);
% chanlocs_bsm.Type = repmat('EEG', num_chans,1);
save('Micromed31_brainstorm.mat','chanlocs_bsm');

% Test with a table
chanlocs_table = table(Positions(:,1), Positions(:,2), Positions(:,3), [1:num_chans]', Labels);
chanlocs_table.Properties.VariableNames = {'X', 'Y', 'Z', 'indice', 'name'};
a = table2struct(chanlocs_table);
save('Micromed31_brainstorm.mat','a')

I tried importing the Micromed31_Brainstorm.elc file using Adding EEG position -> Import from file (after importing the .set eeg file) in order to overwrite channels positions, with the FileType EEG:ASCII XYZ_Name or ASCII XYZ_MNI,NAME, but the warning "Warning: No channel information was read from the file." appears. I tried importing the struct or the table from Matlab workspace, but the error "Invalid structure for file type channel" appears.
Can anyone help me solve this problem?

P.S. The channel file from the epilepsy tutorial and the elc file I created are identical, if open with text editor, except from the channels and channel positions, obv

  • Can you indicate which steps are you taking in the GUI?
    Please add screenshots.

  • If you are using the default anatomy, and the sensors are in the 10-20 system, you could get their positions from one of the co-registered caps.

There is no need to convert the EEGLAB .ced file with the electrode positions as this is supported by Brainstorm.

By creating a new protocol with default anatomy and creating subject number 1:

  • Import MEG/EEG to import .set file (brainstorm converts channels loc by a factor of 100)
  • Right click on EEGLAB Channels (31) -> MRI coregistration -> Edit
  • Labels on, refine registration
  • The image shows the electrodes. As you can see, they are rotated by 180 degrees from their normal position

I attach here the sensors' positions in EEGLAB (the one loaded automatically with the .set file, actually already rotated from the original .ced file)

Thank you @Zanchi for the information. The spherical coordinates for the channels look strange, e.g., Fz should have a 0deg, rathern than 180deg as shown in the Table.

Would it be possible for you to share an example of the data to import to inspect what is going wrong?
Upload the file somewhere and post the download link here.

Edit: There was a typo, it said Cz and it should be Fz

I actually made a mistake during the rotations of the sensors. Just setting the nose along the Y axis in EEGLAB, saving the file as a .set, and loading it in brainstorm actually positioned the sensors at least along the right axis. Anyway, while performing refine registration, Cz does not result aligned with the Z axis (even ignoring like 10% of the points)
This should not be a problem, I think, still Cz is close to the Z axis, I think is more a problem of eletrodes placement by the operator

Anyway, here is the link to the original .ced file with the electrodes positions used in EEGLAB:

Thanks for the file and the extra information. The .ced file has Cartesian, polar and spherical coordinates, from these Brainstorm uses the Cartesian ones. In the shared .ced it seems the X and Y axes (columns 5 and 6) are swapped, more over it there is typo in the FC5 electrode (that is why it appears in the wrong place in the screenshot).

Regarding Cz not coinciding with the Z axis, that is common, as they are defined in different ways. The Z axis in Brainstorm is derived from the anatomy fiducials. For example, this 32-electrode cap which is already aligned to the ICBM152 default anatomy: