<div dir="ltr">Hi Lien,<div style>Unfortunately I have not used masks when performing registrations, so can't help you with this specific problem.</div><div style><br></div><div style>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 style><br></div><div style>You can read the code at:</div><div style><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD">http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx;h=1244e5c0be768696cf042f6f39739f4b2bdcbba6;hb=HEAD</a><br>
</div><div style><br></div><div style>Starting on line 108, specifically on line 162.</div><div style><br></div><div style>Cheers,</div><div style>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 604-675-2576</span></i><br></div>
<br><br><div class="gmail_quote">On Tue, Feb 26, 2013 at 11:49 AM, lien lee <span dir="ltr"><<a href="mailto:lienlee@gmail.com" target="_blank">lienlee@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Hi Seth,
<div><br>
</div>
<div>Thank you for the comment. </div>
<div><br>
</div>
<div>I double-checked my code, and found that before calling MattesMutualInformationImageToImageMetric::Initialize(), I called MattesMutualInformationImageToImageMetric::ReinitializeSeed(76926294). After debugging into the code, I am sure that ImageToImageMetric::SampleFixedImageRegion()
was called. But, still, it is observed that the samples were different for different runs. Do I miss anything else?</div>
<div><br>
</div>
<div>With the same code, if I do NOT apply <span style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">ImageMaskSpatialObject for both the fixed and moving images, I do see consistent result. However, it
was no good than the better ones I got by chance with </span><span style="color:rgb(34,34,34);font-size:14px;font-family:arial,sans-serif">ImageMaskSpatialObject applied.</span></div><div><div class="h5">
<div><br>
</div>
<div><br>
<br>
<div class="gmail_quote">2013/2/26 Seth Gilchrist <span dir="ltr"><<a href="mailto:seth@mech.ubc.ca" target="_blank">seth@mech.ubc.ca</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>Hi Lien,</div>
<div>You may be seeing the effects of the sampling of the registration region to create the mattes histogram.</div>
<div><br>
</div>
<div>If you check the doxygen for the MattesMutualInformationImageToImageMetric and expand the section "public member functions inherited from itk::ImageToImageMetric" you will find a few functions that concern sampling (SetUseAllPixels, SetUseFixedImageIndexes,
SetUseSequentialSampling). Importantly, one of these is called ReinitializeSeed(). Take a look at the documentation for that function and it may help answer your question. Briefly:</div>
<div><br>
</div>
<div>"<span style="line-height:19px;font-size:12px;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif">By nature, this metric is not deterministic, since at each run it may select a different set of pixels. By initializing the random number generator
seed to the same value you can restore determinism."</span></div>
<div><span style="line-height:19px;font-size:12px;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif"><br>
</span></div>
<div><span style="line-height:19px;font-size:12px;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif">Hope this helps,</span></div>
<div><span style="line-height:19px;font-size:12px;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif">Seth</span></div>
</div>
</blockquote>
</div>
<br>
</div>
</div></div></div>
</blockquote></div><br></div></div>