<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://megcore.nih.gov/index.php?action=history&amp;feed=atom&amp;title=Sam_coreg</id>
	<title>Sam coreg - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://megcore.nih.gov/index.php?action=history&amp;feed=atom&amp;title=Sam_coreg"/>
	<link rel="alternate" type="text/html" href="https://megcore.nih.gov/index.php?title=Sam_coreg&amp;action=history"/>
	<updated>2026-04-07T09:05:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://megcore.nih.gov/index.php?title=Sam_coreg&amp;diff=3955&amp;oldid=prev</id>
		<title>Nugenta at 20:14, 8 March 2019</title>
		<link rel="alternate" type="text/html" href="https://megcore.nih.gov/index.php?title=Sam_coreg&amp;diff=3955&amp;oldid=prev"/>
		<updated>2019-03-08T20:14:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:14, 8 March 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Description==&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Description==&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sam_coreg is an algorithm which refines the coregistration between the MEG dataset and the MRI data using a cortical atlas derived from freesurfer. &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;In&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;traditional&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;unconstrained&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;SAM&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;analysis,&lt;/del&gt; the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;orientation&lt;/del&gt; of &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;each&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;source&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;voxel&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;would&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;be&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;determined&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;by&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;choosing&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;direction&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;that&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;maximizes&lt;/del&gt; the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;power.&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Intuitively,&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;this&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;algorithm&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;utilizes&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;known&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;orientations,&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;derived&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;from&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;FreeSurfer&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;surface&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;reconstruction&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;to&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;determine&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;best&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;fit&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;with&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/del&gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MEG&lt;/del&gt; data.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sam_coreg is an algorithm which refines the coregistration between the MEG dataset and the MRI data using a cortical atlas derived from freesurfer. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Even&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;if&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;fiducial&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;points&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;are placed in identical locations on&lt;/ins&gt; the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;face&lt;/ins&gt; of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MRI&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MEG&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;scans,&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;one&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;cannot&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;correct&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;for&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;movement&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;of&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;brain within&lt;/ins&gt; the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;skull&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;due&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;to&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;the&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;difference&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;in&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;supine&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vs.&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;seated&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;positions.&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sam_coreg&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;is&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;designed&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;to compensate for this&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;any&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;other&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;error&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;in&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;fiducial&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;placement,&lt;/ins&gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;in a&lt;/ins&gt; data&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; driven fashion&lt;/ins&gt;.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The algorithm is based upon the relationship between the error in the LCMV beamformer moment vector error and signal power (z^2). There is a known monotonic [statistical] relationship between source resolution &amp;amp; z^2 has been published. The accuracy of the linear solution for the moment vector is a function of z^2.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;In a traditional unconstrained SAM analysis, the orientation of each source voxel would be determined by choosing the direction that maximizes the power. Intuitively, this algorithm utilizes the known orientations, derived from the FreeSurfer surface reconstruction, to determine the best fit with the MEG data. &lt;/ins&gt;The algorithm is based upon the relationship between the error in the LCMV beamformer moment vector error and signal power (z^2). There is a known monotonic [statistical] relationship between source resolution &amp;amp; z^2 has been published. The accuracy of the linear solution for the moment vector is a function of z^2.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is a brute-force algorithm that iterates on successive translations &amp;amp; rotations of the MEG sensors (both primary &amp;amp; reference) to maximize the [inverse of the] product-moment correlation coefficent of angular error with z^2. For each vertex in the atlas, two LCMV beamformer solutions are performed - one using only the MEG data to solve the linear solution for the unconstrained moment vector and the other using the normal vector for that vertex to compute z^2. The difference between these two vectors is the &quot;angular error&quot;. The variance of this error over the vertices) should have a monotonic relationship with z^2 if the MEG and MRI are coregistered. In this version, the negative product-moment correlation of angular error (the arc cosine of the dot product of the unconstrained &amp;amp; constrained moment vectors) with z^2 from the constrained solution is used. For each pass, the program selects the transform giving the maximum correlation. In order to make the algorithm complete in a reasonable amount of time, a random subset of cortical normals is sampled for each iteration. Since a different random mesh is selected for each pass, one cannot expect correlation to improve with each pass. However, the average values of translation and rotation will converge to their best values.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is a brute-force algorithm that iterates on successive translations &amp;amp; rotations of the MEG sensors (both primary &amp;amp; reference) to maximize the [inverse of the] product-moment correlation coefficent of angular error with z^2. For each vertex in the atlas, two LCMV beamformer solutions are performed - one using only the MEG data to solve the linear solution for the unconstrained moment vector and the other using the normal vector for that vertex to compute z^2. The difference between these two vectors is the &quot;angular error&quot;. The variance of this error over the vertices) should have a monotonic relationship with z^2 if the MEG and MRI are coregistered. In this version, the negative product-moment correlation of angular error (the arc cosine of the dot product of the unconstrained &amp;amp; constrained moment vectors) with z^2 from the constrained solution is used. For each pass, the program selects the transform giving the maximum correlation. In order to make the algorithm complete in a reasonable amount of time, a random subset of cortical normals is sampled for each iteration&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. There are around 250,000 vertices in a FreeSurfer surface, and sam_coreg selects 2000 each pass that have angular error below a fixed cutoff and SNR above a fixed cutoff. Persons interested in determining optimal values for these parameters are welcome to contact MEG Core Facility staff&lt;/ins&gt;. Since a different random mesh is selected for each pass, one cannot expect correlation to improve with each pass. However, the average values of translation and rotation will converge to their best values.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This program assumes that a high-quality atlas of the cortex has been segmented from an MRI of each subject being studied. The pial surface is recommended. Before running sam_coreg, the initial surface vertices are generated by FSnormals.py. It us recommended that the the 17-25 Hz frequency band is used for coregistration, because the signal to noise is maximal in that band.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This program assumes that a high-quality atlas of the cortex has been segmented from an MRI of each subject being studied. The pial surface is recommended&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. It is important to note that geometric distortion of the MRI should be minimal&lt;/ins&gt;. Before running sam_coreg, the initial surface vertices are generated by FSnormals.py. It us recommended that the the 17-25 Hz frequency band is used for coregistration, because the signal to noise is maximal in that band.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; Finally, use of this program is only sane if your subject has not moved significantly over the course of the MEG recording. Attempting to co-localize MEG and MRI to sub-millimeter precision when the participant moved 5mm over the course of the recording is pointless. &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Currently, this program is rather slow (on the order of 18-24 hours per subject). Future releases will (hopefully) include parallelization. &lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Currently, this program is rather slow (on the order of 18-24 hours per subject). Future releases will (hopefully) include parallelization. &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nugenta</name></author>
	</entry>
	<entry>
		<id>https://megcore.nih.gov/index.php?title=Sam_coreg&amp;diff=3954&amp;oldid=prev</id>
		<title>Nugenta: Created page with &quot; Return to Source Localization - SAM  ==Description==  sam_coreg is an algorithm which refines the coregistration between the MEG dataset and th...&quot;</title>
		<link rel="alternate" type="text/html" href="https://megcore.nih.gov/index.php?title=Sam_coreg&amp;diff=3954&amp;oldid=prev"/>
		<updated>2019-03-08T19:45:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/index.php/Source_Localization_-_SAM&quot; title=&quot;Source Localization - SAM&quot;&gt; Return to Source Localization - SAM&lt;/a&gt;  ==Description==  sam_coreg is an algorithm which refines the coregistration between the MEG dataset and th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Source Localization - SAM | Return to Source Localization - SAM]]&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
sam_coreg is an algorithm which refines the coregistration between the MEG dataset and the MRI data using a cortical atlas derived from freesurfer. In a traditional unconstrained SAM analysis, the orientation of each source voxel would be determined by choosing the direction that maximizes the power. Intuitively, this algorithm utilizes the known orientations, derived from the FreeSurfer surface reconstruction, to determine the best fit with the MEG data.&lt;br /&gt;
&lt;br /&gt;
The algorithm is based upon the relationship between the error in the LCMV beamformer moment vector error and signal power (z^2). There is a known monotonic [statistical] relationship between source resolution &amp;amp; z^2 has been published. The accuracy of the linear solution for the moment vector is a function of z^2.&lt;br /&gt;
&lt;br /&gt;
This is a brute-force algorithm that iterates on successive translations &amp;amp; rotations of the MEG sensors (both primary &amp;amp; reference) to maximize the [inverse of the] product-moment correlation coefficent of angular error with z^2. For each vertex in the atlas, two LCMV beamformer solutions are performed - one using only the MEG data to solve the linear solution for the unconstrained moment vector and the other using the normal vector for that vertex to compute z^2. The difference between these two vectors is the &amp;quot;angular error&amp;quot;. The variance of this error over the vertices) should have a monotonic relationship with z^2 if the MEG and MRI are coregistered. In this version, the negative product-moment correlation of angular error (the arc cosine of the dot product of the unconstrained &amp;amp; constrained moment vectors) with z^2 from the constrained solution is used. For each pass, the program selects the transform giving the maximum correlation. In order to make the algorithm complete in a reasonable amount of time, a random subset of cortical normals is sampled for each iteration. Since a different random mesh is selected for each pass, one cannot expect correlation to improve with each pass. However, the average values of translation and rotation will converge to their best values.&lt;br /&gt;
&lt;br /&gt;
This program assumes that a high-quality atlas of the cortex has been segmented from an MRI of each subject being studied. The pial surface is recommended. Before running sam_coreg, the initial surface vertices are generated by FSnormals.py. It us recommended that the the 17-25 Hz frequency band is used for coregistration, because the signal to noise is maximal in that band.&lt;br /&gt;
&lt;br /&gt;
Currently, this program is rather slow (on the order of 18-24 hours per subject). Future releases will (hopefully) include parallelization. &lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
&lt;br /&gt;
  sam_coreg -r &amp;lt;dataset_name&amp;gt; -m &amp;lt;parameter_file&amp;gt; [options]&lt;br /&gt;
&lt;br /&gt;
The -r flag designates the dataset name (with or without the .ds suffix), and -m designates the parameter file name.&lt;br /&gt;
&lt;br /&gt;
Other options:&lt;br /&gt;
&lt;br /&gt;
  -v  Verbose mode, without this flag sam_wts works silently except for error messages&lt;br /&gt;
  -p  Output angular error and Z^2 for every vertex in each pass to a .txt file&lt;br /&gt;
  -h  Show help&lt;br /&gt;
&lt;br /&gt;
Required Parameters:&lt;br /&gt;
&lt;br /&gt;
  Atlas: File containing cortical normals, generated using FSNormals.py&lt;br /&gt;
  SurfaceType: type of surface used to generate the Atlas file&lt;br /&gt;
  Model: Head model, must be Nolte&lt;br /&gt;
  MRIDirectory: Specify where to locate the necessary MRI files, including Atlas file&lt;br /&gt;
  &lt;br /&gt;
Optional Parameters: &lt;br /&gt;
&lt;br /&gt;
  MRIDirectory: Specify where to locate the necessary MRI files&lt;br /&gt;
  PrefixLength: Specify characters used for identifying MRI and headmodel files.&lt;br /&gt;
  &lt;br /&gt;
==Output Files==  &lt;br /&gt;
&lt;br /&gt;
The sam_coreg program produces a rigid body transform that can be applied to the MEG sensors to bring them into precise alignment with the MRI data. The transformation is written into the SAM subdirectory of the dataset so that subsequent beamformer solutions can read the transformation using the parameter keyword &amp;quot;Transform&amp;quot;. The default name for this file is Transform.xfm. A Transform.txt file is also produced, which gives the correlation of angular error and Z^2 for each translation and rotation tried. Optionally, a Meshnn.txt file can be created which gives the angular error and Z^2 for each individual vertex for each pass which can be visualized as a scatterplot.&lt;/div&gt;</summary>
		<author><name>Nugenta</name></author>
	</entry>
</feed>