<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Woo, John wrote:
<blockquote
 cite="mid42FCFDF5F1C63145AF772BC187CBE0C101E3CE7E@UPHSEX08.uphs.upenn.edu"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator"
 content="MS Exchange Server version 5.5.2658.24">
  <title>RE: [Insight-users] ImageRegistration2 problem.</title>
  <p><font size="2">Hi, Luis.</font>
  </p>
  <p><font size="2">I discovered how to run some of the tests using
"ctest -V".</font>
  </p>
  <p><font size="2">In particular, when the ImageRegistration2Test is
run, the output</font>
  <br>
  <font size="2">seems to be ok! (i.e. converges to 13,17)</font>
  </p>
  <p><font size="2">This is quite strange.&nbsp; It suggests that it is not
the code, nor my Cygwin system, but rather my implementation of the
ImageRegistration2 code.</font></p>
  <p><font size="2">I am appending my CMakeLists.txt below.&nbsp; It is
modeled after the "HelloWorld" example.&nbsp; The ImageRegistration2.cxx
file is copied directly from the source directory into my project
directory.</font></p>
  <p><font size="2">Can you see a problem?&nbsp; Thanks again for your help.</font>
  </p>
  <p><font size="2">Sincerely, John.</font>
  </p>
  <p><font size="2">p.s. I will try to run the
itkImageRandomIteratorTest.cxx tomorrow.</font>
  </p>
  <p><font size="2">************************************</font>
  </p>
  <p><font size="2"># This project is designed to be built outside the
Insight source tree.</font>
  <br>
  <font size="2">PROJECT(ImageRegistration2)</font>
  </p>
  <p><font size="2"># Find ITK.</font>
  <br>
  <font size="2">FIND_PACKAGE(ITK)</font>
  <br>
  <font size="2">IF(ITK_FOUND)</font>
  <br>
  <font size="2">&nbsp; INCLUDE(${ITK_USE_FILE})</font>
  <br>
  <font size="2">ELSE(ITK_FOUND)</font>
  <br>
  <font size="2">&nbsp; MESSAGE(FATAL_ERROR</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Cannot build without ITK.&nbsp; Please set
ITK_DIR.")</font>
  <br>
  <font size="2">ENDIF(ITK_FOUND)</font>
  </p>
  <p><font size="2">ADD_EXECUTABLE(ImageRegistration2
ImageRegistration2.cxx )</font>
  </p>
  <p><font size="2">TARGET_LINK_LIBRARIES(ImageRegistration2
ITKNumerics ITKIO)</font>
  </p>
  <p><font size="2">***************************************************</font>
  </p>
  <br>
  <p><font size="2">&nbsp;</font>
  </p>
  <p><font size="2">-----Original Message-----</font>
  <br>
  <font size="2">From: Luis Ibanez</font>
  <br>
  <font size="2">To: Woo, John</font>
  <br>
  <font size="2">Cc: ''<a class="moz-txt-link-abbreviated" href="mailto:insight-users@itk.org">insight-users@itk.org</a>' '</font>
  <br>
  <font size="2">Sent: 5/18/2005 9:42 PM</font>
  <br>
  <font size="2">Subject: Re: [Insight-users] ImageRegistration2
problem.</font>
  </p>
  <br>
  <br>
  <p><font size="2">Hi John,</font>
  </p>
  <br>
  <br>
  <p><font size="2">Thanks for your report.</font>
  </p>
  <br>
  <p><font size="2">You can easily verify if the random number
generator is</font>
  <br>
  <font size="2">working in your system or not.</font>
  </p>
  <br>
  <br>
  <p><font size="2">You simply need to take the file</font>
  </p>
  <br>
  <p><font size="2">&nbsp;&nbsp;&nbsp;&nbsp; Insight/Testing/Code/Common/</font>
  <br>
  <font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itkImageRandomIteratorTest.cxx</font>
  </p>
  <br>
  <p><font size="2">and build it as an independent project.</font>
  </p>
  <br>
  <br>
  <p><font size="2">You run it and.... it will tell you is the random</font>
  <br>
  <font size="2">number generation works or not.</font>
  </p>
  <br>
  <br>
  <p><font size="2">For instructions on how to create an isolated ITK</font>
  <br>
  <font size="2">project, please look at the Tutorial sessions:</font>
  </p>
  <br>
  <p><font size="2">&nbsp;&nbsp;&nbsp; <a href="http://www.itk.org/HTML/Tutorials.htm"
 target="_blank">http://www.itk.org/HTML/Tutorials.htm</a></font>
  </p>
  <p><font size="2">In particular to:</font>
  </p>
  <p><font size="2"><a
 href="http://www.itk.org/CourseWare/Training/GettingStartedI-WebPage/index.htm"
 target="_blank">http://www.itk.org/CourseWare/Training/GettingStartedI-WebPage/index.htm</a></font>
  </p>
  <br>
  <br>
  <br>
  <br>
  <p><font size="2">&nbsp;&nbsp;&nbsp; Regards,</font>
  </p>
  <br>
  <p><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis</font>
  </p>
  <br>
  <br>
  <br>
  <p><font size="2">--------------------</font>
  <br>
  <font size="2">Woo, John wrote:</font>
  </p>
  <p><font size="2">&gt; Luis,</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; Thank you for responding.&nbsp; However, I am still
having problems.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; I downloaded a newer version of itk using cvs.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; Now when I run ImageRegistration2, it seems to go
through 200</font>
  <br>
  <font size="2">iterations,</font>
  <br>
  <font size="2">&gt; each with output:</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;&nbsp; 2.23973e-07&nbsp; [0,0]</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; You are probably correct, that the metric seems
to be computed </font>
  <br>
  <font size="2">&gt; incorrectly.&nbsp; Since the nightly tests are ok,
this suggests that the </font>
  <br>
  <font size="2">&gt; problem is not with the code, but perhaps with my
system.&nbsp; However, I </font>
  <br>
  <font size="2">&gt; have tried this on two different PCs.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; Anyone encouter a similar problem?&nbsp; Perhaps I am
missing a random</font>
  <br>
  <font size="2">number </font>
  <br>
  <font size="2">&gt; generator in Cygwin?</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; - John.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; -----Original Message-----</font>
  <br>
  <font size="2">&gt; From: Luis Ibanez</font>
  <br>
  <font size="2">&gt; To: Woo, John</font>
  <br>
  <font size="2">&gt; Cc: '<a class="moz-txt-link-abbreviated" href="mailto:insight-users@itk.org">insight-users@itk.org</a>'</font>
  <br>
  <font size="2">&gt; Sent: 5/17/2005 8:25 PM</font>
  <br>
  <font size="2">&gt; Subject: Re: [Insight-users] ImageRegistration2
problem.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; Hi John,</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; Cygwin used has a problem for running the random
number</font>
  <br>
  <font size="2">&gt; generator that is used by the Mutual Information
metric.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; This has been fixed now.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; The example:</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageRegistration2</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; is tested nightly</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;</font>
  <br>
  <font size="2"><a
 href="http://www.itk.org/Testing/Dashboard/20050517-0500-Nightly/TestDetail/__"
 target="_blank">http://www.itk.org/Testing/Dashboard/20050517-0500-Nightly/TestDetail/__</a></font>
  <br>
  <font size="2">&gt; Examples_Registration_ImageRegistration2Test.html</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; and it is consistently passing in all platforms.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; The typical output that you should see is in
Cygwing is:</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;</font>
  <br>
  <font size="2"><a
 href="http://www.itk.org/Testing/Sites/dash14.kitware/Win32-cygwin331/20050517"
 target="_blank">http://www.itk.org/Testing/Sites/dash14.kitware/Win32-cygwin331/20050517</a></font>
  <br>
  <font size="2">&gt;</font>
  <br>
  <font size="2">-0500-Nightly/Results/__Examples_Registration_ImageRegistration2Test.htm</font>
  <br>
  <font size="2">&gt; l</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; number of samples = 567</font>
  <br>
  <font size="2">&gt; 0&nbsp;&nbsp; 0.291543&nbsp;&nbsp; [0.105135, 0.090224]</font>
  <br>
  <font size="2">&gt; 1&nbsp;&nbsp; 0.260628&nbsp;&nbsp; [0.161649, 0.157256]</font>
  <br>
  <font size="2">&gt; 2&nbsp;&nbsp; 0.270509&nbsp;&nbsp; [0.320506, 0.209221]</font>
  <br>
  <font size="2">&gt; 3&nbsp;&nbsp; 0.316618&nbsp;&nbsp; [0.422436, 0.283459]</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; ...</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; 198&nbsp;&nbsp; 0.607511&nbsp;&nbsp; [12.9989, 16.8214]</font>
  <br>
  <font size="2">&gt; 199&nbsp;&nbsp; 0.603641&nbsp;&nbsp; [13.0552, 16.9111]</font>
  <br>
  <font size="2">&gt; Result =</font>
  <br>
  <font size="2">&gt;&nbsp;&nbsp; Translation X = 13.0552</font>
  <br>
  <font size="2">&gt;&nbsp;&nbsp; Translation Y = 16.9111</font>
  <br>
  <font size="2">&gt;&nbsp;&nbsp; Iterations&nbsp;&nbsp;&nbsp; = 200</font>
  <br>
  <font size="2">&gt;&nbsp;&nbsp; Metric value&nbsp; = 0.603641</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; You should probably update your version</font>
  <br>
  <font size="2">&gt; of ITK in order to&nbsp; use CVS.</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; Regards,</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;&nbsp;&nbsp;&nbsp;&nbsp; Luis</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;
------------------------------------------------------------------</font>
  <br>
  <font size="2">&gt; Woo, John wrote:</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;&nbsp; &gt; Hi, I'm a new user to ITK.</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; I have succeeded in running
ImageRegistration1 and</font>
  <br>
  <font size="2">ImageRegistration3</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; with their respective Example data.</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; However, I cannot seem to run
ImageRegistration2 (MI Registration)</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; correctly with BrainT1SliceBorder20.png and</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; BrainProtonDensitySliceShifted13x17y.png.</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; It seems to compile ok.&nbsp; However, when
running, it seems to give a</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; Result of</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; Result =</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;&nbsp; Translation X = 0</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;&nbsp; Translation Y = 0</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;&nbsp; Iterations&nbsp;&nbsp;&nbsp; = 200</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;&nbsp; Metric value&nbsp; = 2.5398e-06.</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; It seems that all 200 iterations have
values of</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;&nbsp; 2.5398e-06&nbsp;&nbsp;&nbsp; [0, 0]</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; Am I doing something incorrectly?&nbsp; I am
running ITK on Cygwin on a</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; Windows platform.</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; - John.</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;</font>
  <br>
  <font size="2">------------------------------------------------------------------------</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;</font>
  <br>
  <font size="2">&gt;&nbsp; &gt;
_______________________________________________</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; Insight-users mailing list</font>
  <br>
  <font size="2">&gt;&nbsp; &gt; <a class="moz-txt-link-abbreviated" href="mailto:Insight-users@itk.org">Insight-users@itk.org</a></font>
  <br>
  <font size="2">&gt;&nbsp; &gt; <a
 href="http://www.itk.org/mailman/listinfo/insight-users"
 target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a></font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt;</font>
  <br>
  <font size="2">------------------------------------------------------------------------</font>
  <br>
  <font size="2">&gt; </font>
  <br>
  <font size="2">&gt; _______________________________________________</font>
  <br>
  <font size="2">&gt; Insight-users mailing list</font>
  <br>
  <font size="2">&gt; <a class="moz-txt-link-abbreviated" href="mailto:Insight-users@itk.org">Insight-users@itk.org</a></font>
  <br>
  <font size="2">&gt; <a
 href="http://www.itk.org/mailman/listinfo/insight-users"
 target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a></font>
  </p>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Insight-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Insight-users@itk.org">Insight-users@itk.org</a>
<a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>
  </pre>
</blockquote>
John,<br>
<br>
As Luis mentioned, you should re-seed on cygwin. This is infact done in
the tests explicitly outside the source code. Look at the
Examples/Registration/CMakeLists.txt . ImageRegistration2.cxx is strung
through the test driver through RegistrationExamples.cxx. The very
first line of this file is<br>
<br>
vnl_sample_reseed(8775070);<br>
<br>
That explains the test running fine through ctest&nbsp; not when you use the
same example in your source code.<br>
<br>
This is needed to produce consistent results for nightly testing, <br>
You could add that line to your source code (running on cygwin
explicitly before any calls to the random iterator are made). The
MutualInformationImageToImageMetric uses one. There is an API on the
metrics so you could all them instead as soon as you instantiate one.<br>
See<br>
<br>
MutualInformationImageToImageMetric&lt;TFixedImage,TMovingImage&gt;::ReinitializeSeed()<br>
<br>
The reason why this isn't added to the constructor is to produce
consistent nightly results.<br>
<br>
Thanks<br>
Regards<br>
Karthik<br>
</body>
</html>