<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Gabriel,<div><br></div><div>have you tried using a grid with the exact same dimensions as the MRI, i.e.:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">%% Set the start and End of the x,y,z axis</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox1 = mri.transform*[mri.dim,1]'; % start</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox1 = vox1(1:3)/10; % convert to mm</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox2 = mri.transform*[1,1,1,1]';   %end</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox2 = vox2(1:3)/10; % convert to mm</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">%% Choose the Minima</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox_min = min([vox1,vox2]')';</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox_max = max([vox1,vox2]')';</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">%% Set the spacing</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox_delta = abs(mri.transform*[1,1,1,1]'-mri.transform*[2,2,2,1]'); </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">vox_delta = vox_delta(1:3)/10; % convert to mm</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">RES = vox_delta(1);</div><div><br></div><div>and then use:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">cfg.grid.xgrid = vox_min(1):RES:vox_max(1); </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">cfg.grid.ygrid = vox_min(2):RES:vox_max(2); </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">cfg.grid.zgrid = vox_min(3):RES:vox_max(3); </div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">Good luck,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">Julian</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(40, 50, 207); "><br></div><div><br></div><div><div>Am 15.08.2016 um 17:46 schrieb gab dippel:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-family: Tahoma; font-size: 13px;" class="">Dear Fieldtrippers, </div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">my current question(s) has previously been answered here by Julian Keil: <a href="https://mailman.science.ru.nl/pipermail/fieldtrip/2015-December/009882.html" class="">https://mailman.science.ru.nl/pipermail/fieldtrip/2015-December/009882.html</a> yet I appear to face a conceptual problems in my understanding. </div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">So the goal is to compute the virtual channels of a certain atlas region let say the SMA. </div><div style="font-family: Tahoma; font-size: 13px;" class="">As we do not have individual MRI, I thought it should be possible to make use of the MNI template MRI the 'standard_mri.mat' as included in fieldtrip. </div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">Now according to Julian's answer from the above link the steps to go about the virtual channels reconstruction is: </div><div style="font-family: Tahoma; font-size: 13px;" class="">1. Compute the virtual channels for all grid points in the cortex (regular grid /sourcemodel)</div><div style="font-family: Tahoma; font-size: 13px;" class="">--> So here I construct an MRI based grid</div><div style="font-family: Tahoma; font-size: 13px;" class="">
</div><div style="font-family: Tahoma; font-size: 13px;" class="">load standard_mri.mat</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg = [];</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg.mri = mri;</div><div style="font-family: Tahoma; font-size: 13px;" class="">template_grid  = ft_prepare_sourcemodel(cfg);</div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">this yields a grid with dimensions of 19x22x18 and 4093 gridpoints within the brain.</div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">2. If you have computed the virtual channels on an  individual MRI, make sure  that the position corresponds  to the standard MRI (I think that's described in the source analysis -tutorial)</div><div style="font-family: Tahoma; font-size: 13px;" class="">--> this is obsolete in my case i guess</div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">3. Build a high resolution 3D-Grid on the standard MRI (It's important to use one grid point per voxel)</div><div style="font-family: Tahoma; font-size: 13px;" class="">--> I am not sure how. the following gives me an Error 'incorrect cfg specification for constructing a dipole grid':</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg = [];</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg.grid.xgrid  = -90:1:90;</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg.grid.ygrid  = -108:1:108;</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg.grid.zgrid  = -90:1:90;</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg.grid.unit   = 'mm';</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg.grid.tight  = 'yes';</div><div style="font-family: Tahoma; font-size: 13px;" class="">cfg.mri = mri;</div><div style="font-family: Tahoma; font-size: 13px;" class="">high_res_grid_mm  = ft_prepare_sourcemodel(cfg)</div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">4. Select all grid points from the grid of step 3 which belongs to an atlas (ft_volumelookup)</div><div style="font-family: Tahoma; font-size: 13px;" class="">--> Now atlas has a dimension of 91x109x91 but the standard mri of 181x217x181. Here, I am wondering how to align the two to use logical indexing for finding the ROI voxels.</div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">5. Use pythagoras to find the virtual channels from step 2 closest to the grid points from step 4.</div><div style="font-family: Tahoma; font-size: 13px;" class="">--> This is clear if the grid from step 1 and 3 are of the same dimension which is however not the case here.</div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">I would appreciate any feedback and ideas on this issue.</div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">Kind regards, </div><div style="font-family: Tahoma; font-size: 13px;" class=""><br class=""></div><div style="font-family: Tahoma; font-size: 13px;" class="">Gabriel</div></div>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</blockquote></div><br></div></body></html>