Eylem
(Mehmet Eylem Kirlangic)
September 2, 2022, 11:41am
1
Dear MNE,
For visualization of our 64 channels EEG data in MATLAB, we would like to use the spatial color coding as illustrated/stated on your webpage:
https://mne.tools/stable/auto_tutorials/evoked/20_visualize_evoked.html
Regarding this we have the following questions:
How can we integrate your python function “spatial_colors” into our MATLAB code?
How can we assign the color codes onto different number of channels, such as 32, 64, 128, or 256 channels? Is there a certain convention for different number of channels? The example on the webpage is for 102 channels/magnetometers.
Kind regards,
Dr. Mehmet Eylem Kirlangic
richard
(Richard Höchenberger)
September 4, 2022, 9:36am
2
Hello @Eylem and welcome to the forum!
MNE-Python uses a very simple function to convert the (X, Y, Z)
coordinates of channels / sensors into RGB colors:
def _rgb(x, y, z):
"""Transform x, y, z values into RGB colors."""
rgb = np.array([x, y, z]).T
rgb -= rgb.min(0)
rgb /= np.maximum(rgb.max(0), 1e-16) # avoid div by zero
return rgb
It should be trivial to re-implement this in Matlab.
Best wishes,
Richard
3 Likes
Eylem
(Mehmet Eylem Kirlangic)
September 15, 2022, 7:08am
3
Dear @richard ,
As you pointed out, we were easily able to implement the smart idea of mapping (x, y, z) to RGB in Matlab.
Thank you very much for your prompt support!
Best,
Eylem
2 Likes