<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Sorry Andreja, 
<div class="">I forgot the find() indeed.</div>
<div class="">Also, I forgot to mention that the cfg to ft_sourceinterpolate should specify the interpolation method to be ‘nearest’.</div>
<div class="">I hope this helps.</div>
<div class="">Best,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 06 Jul 2016, at 18:20, Andreja Kostić <<a href="mailto:andrejakosticln@gmail.com" class="">andrejakosticln@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US" class="">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" class="">Since my approach is not producing results, I'm naturally very open to different strategies!</span></p>
<div style="margin-bottom: 0.0001pt; line-height: normal;" class=""><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US" class=""> </span><br class="webkit-block-placeholder">
</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" class="">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" class="">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" class="">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" class="">I also tried with following:<br class="">
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" class="">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" class="">So I'm not really sure how to make this mask work.</span><br class="">
</p>
<div class="">
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" class=""><br class="">
All the best,<br class="">
Andreja Kostić</span></p>
</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">2016-07-06 16:06 GMT+02:00 Schoffelen, J.M. (Jan Mathijs)
<span dir="ltr" class=""><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank" class="">jan.schoffelen@donders.ru.nl</a>></span>:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Dear Andreja,
<div class=""><br class="">
</div>
<div class="">I have never understood ft_volumelookup myself, so I wonder whether you would be helped by proposing a different strategy…</div>
<div class=""><br class="">
</div>
<div class="">I would do the following:</div>
<div class=""><br class="">
</div>
<div class="">% read in the atlas</div>
<div class="">atlas = ft_read_atlas(‘somefilename’);</div>
<div class=""><br class="">
</div>
<div class="">% read in and normalise the anatomical image</div>
<div class="">mri = ft_read_mri(‘someotherfilename’)</div>
<div class="">mri = ft_volumenormalise([], mri);</div>
<div class=""><br class="">
</div>
<div class="">% assuming that both atlas and mri are in the same coordinate system</div>
<div class="">cfg = [];</div>
<div class="">cfg.parameter = ‘tissue’;</div>
<div class="">mri2 = ft_sourceinterpolate(cfg, atlas, mri);</div>
<div class=""><br class="">
</div>
<div class="">The last step gives you the atlas interpolated onto the anatomical MRI. </div>
<div class=""><br class="">
</div>
<div class="">It should be straightforward to create a boolean mask from here that specifies a particular ROI</div>
<div class=""><br class="">
</div>
<div class="">mri2.mask = mri2.tissue==strcmp(atlas.tissuelabel, ‘yourfavoritebrodmannarea’);</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">I hope this helps.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">
<div class="h5">
<div class="">On 06 Jul 2016, at 15:33, Andreja Kostić <<a href="mailto:andrejakosticln@gmail.com" target="_blank" class="">andrejakosticln@gmail.com</a>> wrote:</div>
<br class="">
</div>
</div>
<div class="">
<div class="">
<div class="h5">
<div dir="ltr" class="">
<p class="MsoNormal" style="margin-bottom:12pt;line-height:normal"><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US" class="">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" class="">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" class=""><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US" class=""> </span><br class="">
</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" class="">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 class="">
<br class="">
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 class="">
<br class="">
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" class="">So here are examples of what I'm doing right now:<br class="">
<br class="">
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" class="">%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" class="">atlas = ft_read_atlas('C:\REALY_LONG_PATH_TO_PICKATLAS\wfu_pickatlas\MNI_atlas_templates\TD_brodmann.nii');<br class="">
<br class="">
<br class="">
%Using Subject01from FT tutorials right now, for simplicity's sake.<br class="">
mri = ft_read_mri('Subject01\Subject01.mri');<br class="">
<br class="">
<br class="">
%Reslice, apply transformations<br class="">
cfg=[];<br class="">
cfg.dim=[256 256 256];<br class="">
mri_resliced=ft_volumereslice(cfg, mri);<br class="">
<br class="">
cfg=[];<br class="">
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" class="">%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" class="">%Still let's take a look at the visualization with atlas<br class="">
<br class="">
cfg=[];<br class="">
cfg.inputcoord='mni';<br class="">
cfg.atlas=atlas;<br class="">
cfg.roi='brodmann area 4';<br class="">
<br class="">
mask4 = ft_volumelookup(cfg, mri_norm1);<br class="">
mri_norm1.mask4=mask4;<br class="">
<br class="">
cfg=[];<br class="">
cfg.atlas=atlas;<br class="">
cfg.funparameter = 'mask4';<br class="">
ft_sourceplot(cfg,mri_norm1)</span></p>
<div style="margin-bottom:0.0001pt;line-height:normal" class=""><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US" class=""> </span><br class="">
</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" class="">%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" class="">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" class="">So my other idea was to try with
<br class="">
<br class="">
template=ft_read_mri('C:\PathToFT\external\spm8\templates\T1.nii');<br class="">
<br class="">
cfg=[];<br class="">
cfg.method='spm';<br class="">
cfg.coordsys='spm';<br class="">
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" class="">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" class="">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 class="">
<br class="">
All the best,<br class="">
Andreja Kostić<br class="">
<br class="">
</span></p>
<div style="margin-bottom:0.0001pt;line-height:normal" class=""><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US" class=""> </span><br class="">
</div>
<div style="margin-bottom:0.0001pt;line-height:normal" class=""><span style="font-size:12pt;font-family:"Times New Roman","serif"" lang="EN-US" class=""> </span><br class="">
</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" class=""><br class="">
<br class="">
<br class="">
<br class="">
</span></p>
<div class=""><span lang="EN-US" class=""> </span><br class="">
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank" class="">fieldtrip@donders.ru.nl</a><br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
<br class="">
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
</blockquote>
</div>
<br class="">
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>