<div dir="ltr">Hi Parinaz,<div><br></div><div>I'm working on similar atlas-based source analyses, and a few days back I kind of asked the same question. In the mean time I solved it. There are two possible approaches:</div><div><br></div><div>1) You can already focus your source analyses on ROIs at the level of the lead field grid.</div><div>2) You can mask your output of ft_sourcegrandaverage with atlas-based ROIs. </div><div><br></div><div>For both you need to use ft_read_atlas (check the help, it's pretty self explanatory, although I don't know if Fieldtrip has your HMAT atlas shipped), and tf_volumelookup.</div><div><br></div><div>For option 1), you need subject-specific grids that are aligned (warped) to an MNI template, and do the masking already at the grid level; then proceed to your within-subject source analysis, and group stats; you'll now only have source activity from a ROI. It's all explained here: <a href="http://www.fieldtriptoolbox.org/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_brain_atlas_based_mni_space">http://www.fieldtriptoolbox.org/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_brain_atlas_based_mni_space</a>, although this example uses all combined ROIs from one atlas, to remove ventricles etc. But you can apply the same trick to one specific ROI: for the cfg of ft_volumelookup, instead of <span style="color:rgb(0,0,0);font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250)">cfg.</span><span class="" style="font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250);padding:0px;margin:0px;color:rgb(0,102,0)">roi</span><span style="color:rgb(0,0,0);font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250)"> = atlas.</span><span class="" style="font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250);padding:0px;margin:0px;color:rgb(0,102,0)">tissuelabel</span><span style="color:rgb(0,0,0);font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250)">; </span>you say, e.g. <span style="color:rgb(0,0,0);font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250)">cfg.</span><span class="" style="font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250);padding:0px;margin:0px;color:rgb(0,102,0)">roi</span><span style="color:rgb(0,0,0);font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250)"> = 'M1'</span><span style="color:rgb(0,0,0);font-family:Consolas,'Andale Mono',Menlo,Monaco,monospace;font-size:12px;text-align:justify;white-space:pre-wrap;background-color:rgb(247,249,250)">; </span>or whatever the atlas label of your motor area is in the HMAT atlas you're using.</div><div><br></div><div>For option 2), you basically set the .inside voxels to be those of the ROI mask, and additionally you could set the power of all voxels outside of the mask to zero. Here, too, either the subject-specific source results should be normalized to a common template, or you should have done the subject-specific source analysis on pre-warped MNI-based grids. Below code is from my analysis, where I select occipital voxels at the group level on whole-brain source results:</div><div><br></div><div><div><font face="monospace, monospace">atlas = ft_read_atlas('Z:\Toolboxes\fieldtrip_github\fieldtrip\template\atlas\aal\ROI_MNI_V4.nii');</font></div><div><font face="monospace, monospace">atlas = ft_convert_units(atlas,'cm');</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">cfg = [];</font></div><div><font face="monospace, monospace">cfg.atlas = atlas;</font></div><div><font face="monospace, monospace">cfg.inputcoord = 'mni';</font></div><div><font face="monospace, monospace">cfg.roi = atlas.tissuelabel(43:54);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">occ_mask = ft_volumelookup(cfg,template_grid);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">grandavg_col_masked = grandavg_col;</font></div><div><font face="monospace, monospace">grandavg_grey_masked = grandavg_grey;</font></div><div><font face="monospace, monospace">for s=1:10</font></div><div><font face="monospace, monospace"> grandavg_col_masked{s}.inside=occ_mask(:);</font></div><div><font face="monospace, monospace"> grandavg_grey_masked{s}.inside=occ_mask(:);</font></div><div><font face="monospace, monospace"> grandavg_col_masked{s}.avg.pow(occ_mask(:)==0)=0;</font></div><div><font face="monospace, monospace"> grandavg_grey_masked{s}.avg.pow(occ_mask(:)==0)=0;</font></div><div><font face="monospace, monospace">end</font></div></div><div><br></div><div>Hope this helps.</div><div>- Joram</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 16, 2015 at 2:29 PM, Babaeeghazvini, P. <span dir="ltr"><<a href="mailto:p.babaeeghazvini@vu.nl" target="_blank">p.babaeeghazvini@vu.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hello
<div><br>
</div>
<div>I am doing beamformer on EEG data to find the source position of bimanual activity based on dics method. For that I want to see the activity only on motor area and remove the activities of other regions based on HMAT atlas (<a href="http://lrnlab.org/" target="_blank">http://lrnlab.org/</a>) <span style="font-size:10pt">which
provides a binary mask of motor cortex. I need to do that because I want to calculate the position of maximum activity in motor region and I dont want this maximum activity appear somewhere else due to any possible </span>artifact. please tell me how and
where should I apply HMAT binary mask on the output of source analysis.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Parinaz.</div>
</div>
</div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Joram van Driel, PhD<div>Postdoc @ Vrije Universiteit Amsterdam</div><div>Cognitive Psychology</div><div><br></div></div></div></div></div></div></div>
</div>