Mensen / swa-matlab

Sleep Wave Analysis - an open source toolbox for matlab to score and analyse various waveforms in sleep EEG data
52 stars 20 forks source link

Spindle information on other channels #34

Closed arnaudbore closed 8 years ago

arnaudbore commented 8 years ago

Is there a way to get this information ?

How can we make both information "compatible" ?

Thank you for your help. Arnaud

Mensen commented 8 years ago

To your first point...

This should be possible to configure by changing the output of swa_FindSSChannels, I'll have a look into that. Currently I have considered the spindle as a single entity with the properties associated with the reference wave, and each channel is simply a reflection of this single process. But indeed, additional properties within the channels would be easy enough to output into the SS structure.

The swa_FindSSChannels really only takes the time points indicated by the swa_FindSSRef as potential spindle points, such that it should be impossible to find a spindle only in the swa_FindSSChannels portion of the analysis. Thus, in the field SS.Ref_Region, there will always be at least one value indicating which reference|canonical region the spindle was found in. Can you check this field of the spindle that seems to only have been found in the second portion of the analysis?

arnaudbore commented 8 years ago

I've done some modifications of swa_FindSSChannels so I can extract information from the midline. I'll check tomorrow about the SS.Ref_Region but if I remember correctly I had just 1 channel let say Fz for SS.Ref_Region and after swa_FindSSChannels in the field SS.Channels_Active Cz is set at true. I'll check more closely tomorrow.

Thank you for your help.

arnaudbore commented 8 years ago

I found one of many spindles where

I've got only 8 channels: Fz Cz Pz Oz POz Fpz CPz FCz

The second step was able to find a spindle at Cz and Pz as well.

Mensen commented 8 years ago

I see what is going on.

The midline reference its creating does not only contain the midline electrodes but attempts to find a group of electrodes within a certain radius at the 1/3 1/2 and 2/3 points from the farthest forward to the farthest electrode back.

To visualise which electrodes were used change the flag_plot option to true when running swa_CalculateReference(data, Info, flag_plot)

Thus, the references take the average activity of the electrodes within the region which may or may not meet the criteria set. At the next stage (swa_FindSSChannels), it visits all the electrodes individually at the time points found in the reference stage. Thus, while an average regional activity may not meet criteria, an individual electrode might. Especially since the default option for channel criteria is set at 75% of the regional reference criteria.

All that said, if you only have 8 channels, you might consider making each of the 8 electrodes a reference electrode (by putting the data into Data.SSRef field), and only running the swa_FindSSRef, since the regional calculation for the midline is probably a bad way to go with such few electrodes. I tend to only work with high-density arrays so it hadn't quite crossed my mind to advise users of this potential step. However, if you don't use the swa_FindSSChannels then the swa_Explorer probably won't be able to plot the data, so that's a big trade-off.

Let me know if that makes sense.

arnaudbore commented 8 years ago

I think it would be a good explanation if I was using swa_CalculateReference but because I had some issues about electrode's location I hard coded the midline as reference in SS_Ref variable. But I agree maybe I should put all 8 electrodes as a reference.

Finally, I've never used swa_explorer and I create a marker file with all spindles information and then use Brainvision to visualize and check.

Thanks again for your help.

Mensen commented 8 years ago

In this case then the default value of using 75% of the reference criteria for individual channels explains why certain channels do not meet the reference criteria but are then detected in the channel detection.

Mensen commented 8 years ago

@arnaudbore was this explanation satisfactory?

Can I close the issue?

arnaudbore commented 8 years ago

Oups sorry I didn't reply. Thank you for this explanation. As I said I put the 8 electrodes as reference and I don't use swa_FindSSChannels anymore. You can close the issue. Thanks again for your help.

Mensen commented 8 years ago

Sounds good!