Print

Print


Dear Jeremy,

On Mon, Apr 26, 2010 at 11:39 PM, Jeremy Nelson <[log in to unmask]> wrote:
> Hi Vladimir,
>
> I think I am getting close to having my files in working SPM order.
> I've attached a few files - the small batch script I've got to combine
> my data into a single matrix, the version of your spm_eeg_convert
> script that I've edited, and the .mat file I get after frunning my
> EEG_batch_script.  When I run my EEG_batch_script, I create three
> files: LSham_AN_L_spm.dat; LSham_AN_L_spm.mat; and, D.mat.  Do you
> know why I am getting the D.mat file?  Is it necessary?

That's because you mistakenly corrected the last line of the script to:

save('D')

whereas it should be:

save(D);

This works because 'save' that is called in this case is a method of
the @meeg class so it 'knows' how to save the dataset. This is called
'overloading' in object-oriented programming. The problem you had is
not that an extra-file was generated but that all your changes made
after the initial conversion with spm_eeg_ft2spm were not saved.

> Also, when
> trying to run SPM's source reconstruction on my LSham_AN_L_spm file, I
> get:
>
> "The requested file is not ready for source reconstruction.  See
> Matlab window for details."
>
> And Matlab says:
>
> "checkmeeg: no sensor positions are defined"
>
> If I try to run DCM, I get the following errors:
>
> "The requested file is not ready for DCM.  Use prep to specify sensors
> and fiducials or LFP channels."
>
> Am I still missing some header data (such as specifying default sensor
> configuration)?  Does my code look like it should work?
>

What you are missing are electrode locations. If you don't have
individual locations that you measured for each subject or a template
for the cap used in your lab, SPM can provide locations based on
channel labels (in your case - extended 10-20). You can do that using
the 'Prepare' interface (see section 12.4 of the manual). There you
also have other options in case you do have more precisely measured
locations. In the attached script I added a few lines at the end to do
that automatically.

> Also, in spm_eeg_convert_arbirtray_data, should I change the line "D =
> chantype(D, [], 'LFP'); " to read "D = chantype(D, [], 'EEG'); " since
> I am doing EEG?

Actually if you remove that line completely, EEG type will be assigned
to most of the channels because default channel types are assigned
within spm_eeg_ft2spm. Note that you have two channels called CB1 and
CB2. These are not extended 10-20 labels. So SPM will not assign 'EEG'
type to them and will not be able to provide locations for them.
Consequently, by default these two channels will just be ignored by
DCM and source reconstruction. If the corresponding electrodes are EEG
electrodes and you want to use them as such, you should change the
labels to the closest locations of the extended 10-20 system.

Best,

Vladimir


> On Mon, Apr 19, 2010 at 4:26 PM, Vladimir Litvak
> <[log in to unmask]> wrote:
>> That's a good point. You should start your script with:
>>
>> spm('defaults', 'eeg');
>>
>> Sorry I forgot to include that.
>>
>> Vladimir
>>
>> On Mon, Apr 19, 2010 at 10:18 PM, Jeremy Nelson <[log in to unmask]> wrote:
>>> Hi Vladimir,
>>>
>>>> OK. That's much clearer now. What you can do is press '3D source
>>>> reconstruction', load the example file, delete the source
>>>> reconstruction data that is there and save. Then when you load it to
>>>> DCM you'll be asked at some point to specify the head model parameters
>>>> from scratch. That should solve this problem.
>>>
>>> This worked - thank you for the help!
>>>
>>>> You should not put all the ERPs from all subjects in the same dataset.
>>>> You can either compute the grand average and do DCM of that or do DCM
>>>> of each subject individually and then do statistics on the parameters
>>>> across subjects. Look at the published DCM paper of Marta Garrido et
>>>> al. for some examples. In any case what you should input to DCM are
>>>> files with 3 trials, one per condition. You don't need to specify the
>>>> number of repetitions that went into each average for DCM. You should
>>>> specify the condition labels by changing the line:
>>>>
>>>> D = conditions(D, 1:Ntrials, 'Condition 1');  % Sets the condition label
>>>>
>>>> from the script and changing into something like:
>>>>
>>>> D = conditions(D, 1, 'Pre');
>>>> D = conditions(D, 2, 'Post 1');
>>>> D = conditions(D, 3, 'Post 2');
>>>
>>> Yes, that is the approach I am using - each subject's pre, post 1, and
>>> post 2 data are being compiled into the same dataset (one dataset per
>>> subject, each of which will be run through DCM).  After making the
>>> changes you suggested to the script (which I have attached), here are
>>> the errors I am getting when I try to run it:
>>>
>>> checkmeeg: no channel type, assigning default
>>> checkmeeg: no units, assigning default
>>> checkmeeg: transform type missing, assigning default
>>> checkmeeg: data scale missing, assigning default
>>> checkmeeg: data type is missing or incorrect, assigning default
>>> ??? Undefined function or method 'fileio_chantype' for input arguments of
>>> type 'cell'.
>>>
>>> Error in ==> spm_eeg_prep at 60
>>>        type = fileio_chantype(D.chanlabels);
>>>
>>> Error in ==> spm_eeg_ft2spm at 145
>>> D = spm_eeg_prep(S1);
>>>
>>> Error in ==> spm_eeg_convert_arbitrary_data at 127
>>> D = spm_eeg_ft2spm(ftdata, fname);
>>>
>>> Error in ==> run at 57
>>>          evalin('caller', [s ';']);
>>>
>>>
>>> Do you have any suggestions?
>>>
>>> Thanks again,
>>>
>>> Jeremy
>>>
>>
>