<html>
  <head>

  </head>
  <body style="margin-right: 4px; font-variant: normal; margin-left: 4px; margin-top: 4px; margin-bottom: 1px; line-height: normal">
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">Dear list members,</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">sorry for asking a lot in recent days - i am entering a new stage of enlightment with respect to source analysis, and there are only one or two questions left until i am there. My current problem is the following:</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">I am trying to find the voxel coordinates in an individual source volume that correspond to the voxel coordinates of a ROI, which i identified in the normalized brain. My original source volume is called SOURCE, the interpolated version is SOURCEi, and the normalized volume is NORM. Starting from NORM, I identified voxel coordinates belonging to a ROI, then determined the corresponding head (MNI) coordinates and transformed them into head coordinates of the interpolated individual source SOURCEi: </font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">[x,y,z] = ind2sub(NORM.dim, find(mask==1)); % voxel indices of a ROI as given in mask</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">headcoords_NORM   = warp_apply(NORM.transform, [x y z], 'homogeneous'); % head coordinates of ROI</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">headcoords_SOURCEi = warp_apply(inv(NORM.cfg.final), headcoords_NORM, 'homogeneous'); % corresponding head coordinates in SOURCEi</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">I checked this with several source plots and the results looked fine. </font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">Next, i did an LCMV beamformer with the option cfg.keepfilter = 'yes' in order to reconstruct source waveforms at the ROI. The resulting SOURCE has the filters that i need, but a lower resolution and therefore different voxel indices than SOURCEi. So i need to take the head coordinates i found for SOURCEi and identify the corresponding grid locations in SOURCE . For this i only found a crude solution where i, within the SOURCE.pos field, search for the triplet that produces the smallest squared difference to the MNI coordinates of my ROI in SOURCEi. The matrix subscripts for that triplet give the best fitting grid location for my desired ROI, and the corresponding index is pointing to my desired filter:</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">indx = find((((SOURCE.pos(:,1)-headcoords_SOURCEi(1)).^2) + ((SOURCE.pos(:,2)-headcoords_SOURCEi(2)).^2) + </font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">((SOURCE.pos(:,3)-headcoords_SOURCEi(3)).^2)) == min  (((SOURCE.pos(:,1)-headcoords_SOURCEi(1)).^2) + ((SOURCE.pos(:,2)-headcoords_SOURCEi(2)).^2) + ((SOURCE.pos(:,3)-headcoords_SOURCEi(3)).^2))); % assume that ROI is a single source location, 1*3 vector</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">[xvox, yvox, zvox] = ind2sub(SOURCE.dim, indx);</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">ROI_filter   = SOURCE.avg.filter{indx};</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">I am very unsure with these last lines of code. Is it true that SOURCE.pos holds MNI coordinates (for the code would be useless if not)? Or is there an easier solution that i am not aware of yet? Any comments would be greatly appreciated.</font>    </p>
<br>      
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">Best regards,</font>    </p>
    <p style="margin-top: 0; margin-bottom: 0">
      <font face="Dialog" size="2">Gregor</font>    </p>
  <font face="Dialog" STYLE="font-size: 10pt"><br>--  <BR>Dr. rer. nat. Gregor Volberg <gregor.volberg@psychologie.uni-regensburg.de> ( mailto:gregor.volberg@psychologie.uni-regensburg.de ) <BR>University of Regensburg <BR>Institute for Experimental Psychology <BR>93040 Regensburg, Germany <BR>Tel: +49 941 943 3862  <BR>Fax: +49 941 943 3233 <BR><a href="http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html ">http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html </a><BR><br><br></font></body>
</html>