<div dir="ltr">

<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">Hello Jan-Mathijs and thank you very much for your answer!!</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">Since my approach is not producing results, I'm naturally very open to
different strategies!</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span></p>

<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">Unfortunately, I do not understand how exactly your suggested process of
creating a mask works. </span></p>

<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">Namely, at least for me, the mri2.tissue is a 3D matrix that has the same
size as the anatomy. Result of strcmp(atlas.tissuelabel, ‘yourfavoritebrodmannarea’)
is a vector that has a 1 at the index of my favorite Brodmann area. Matlab does
not allow comparison between two of them. </span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">At first I thought that the value in the tissue structure is a number
matching the index of a label, but then I saw that there are also decimal
numbers in the mri2.tissue as well, which confused me.</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">I also tried with following:<br>
mri2.mask = mri2.tissue==find(strcmp(atlas.tissuelabel,'brodmann area 17')); </span></p>

<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">which does return something, but the mask has points spread around the
whole brain, so this obviously doesn't work the way I thought it does. </span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">So I'm not really sure how to make this mask work.</span><br></p><div>

<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif""><br>
All the best,<br>
Andreja Kostić</span></p>

</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-06 16:06 GMT+02:00 Schoffelen, J.M. (Jan Mathijs) <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
Dear Andreja,
<div><br>
</div>
<div>I have never understood ft_volumelookup myself, so I wonder whether you would be helped by proposing a different strategy…</div>
<div><br>
</div>
<div>I would do the following:</div>
<div><br>
</div>
<div>% read in the atlas</div>
<div>atlas = ft_read_atlas(‘somefilename’);</div>
<div><br>
</div>
<div>% read in and normalise the anatomical image</div>
<div>mri = ft_read_mri(‘someotherfilename’)</div>
<div>mri = ft_volumenormalise([], mri);</div>
<div><br>
</div>
<div>% assuming that both atlas and mri are in the same coordinate system</div>
<div>cfg = [];</div>
<div>cfg.parameter = ‘tissue’;</div>
<div>mri2 = ft_sourceinterpolate(cfg, atlas, mri);</div>
<div><br>
</div>
<div>The last step gives you the atlas interpolated onto the anatomical MRI. </div>
<div><br>
</div>
<div>It should be straightforward to create a boolean mask from here that specifies a particular ROI</div>
<div><br>
</div>
<div>mri2.mask = mri2.tissue==strcmp(atlas.tissuelabel, ‘yourfavoritebrodmannarea’);</div>
<div><br>
</div>
<div><br>
</div>
<div>I hope this helps.</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div>
<blockquote type="cite"><div><div class="h5">
<div>On 06 Jul 2016, at 15:33, Andreja Kostić <<a href="mailto:andrejakosticln@gmail.com" target="_blank">andrejakosticln@gmail.com</a>> wrote:</div>
<br>
</div></div><div><div><div class="h5">
<div dir="ltr">
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">Hello dear Fieldtrippers!</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">This is my first post on the mailing list, so I apologize if this looks a bit confused.
</span></p>
<div style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span><br>
</div>
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">So I'm trying to use the WFU PickAtlas for Brodmann areas in what I think are MNI coordinates to find
 specific regions inside of a brain (I'm coming from electrical engineering background, so I can't do that "by hand") in an individual whole-head MRI and I'm having issues getting sane results.<br>
<br>
I suspect that my workflow is the problem, so I would be very grateful if someone could provide some advice as to what I should be actually doing.
<br>
<br>
My original idea was to take MRI in CTF coordinates, convert it to MNI coordinates and then just use atlas to make masks. From what I could gather, it's not that simple.
</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">So here are examples of what I'm doing right now:<br>
<br>
ft_defaults;</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">%Let's read atlas</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">atlas = ft_read_atlas('C:\REALY_LONG_PATH_TO_PICKATLAS\wfu_pickatlas\MNI_atlas_templates\TD_brodmann.nii');<br>
<br>
<br>
%Using Subject01from FT tutorials right now, for simplicity's sake.<br>
mri = ft_read_mri('Subject01\Subject01.mri');<br>
<br>
<br>
%Reslice, apply transformations<br>
cfg=[];<br>
cfg.dim=[256 256 256];<br>
mri_resliced=ft_volumereslice(cfg, mri);<br>
<br>
cfg=[];<br>
mri_norm1=ft_volumenormalise(cfg,mri_resliced);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">%Unfortunately, this cuts off everything below the nose!</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">%Still let's take a look at the visualization with atlas<br>
<br>
cfg=[];<br>
cfg.inputcoord='mni';<br>
cfg.atlas=atlas;<br>
cfg.roi='brodmann area 4';<br>
<br>
mask4 = ft_volumelookup(cfg, mri_norm1);<br>
mri_norm1.mask4=mask4;<br>
<br>
cfg=[];<br>
cfg.atlas=atlas;<br>
cfg.funparameter = 'mask4';<br>
ft_sourceplot(cfg,mri_norm1)</span></p>
<div style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span><br>
</div>
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">%The result doesn't look so good, big part of the area seems to fit inside of the gaps between brain
 tissue!</span></p>
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">So this doesn't seem to have worked out. My next attempt was to directly use ft_convert_coordsys. This
 fixed the cutting issue, but it didn't solve the problem of results looking strange.</span></p>
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">So my other idea was to try with
<br>
<br>
template=ft_read_mri('C:\PathToFT\external\spm8\templates\T1.nii');<br>
<br>
cfg=[];<br>
cfg.method='spm';<br>
cfg.coordsys='spm';<br>
mri_realigned=ft_volumerealign(cfg,mri_resliced,template);</span></p>
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">But this produces very obviously wrong results, like coronal slices on sagittal plane.
</span></p>
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US">I'm also not sure if I should be trying to somehow transform an atlas to fit the individual MRI that
 I'm using?<br>
<br>
All the best,<br>
Andreja Kostić<br>
<br>
</span></p>
<div style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span><br>
</div>
<div style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US"> </span><br>
</div>
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US"><br>
<br>
<br>
<br>
</span></p>
<div><span lang="EN-US"> </span><br>
</div>
</div></div></div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br>
</div>
</div>

<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>