[Mne_analysis] mne.save_stc_as_volume('lcmv_inverse.nii.gz', stc, fwd['src'], mri_resolution=False)

dgw dgwakeman at gmail.com
Thu Apr 14 11:17:56 EDT 2016
Search archives:

Hi Parham,

There are a couple of problems you are running into here:

1. That forward solution only contains MEG sensors, you would need to
generate your own with EEG only sensors if you want to.

2. You didn't mention changing the picks call which would also need to be done.

Next time if you copy and paste all and exactly what you ran, I can
probably help you quicker.

hth
d

On Thu, Apr 14, 2016 at 4:54 AM, parham hashemzadeh <ph442 at cam.ac.uk> wrote:
> Dear
>  I simply ran the tutorial below, which uses the file name
> fname_fwd = data_path + '/MEG/sample/sample_audvis-meg-vol-7-fwd.fif'
> So, it is a volume. I simply set Meg=False. It appears to me that it is
> volume. At least it says that it is volume "vol-7-fwd.fif". I wanted to only
> do the beamformer with EEG.
> best regards parham hashemzadeh
>
>
>
>
> On 2016-04-14 04:33, dgw wrote:
>>
>> Hi Parham,
>> Where are you getting src from? It doesn't seem to be a volume source
>> space.
>>
>> hth
>> d
>> Sent from my Phone
>>
>>> On Apr 13, 2016, at 18:01, parham hashemzadeh <ph442 at cam.ac.uk> wrote:
>>>
>>> Dear
>>>  Thank you for your email. But actually no I am not using that tutorial.
>>> I am using this tutorial which is focused on the Volume Source Space.
>>>
>>>
>>> http://martinos.org/mne/dev/auto_examples/inverse/plot_lcmv_beamformer_volume.html#sphx-glr-auto-examples-inverse-plot-lcmv-beamformer-volume-py
>>>
>>> All I am doing is that I am turning off the MEG and just want to use the
>>> EEG.
>>>
>>> In theory it should work even with this reduced leadfield matrix. Before
>>> it was 366 rows but now only 60 rows (Just EEG).
>>>
>>> So my volume (source space) does not change. It is exactly the same
>>> thing. My number of sensors are reduced.
>>>
>>> The error happens at the line below:
>>> mne.save_stc_as_volume('lcmv_inverse.nii.gz', stc, fwd['src'],
>>> mri_resolution=False)
>>>
>>> ""Only volume source estimates can be saved as volumes"" can be saved
>>>
>>> Any help will be appreciated.
>>> besst regards parham
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>> On 2016-04-13 21:41, dgw wrote:
>>>> Hi Parham,
>>>>
>>>> It sounds like you are using this tutorial:
>>>>
>>>>
>>>> http://martinos.org/mne/dev/auto_examples/inverse/plot_lcmv_beamformer.html?highlight=beamformer
>>>>
>>>> If that is the case, it uses the cortical surface as the source space
>>>> and not a volume, so it doesn't really make sense to save as a nifti.
>>>>
>>>> hth
>>>> d
>>>>
>>>> On Wed, Apr 13, 2016 at 3:48 PM, parham hashemzadeh <ph442 at cam.ac.uk>
>>>> wrote:
>>>>>
>>>>> Dear all
>>>>>
>>>>> I got an error when running a beamforming tutorial script. I modified
>>>>> the beamformer such that only the EEG leadfield is used and I just
>>>>> wanted to do EEG analysis.
>>>>> So I made the following changes:
>>>>> (a) meg=False in fwd
>>>>> (b) in epochs reject=dict(eog=150e-6)
>>>>> When it gets to the function lcm_inverse, it throws an error:
>>>>>
>>>>> ""Only volume source estimates can be saved as volumes"" can be saved
>>>>>
>>>>>
>>>>>
>>>>>  I was wondering, if you would be able to point me in the right
>>>>> direction.
>>>>> Many thanks
>>>>> best regards parham hashemzadeh
>>>>>
>>>>>
>>>>>
>>>>> fwd = mne.make_forward_solution(raw_fname, trans, src, bem,
>>>>>                                 fname=None, meg=False, eeg=True,
>>>>> mindist=5.0,
>>>>>                                 n_jobs=2, overwrite=True)
>>>>> epochs = mne.Epochs(raw, events, event_id, tmin, tmax, proj=True,
>>>>>                     picks=picks, baseline=(None, 0), preload=True,
>>>>>                     reject=dict(eog=150e-6))
>>>>>
>>>>> evoked = epochs.average()
>>>>> leadfield = fwd['sol']['data']
>>>>> ## Read regularized noise covariance and compute regularized data
>>>>> covariance
>>>>> noise_cov = mne.read_cov(fname_cov)
>>>>> data_cov = mne.compute_covariance(epochs, tmin=0.04,
>>>>> tmax=0.15,method='shrunk')
>>>>> #
>>>>> ## Run free orientation (vector) beamformer. Source orientation can be
>>>>> ## restricted by setting pick_ori to 'max-power' (or 'normal' but only
>>>>> when
>>>>> ## using a surface-based source space)
>>>>> stc = lcmv(evoked, fwd, noise_cov, data_cov, reg=0.01, pick_ori=None)
>>>>> #
>>>>> ## Save result in stc files
>>>>> stc.save('lcmv-vol')
>>>>> stc.crop(0.0, 0.2)
>>>>> ## Save result in a 4D nifti file
>>>>> img = mne.save_stc_as_volume('lcmv_inverse.nii.gz',
>>>>> stc,fwd['src'],mri_resolution=False)
>>>>> _______________________________________________
>>>>> Mne_analysis mailing list
>>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>>>
>>>>>
>>>>> The information in this e-mail is intended only for the person to whom
>>>>> it is
>>>>> addressed. If you believe this e-mail was sent to you in error and the
>>>>> e-mail
>>>>> contains patient information, please contact the Partners Compliance
>>>>> HelpLine at
>>>>> http://www.partners.org/complianceline . If the e-mail was sent to you
>>>>> in error
>>>>> but does not contain patient information, please contact the sender
>>>>> and properly
>>>>> dispose of the e-mail.
>>>>
>>>> _______________________________________________
>>>> Mne_analysis mailing list
>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>
>>>
>>> --
>>> best regards
>>> Parham Hashemzadeh
>>> Research Associate
>>> Department of Applied Mathematics and Theoretical Physics
>>> University of Cambridge, UK.
>>> email: hashemzadeh at damtp.cam.ac.uk
>>> _______________________________________________
>>> Mne_analysis mailing list
>>> Mne_analysis at nmr.mgh.harvard.edu
>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> --
> best regards
> Parham Hashemzadeh
> Research Associate
> Department of Applied Mathematics and Theoretical Physics
> University of Cambridge, UK.
> email: hashemzadeh at damtp.cam.ac.uk


More information about the Mne_analysis mailing list