[FieldTrip] quick fix? ft_sourceplot error line 460
Hassan Aleem
ha438 at georgetown.edu
Fri Mar 11 01:02:54 CET 2016
Hi J.M,
I am using fieldtrip2016-03-09 and Matlab R2015b with a debian linux
operating system. However the problem appears also on my windows 10 OS. I
am unable to take a look at the 'seg' or 'mri' because the ft_sourceplot
does not work with the same complaint as with trying to plot the source
interpolation, I assume that's what you mean by checking them. Let me post
the script to give you more information. ( the headmodel part of the script
was modified from robert bauer)
*%reading mri*
[mri] = ft_read_mri('MNI152_T1_0.5mm.nii');
mri.coordsys ='MNI'
-----------------------------------
*%segmentation*
cfg = [];
cfg.brainthreshold = 0.5;
cfg.scalpthreshold = 0.15;
cfg.downsample = 1; %no downsampling
cfg.output = {'brain' 'scalp' 'skull'};
seg = ft_volumesegment(cfg, mri);
----------------------------------
%plotting segmentation
cfg = [];
cfg.funparameter = 'trishells';
cfg.funcolormap = [1 0 0;0 1 0;0 0 1];
ft_sourceplot(cfg,seg) *this does not work, same error.*
------------------------------------------
*%building mesh*
cfg = [];
cfg.method= 'projectmesh';
cfg.tissue = {'scalp', 'skull', 'brain'};
cfg.numvertices = [1000 1000 1000];
bnd = ft_prepare_mesh(cfg, seg);
% i enlarged / reduced the boundary mesh a little bit, because they were
causing errors, probably due to overlapping
bnd(1).pnt = bnd(1).pnt.*1.001
bnd(2).pnt = bnd(2).pnt.*1
bnd(3).pnt = bnd(3).pnt.*0.999
ft_plot_mesh(bnd(1))%scalp
ft_plot_mesh(bnd(2))%skull
ft_plot_mesh(bnd(3))%brain
----------------------------------------------------------
*%preparing headmodel*
cfg = [];
cfg.method = 'dipoli';
headmodel = ft_prepare_headmodel(cfg, bnd);
--------------------------------------------------------
*%adding electrodes to headmodel*
elec=ft_read_sens('Hydrocel_GSN_128_1.0_TRIM_mod.sfp'); %load electrode
file
% visualize head surface (scalp)
figure;
ft_plot_mesh(headmodel.bnd(1),
'edgecolor','none','facealpha',0.8,'facecolor',[0.6 0.6 0.8]);
hold on;
% plot electrodes
ft_plot_sens(elec,'style', 'sk')
% aligning electrodes
cfg = [];
cfg.method = 'interactive';
cfg.elec = elec;
cfg.headshape = headmodel.bnd(1);%scalp
st_elec_aligned = ft_electroderealign(cfg);
-----------------------------------------------
*%using the standard template sourcemodel from fieldtrip.*
load('standard_sourcemodel3d5mm.mat')
-------------------------------------
*%% timelock data*
cfg = [];
m0 = ft_timelockanalysis(cfg, dataM0);
--------------------------------------
*%% perform source analysis*
cfg = [];
cfg.method = 'lcmv';
cfg.lcmv.lambda='5%';
cfg.grid = sourcemodel.cfg.grid;---this is the standard template from
fieldtrip
cfg.headmodel = headmodel;
cfg.lcmv.keepfilter = 'yes';
cfg.lcmv.projectnoise='yes';
cfg.lcmv.fixedori = 'yes'; % project on axis of most variance using SVD
source_m0=ft_sourceanalysis(cfg,m0);
------------------------------
*%% source interpolation*
cfg = [];
cfg.interpmethod = 'nearest';
cfg.parameter = 'pow';
cfg.grid=sourcemodel.cfg.grid;
sourceinterp_m0 = ft_sourceinterpolate( cfg, source_m0, seg);
----------------------------------------------
*%plotting*
cfg = [];
cfg.method = 'ortho';
cfg.funcolorlim = 'maxabs';
cfg.funparameter= 'pow';
ft_sourceplot(cfg, sourceinterp_m0);
This is where it gives me the error. Please let me know if you need more
information. I also had a question about making a 'source' it seems that
the fieldtrip tutorial does not use a 'sourcemodel' but instead use a
dipolefitting source, is this comparable. Thank you for the help in advance.
Best,
Hassan
On Thu, Mar 10, 2016 at 3:00 AM, Schoffelen, J.M. (Jan Mathijs) <
jan.schoffelen at donders.ru.nl> wrote:
> Hassan,
> Can you please provide a bit more information with respect to what version
> of fieldtrip, matlab and operating system you use?
> Did you check whether the ‘seg’ looks healthy? Does the ‘mri’ plot well?
> We need more information to work with.
> Best,
> Jan-Mathijs
>
>
>
> On 09 Mar 2016, at 21:26, Hassan Aleem <ha438 at georgetown.edu> wrote:
>
> Hi everyone,
>
> I have a question that is possibly very easy to solve but is evading me. I
> am unable to get ft_sourceplot to work. For example when I run the code:
>
> [mri] = ft_read_mri('MNI152_T1_0.5mm.nii');
> mri.coordsys ='MNI'
>
> cfg = [];
> cfg.output = {'brain' 'scalp' 'skull'};
> seg = ft_volumesegment(cfg, mri);
> seg.anatomy = mri.anatomy;
>
> cfg = [];
> cfg.funparameter = 'brain';
> *ft_sourceplot(cfg,seg)*
>
> I get the error:
>
> *Error using textscan*
> First input can not be empty. Expected a non-empty string or a valid
> file-id.
>
> * Error in issubfield (line 44)*
> t = textscan(f,'%s','delimiter','.');
>
> * Error in ft_sourceplot (line 460)*
> hasmsk = issubfield(functional, cfg.maskparameter);
>
> This is happening regardless of what stage I use ft_sourceplot.
>
> Thanks for your consideration!
>
> Hassan
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160310/5fa11bca/attachment-0002.html>
More information about the fieldtrip
mailing list