[FieldTrip] Better Segmentation of MRI Images
Schoffelen, J.M. (Jan Mathijs)
janmathijs.schoffelen at donders.ru.nl
Wed Mar 22 09:51:45 CET 2023
Hi Edward,
Is there a particular reason why you reslice the image? As long as it’s not anisotropic there should no specific reason to do so. I ask because it seems that the displayed meshes are cut off at the back of the head, which may suggest too small a bounding box at the back of the head.
Best wishes,
Jan-Mathijs
On 21 Mar 2023, at 23:29, Edward Lannon via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
Dear Community,
I am analyzing resting state EEG data. We also have t1W images collected at another time. I would like to use the t1W images to create a head model for my EEG source analysis.
My current pipeline does not construct the head properly I get the error when computing volumen conduction:
Error using ft_headmodel_bemcp (line 127)
vertex 467 of surface 2 is outside surface 3
The pipeline was taken from the Fieldtrip turorial websites. See below. See also attached for MRI and segmented visualizations. I have tried chagning cfg.scalpthreshold, but have not landed on a desirable outcome. I have also used ft_volumebiascorrect and the scalp is not calculated correctly. Is there another strategy that I can use to calculate the scalp correctly?
%Interactive Search of Fids
cfg = [];
cfg.method = 'interactive'
cfg.coordsys = 'ctf'; % the desired coordinate system
mri_realigned = ft_volumerealign(cfg, mri)
%Cut image
cfg = [];
cfg.method = 'linear';
mri_resliced = ft_volumereslice(cfg, mri_realigned);
%Segment to areas
cfg = [];
cfg.output = {'brain', 'skull', 'scalp'};
%cfg.scalpthreshold = 0.1;
%cfg.scalpsmooth = 'no';
segmentedmri = ft_volumesegment(cfg, mri_resliced);
disp(segmentedmri)
%Visualize the segmentation result
segmentedmri_indexed = ft_checkdata(segmentedmri, 'segmentationstyle', 'indexed')
segmentedmri_indexed.anatomy = mri_resliced.anatomy;
cfg = [];
cfg.method = 'ortho';
cfg.anaparameter = 'anatomy';
cfg.funparameter = 'tissue';
cfg.funcolormap = [
0 0 0
1 0 0
0 1 0
0 0 1
];
ft_sourceplot(cfg, segmentedmri_indexed)
%Create Mesh
cfg = [];
cfg.tissue = {'brain', 'skull', 'scalp'};
cfg.numvertices = [3000 2000 1000];
mesh = ft_prepare_mesh(cfg, segmentedmri);
%Plot Mesh
figure
ft_plot_mesh(mesh(1), 'facecolor', 'none'); % brain
view([0 -1 0]); % from the right side
figure
ft_plot_mesh(mesh(2), 'facecolor', 'none'); % skull
view([0 -1 0]); % from the right side
figure
ft_plot_mesh(mesh(3), 'facecolor', 'none'); % scalp
view([0 -1 0]); % from the right side
figure
ft_plot_mesh(mesh(1), 'facecolor','r', 'facealpha', 1.0, 'edgecolor', 'k', 'edgealpha', 1);
hold on
ft_plot_mesh(mesh(2), 'facecolor','g', 'facealpha', 0.4, 'edgecolor', 'k', 'edgealpha', 0.1);
hold on
ft_plot_mesh(mesh(3), 'facecolor','b', 'facealpha', 0.4, 'edgecolor', 'k', 'edgealpha', 0.1);
% Create a volume conduction model
cfg = [];
cfg.method = 'bemcp'; % You can also specify 'openmeeg', 'bemcp', or another method
headmodel = ft_prepare_headmodel(cfg, mesh);
<Brain.jpg><Skull.jpg><Scalp.jpg><HeadModel.jpg><Original_MRI.jpg>_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5jJcbM2emFh0ZA5a3cYSmgT1pVUo_Jdc1EhFm7GzBCUQpHA6HcGvPjYnx5aZlkSVtkFzEvdVmuSfhIB1KPBHm051SCEs-e8v63P48w$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230322/bca7c7b9/attachment.htm>
More information about the fieldtrip
mailing list