[Eeglablist] Similar function equals topoplot() who generates directly rgb matrix from topographic map

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Thu Apr 21 09:26:44 PDT 2022


Thanks Victor for technical suggestion.
I agree with you that although topoplot() is very useful its drawing speed
is very slow. The speed becomes noticeably slow as it draws many topo maps
in a window.

I have never looked into code. If you have a technical suggestion, we would
appreciate it if you could post it to as an 'issue' in the following Github
page.
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sccn_eeglab_blob_79eb8a88292f83d049e9015a79714645572f4759_functions_sigprocfunc_topoplot.m&d=DwIBaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=dGjmki3eBriIZRreB14jfyCtEGxYccRl5OtEkZUTVgRScYA2zIYdPYzuHMdZKCLt&s=BB4CYPNwvcYGzybzc8RQRhqjlCLSpOkDrVW_1GC0uJo&e= 

I could be wrong here, but I thought Mike Cohen wrote a modified version of
topoplot. I wonder if it solved the inefficiency problem. You might
investigate it, Victor (and let us know what you find!)

Makoto

On Tue, Apr 19, 2022 at 10:17 AM Victor Gimenez <victor.gimenez at ufabc.edu.br>
wrote:

> Good Morning/Afternoon/Evening dear EEGLab community,
>
>
>
> Is there another function that performs the same role as the topoplot()
> function? I have realized that topoplot() despite meeting my
> expectations, when it is executed through loop(s) it may be slow and
> computational costly, I am doing:
>
>
> clear all
> set(0,'DefaultFigureVisible','off');
>
> %%%%
> %%%% code lines here before %%%%
> %%%%
>
> count = 1;  %12561
> for p2 = 1:trials_a  %785
>     for p1 = 1:16
>
>         figHandle = figure;
>         topoplot(a_data(p1,:,p2),EEG.chanlocs,'style','map');  %loop
>         [X, Map] = frame2im(getframe(figHandle)); %Generates rgb matrix
> from topographic map topoplot
>         a_data{count} = X;
>
>         label_a_final(:,count) = 1;
>
>         %FFT
>         Y = fft(a_data(p1,:,p2));
>         P2 = abs(Y/L);
>         P1 = P2(1:L/2+1);
>         P1(2:end-1) = 2*P1(2:end-1);
>
>         figHandle = figure;
>         topoplot(P1(i_fft),EEG.chanlocs,'style','map');
>         [X_fft, Map_fft] = frame2im(getframe(figHandle)); %Generates rgb
> matrix from topographic map topoplot
>         a_data_fft_final{count} = X_fft;
>
>         count = count + 1;
>     end
> end
>
> %%%%
> %%%% code lines here before %%%%
> %%%%
> %%%% set(0,'DefaultFigureVisible','on');
>
> And when I did/do this nested for loop the IDE crashed up and I was
> supposed to force the shutdown immediately, consider that a_data,
> a_data_fft_final are already preallocated before these loops. I am
> trying to think about ways to vectorize this code but I unfortunately
> can't able to think about the best manner for it.
>
>
> With best wishes,
>
> Victor
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>



More information about the eeglablist mailing list