<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>How many threads are you running? Have you tried setting the environment variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS to 1, to see of the results then become consistent?</div><div><br></div><div>Brad</div><div><br><div><div>On Feb 28, 2013, at 5:52 PM, lien lee &lt;<a href="mailto:lienlee@gmail.com">lienlee@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">Hi itk-users,<div><br></div><div>I took a further step today. &nbsp;I derived a class from&nbsp;MattesMutualInformationImageToImageMetric, and made it being the metric, so that, I could sneak into itk and visit the protected member&nbsp;ImageToImageMetric&lt; TFixedImage, TMovingImage &gt;::m_FixedImageSamples. I printed out a couple of sample points (their coordinates and image values), and I also printed out the seed value of the random number generator, which I set as&nbsp;ReinitializeSeed(76926294). &nbsp;I get the seed value by calling&nbsp;Statistics::MersenneTwisterRandomVariateGenerator::GetInstance()-&gt;GetSeed();</div>
<div>In different runs, I do see same seed were used, but I also do see different sample points. &nbsp;I tried this on two different computers, at both of which I saw the inconsistent results. Seems to be the random number generator is non-deterministic even with same seed. &nbsp;However, the weird thing is if I do not use the image mask, it would be consistent.&nbsp;</div>
<div><br></div><div>Any thoughts?</div><div><br><br><div class="gmail_quote">2013/2/26 lien lee <span dir="ltr">&lt;<a href="mailto:lienlee@gmail.com" target="_blank">lienlee@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">Hi Seth,</span><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">
<br></div><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">By clicking the link you provided, the code I saw there is as partly attached, which is different from what I have with ITK 4.2 on my computer. &nbsp;</div>
<div class="im">
<div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">
I do not have experience with this code, and I am not exactly sure how it works. &nbsp;But, looks to me, optimizer would call the function during each iteration, and the function would rebuild all the sample points again and again for all the iterations. &nbsp;If my understanding were correct, this would be quite different from what I have with ITK 4.2 on my computer, where all the samples were created in&nbsp;MattesMutualInformationImageToImageMetric::Initialize() as&nbsp;<b>a one time thing</b>,&nbsp;and the counted points would be determined for each iteration using the current transform by checking whether the mapped points were inside the moving image mask. Therefore, for the code I am working on, to my understanding, if I called&nbsp;ReinitializeSeed(76926294) before generating all the sample points in&nbsp;MattesMutualInformationImageToImageMetric::Initialize(), the results should be deterministic, no matter whether I applied the image masks or not. But, the testing results with image mask applied does NOT support my understanding.</div>

<div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">
BTW, to your question, my moving image mask may not be "restrictive" because it occupied pretty much about 80% of the whole moving image.</div><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">

<br></div><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">Thanks again for your inputs.</div><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">
<br></div><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif"><br></div></div><div><div class="h5"><div style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">
<div style="white-space:pre-wrap;font-family:monospace"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l106" style="font-size:large;color:rgb(153,153,153);text-decoration:initial" target="_blank"> 106</a><span style="font-size:large"> template&nbsp;&lt;class&nbsp;TFixedImage,&nbsp;</span><span style="font-size:large">class&nbsp;TMovingImage&gt;</span></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l107" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 107</a> void</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l108" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 108</a> MutualInformationImageToImageMetric&lt;TFixedImage,&nbsp;TMovingImage&gt;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l109" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 109</a> ::SampleFixedImageDomain(</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l110" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 110</a> &nbsp;&nbsp;SpatialSampleContainer&nbsp;&amp;&nbsp;samples)&nbsp;const</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l111" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 111</a> {</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l112" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 112</a> &nbsp;&nbsp;typedef&nbsp;ImageRandomConstIteratorWithIndex&lt;FixedImageType&gt;&nbsp;RandomIterator;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l113" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 113</a> &nbsp;&nbsp;RandomIterator&nbsp;randIter(&nbsp;this-&gt;m_FixedImage,&nbsp;this-&gt;GetFixedImageRegion()&nbsp;);</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l114" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 114</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l115" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 115</a> &nbsp;&nbsp;randIter.SetNumberOfSamples(m_NumberOfSpatialSamples);</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l116" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 116</a> &nbsp;&nbsp;randIter.GoToBegin();</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l117" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 117</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l118" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 118</a> &nbsp;&nbsp;typename&nbsp;SpatialSampleContainer::iterator&nbsp;iter;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l119" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 119</a> &nbsp;&nbsp;typename&nbsp;SpatialSampleContainer::const_iterator&nbsp;end&nbsp;=&nbsp;samples.end();</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l120" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 120</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l121" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 121</a> &nbsp;&nbsp;bool&nbsp;allOutside&nbsp;=&nbsp;true;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l122" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 122</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l123" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 123</a> &nbsp;&nbsp;this-&gt;m_NumberOfPixelsCounted&nbsp;=&nbsp;0;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Number&nbsp;of&nbsp;pixels&nbsp;that&nbsp;map&nbsp;into&nbsp;the</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l124" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 124</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;fixed&nbsp;and&nbsp;moving&nbsp;image&nbsp;mask,&nbsp;if</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l125" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 125</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;specified</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l126" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 126</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;and&nbsp;the&nbsp;resampled&nbsp;fixed&nbsp;grid&nbsp;after</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l127" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 127</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transformation.</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l128" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 128</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l129" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 129</a> &nbsp;&nbsp;//&nbsp;Number&nbsp;of&nbsp;random&nbsp;picks&nbsp;made&nbsp;from&nbsp;the&nbsp;portion&nbsp;of&nbsp;fixed&nbsp;image&nbsp;within&nbsp;the</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l130" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 130</a> &nbsp;&nbsp;//&nbsp;fixed&nbsp;mask</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l131" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 131</a> &nbsp;&nbsp;SizeValueType&nbsp;numberOfFixedImagePixelsVisited&nbsp;=&nbsp;0;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l132" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 132</a> &nbsp;&nbsp;SizeValueType&nbsp;dryRunTolerance&nbsp;=&nbsp;this-&gt;GetFixedImageRegion().GetNumberOfPixels();</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l133" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 133</a> &nbsp;&nbsp;for(&nbsp;iter&nbsp;=&nbsp;samples.begin();&nbsp;iter&nbsp;!=&nbsp;end;&nbsp;++iter&nbsp;)</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l134" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 134</a> &nbsp;&nbsp;&nbsp;&nbsp;{</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l135" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 135</a> &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Get&nbsp;sampled&nbsp;index</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l136" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 136</a> &nbsp;&nbsp;&nbsp;&nbsp;FixedImageIndexType&nbsp;index&nbsp;=&nbsp;randIter.GetIndex();</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l137" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 137</a> &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Get&nbsp;sampled&nbsp;fixed&nbsp;image&nbsp;value</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l138" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 138</a> &nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;*iter&nbsp;).FixedImageValue&nbsp;=&nbsp;randIter.Get();</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l139" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 139</a> &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Translate&nbsp;index&nbsp;to&nbsp;point</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l140" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 140</a> &nbsp;&nbsp;&nbsp;&nbsp;this-&gt;m_FixedImage-&gt;TransformIndexToPhysicalPoint(index,</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l141" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 141</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;*iter&nbsp;).FixedImagePointValue);</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l142" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 142</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l143" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 143</a> &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;If&nbsp;not&nbsp;inside&nbsp;the&nbsp;fixed&nbsp;mask,&nbsp;ignore&nbsp;the&nbsp;point</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l144" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 144</a> &nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;this-&gt;m_FixedImageMask</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l145" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 145</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp;&nbsp;!this-&gt;m_FixedImageMask-&gt;IsInside(&nbsp;(&nbsp;*iter&nbsp;).FixedImagePointValue&nbsp;)&nbsp;)</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l146" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 146</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l147" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 147</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++randIter;&nbsp;//&nbsp;jump&nbsp;to&nbsp;another&nbsp;random&nbsp;position</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l148" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 148</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l149" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 149</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l150" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 150</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l151" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 151</a> &nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;allOutside&nbsp;)</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l152" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 152</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l153" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 153</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++numberOfFixedImagePixelsVisited;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l154" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 154</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;numberOfFixedImagePixelsVisited&nbsp;&gt;&nbsp;dryRunTolerance&nbsp;)</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l155" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 155</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l156" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 156</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;We&nbsp;randomly&nbsp;visited&nbsp;as&nbsp;many&nbsp;points&nbsp;as&nbsp;is&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;fixed&nbsp;image</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l157" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 157</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;region..&nbsp;Too&nbsp;may&nbsp;samples&nbsp;mapped&nbsp;ouside..&nbsp;go&nbsp;change&nbsp;your&nbsp;transform</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l158" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 158</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;itkExceptionMacro(&lt;&lt;&nbsp;"Too&nbsp;many&nbsp;samples&nbsp;mapped&nbsp;outside&nbsp;the&nbsp;moving&nbsp;buffer");</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l159" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 159</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l160" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 160</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l161" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 161</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l162" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 162</a> &nbsp;&nbsp;&nbsp;&nbsp;MovingImagePointType&nbsp;mappedPoint&nbsp;=</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l163" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 163</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this-&gt;m_Transform-&gt;TransformPoint(&nbsp;(&nbsp;*iter&nbsp;).FixedImagePointValue&nbsp;);</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l164" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 164</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l165" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 165</a> &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;If&nbsp;the&nbsp;transformed&nbsp;point&nbsp;after&nbsp;transformation&nbsp;does&nbsp;not&nbsp;lie&nbsp;within&nbsp;the</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l166" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 166</a> &nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;MovingImageMask,&nbsp;skip&nbsp;it.</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l167" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 167</a> &nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;this-&gt;m_MovingImageMask</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l168" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 168</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp;&nbsp;!this-&gt;m_MovingImageMask-&gt;IsInside(mappedPoint)&nbsp;)</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l169" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 169</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l170" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 170</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++randIter;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l171" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 171</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l172" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 172</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l173" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> 173</a> </font></div>

<div style="white-space:pre-wrap;font-family:monospace"><font size="4"><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD#l174" style="color:rgb(153,153,153);text-decoration:initial" target="_blank"> </a></font></div>

</div><br></div></div><div class="gmail_quote">2013/2/26 Seth Gilchrist <span dir="ltr">&lt;<a href="mailto:seth@mech.ubc.ca" target="_blank">seth@mech.ubc.ca</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Hi Lien,<div class="im"><div>Unfortunately I have not used masks when performing registrations, so can't help you with this specific problem.</div><div><br></div><div>I took a look at the git blob for the MattesMutual...Metric and was examining how the decision to keep or reject a give point is handled. If you are setting a mask on both the fixed and moving images, this will change what points are used because a check is done to see if a point is in the fixed mask and if it is in the moving mask after applying the current transform. Could your moving image mask be too restrictive for the early stages of the registration?</div>



<div><br></div><div>You can read the code at:</div><div><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD" target="_blank">http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD</a><br>



</div><div><br></div><div>Starting on line 108, specifically on line 162.</div><div><br></div><div>Cheers,</div><div>Seth</div><div class="gmail_extra"><br clear="all"><div><i>Seth Gilchrist, MASc, PhD Candidate<br>

<span style="font-family:courier new,monospace">+---------------------------------------+</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Orthopaedic and Injury Biomechanics Group<br>



UBC Department of Mechanical Engineering</span><span style="font-family:courier new,monospace"></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">6th Floor-2635 Laurel Street</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">Vancouver, BC V5Z-1M9<br></span><span style="font-family:courier new,monospace">+---------------------------------------+<br><a href="mailto:seth@mech.ubc.ca" target="_blank">seth@mech.ubc.ca</a><br>



Fax <a href="tel:604-675-2576" value="+16046752576" target="_blank">604-675-2576</a></span></i></div><br></div></div></div>
</blockquote></div><br>
</blockquote></div><br></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>