Kleen-Lab / OPSCEA

From the Kleen Lab at UCSF (http://kleen.ucsf.edu). Software for heatmaps of seizure activity projected onto reconstructed brains (Omni-Planar and Surface Casting of Epileptiform Activity). PAPER: https://doi.org/10.1111/epi.16841, VIDEO EXAMPLES: https://www.youtube.com/playlist?list=PLGmfrsRwdva-WKwqLyWwcZxE0f_MA9vIL
Other
8 stars 7 forks source link

isL/isR #2

Closed aarongeller closed 1 year ago

aarongeller commented 2 years ago

There appears to be a minor bug which prevents OPSCEA from working (fully) on bilateral implants. Specifically, the isL and isR variables are defined as scalars at OPSCEA.m (line 154) but need to be N-dimensional logical vectors where N is the number of depths. In order for OPSCEAsurfslice to adjust the view angle correctly for the side of the depth electrode (see e.g. the attached image with slices for left contacts angled to the patient's right and vice versa), the side should be specified for each.

I have modified OPSCEA.m with:

isRdepth = [];
isLdepth = [];
for i=1:length(depths)
    if ~isnan(depths{i})        
        xval_highcontact = em(depths{i}(end),1);
        isRdepth(end+1) = xval_highcontact>=0;
        isLdepth(end+1) = xval_highcontact<0;
    else
        isRdepth(end+1) = nan;
        isLdepth(end+1) = nan;
    end
end
...
loaf.isRdepth=isRdepth; loaf.isLdepth=isLdepth;

And OPSCEAsurfslice.m with:

theta=theta+[pi*loaf.isLdepth(j)]; 
if (m)>10; theta=theta+[pi*loaf.isRdepth(j)]; end
sliceinfo(j).azel=[circ_rad2ang(theta-pi) + 20*(-1*loaf.isRdepth(j) + 1*loaf.isLdepth(j)),0]; % head-on angle minues 20 degrees for each slice to add perspective

This issue also causes left sided slices to be rendered backwards, as the line theta=theta+[pi*loaf.isL] does not work correctly.

brains
raphaelchristin commented 1 year ago

Hi Aaron, sorry this took a while to merge but your fix has been addressed in #3. If this does not work for you or if you notice some other bug, feel free to open another issue/pull request. Thanks for bringing this to our attention!

aarongeller commented 1 year ago

no worries, thanks for the update and happy to help!

raphaelchristin commented 1 year ago

Hi @aarongeller, did you change anything else in OPSCEA.m regarding this issue? specifically, an issue has surfaced with our data where the value in depths{i}(end) is bigger than what is allowed by the size of em (e.g. there is a call like this em(324,1) when em only has ~150 rows. Did you address this possibility? Otherwise I will look at it on my end. Thanks a lot!

raphaelchristin commented 1 year ago

Nevermind, I think our params file was the problem. Sorry to bother you

aarongeller commented 1 year ago

no worries- I was going to say there are no other modifications (for this issue) beyond those I mentioned above.