<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=482401714-19052005>Karthik,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=482401714-19052005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=482401714-19052005>Thank
you (and Luis) very much.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=482401714-19052005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=482401714-19052005>I have
it working now.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=482401714-19052005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=482401714-19052005>Sincerely,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=482401714-19052005>John.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=482401714-19052005></SPAN></FONT> </DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Karthik Krishnan
[mailto:Karthik.Krishnan@kitware.com]<BR><B>Sent:</B> Thursday, May 19, 2005
9:58 AM<BR><B>To:</B> Woo, John<BR><B>Cc:</B> '''insight-users@itk.org' '
'<BR><B>Subject:</B> Re: [Insight-users] ImageRegistration2
problem.<BR><BR></FONT></DIV>Woo, John wrote:
<BLOCKQUOTE
cite=mid42FCFDF5F1C63145AF772BC187CBE0C101E3CE7E@UPHSEX08.uphs.upenn.edu
type="cite">
<META content="MS Exchange Server version 5.5.2658.24" name=Generator>
<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. 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. It is modeled
after the "HelloWorld" example. 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? 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>
INCLUDE(${ITK_USE_FILE})</FONT> <BR><FONT size=2>ELSE(ITK_FOUND)</FONT>
<BR><FONT size=2> MESSAGE(FATAL_ERROR</FONT> <BR><FONT
size=2> "Cannot build
without ITK. 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></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> Insight/Testing/Code/Common/</FONT>
<BR><FONT
size=2>
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> <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> Regards,</FONT> </P><BR>
<P><FONT size=2> Luis</FONT>
</P><BR><BR><BR>
<P><FONT size=2>--------------------</FONT> <BR><FONT size=2>Woo, John
wrote:</FONT> </P>
<P><FONT size=2>> Luis,</FONT> <BR><FONT size=2>> </FONT><BR><FONT
size=2>> Thank you for responding. However, I am still having
problems.</FONT> <BR><FONT size=2>> </FONT><BR><FONT size=2>> I
downloaded a newer version of itk using cvs.</FONT> <BR><FONT size=2>>
</FONT><BR><FONT size=2>> Now when I run ImageRegistration2, it seems to
go through 200</FONT> <BR><FONT size=2>iterations,</FONT> <BR><FONT
size=2>> each with output:</FONT> <BR><FONT size=2>> </FONT><BR><FONT
size=2>> 2.23973e-07 [0,0]</FONT> <BR><FONT size=2>>
</FONT><BR><FONT size=2>> You are probably correct, that the metric seems
to be computed </FONT><BR><FONT size=2>> incorrectly. Since the
nightly tests are ok, this suggests that the </FONT><BR><FONT size=2>>
problem is not with the code, but perhaps with my system. However, I
</FONT><BR><FONT size=2>> have tried this on two different PCs.</FONT>
<BR><FONT size=2>> </FONT><BR><FONT size=2>> Anyone encouter a similar
problem? Perhaps I am missing a random</FONT> <BR><FONT size=2>number
</FONT><BR><FONT size=2>> generator in Cygwin?</FONT> <BR><FONT
size=2>> </FONT><BR><FONT size=2>> - John.</FONT> <BR><FONT
size=2>> </FONT><BR><FONT size=2>> </FONT><BR><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/17/2005 8:25 PM</FONT> <BR><FONT size=2>>
Subject: Re: [Insight-users] ImageRegistration2 problem.</FONT> <BR><FONT
size=2>> </FONT><BR><FONT size=2>> </FONT><BR><FONT size=2>> Hi
John,</FONT> <BR><FONT size=2>> </FONT><BR><FONT size=2>>
</FONT><BR><FONT size=2>> Cygwin used has a problem for running the
random number</FONT> <BR><FONT size=2>> generator that is used by the
Mutual Information metric.</FONT> <BR><FONT size=2>> </FONT><BR><FONT
size=2>> This has been fixed now.</FONT> <BR><FONT size=2>>
</FONT><BR><FONT size=2>> </FONT><BR><FONT size=2>> The
example:</FONT> <BR><FONT size=2>> </FONT><BR><FONT
size=2>>
ImageRegistration2</FONT> <BR><FONT size=2>> </FONT><BR><FONT size=2>>
is tested nightly</FONT> <BR><FONT size=2>> </FONT><BR><FONT
size=2>></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>>
Examples_Registration_ImageRegistration2Test.html</FONT> <BR><FONT
size=2>> </FONT><BR><FONT size=2>> and it is consistently passing in
all platforms.</FONT> <BR><FONT size=2>> </FONT><BR><FONT size=2>> The
typical output that you should see is in Cygwing is:</FONT> <BR><FONT
size=2>> </FONT><BR><FONT size=2>></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>></FONT> <BR><FONT
size=2>-0500-Nightly/Results/__Examples_Registration_ImageRegistration2Test.htm</FONT>
<BR><FONT size=2>> l</FONT> <BR><FONT size=2>> </FONT><BR><FONT
size=2>> </FONT><BR><FONT size=2>> </FONT><BR><FONT size=2>> number
of samples = 567</FONT> <BR><FONT size=2>> 0
0.291543 [0.105135, 0.090224]</FONT> <BR><FONT size=2>>
1 0.260628 [0.161649, 0.157256]</FONT> <BR><FONT
size=2>> 2 0.270509 [0.320506, 0.209221]</FONT>
<BR><FONT size=2>> 3 0.316618 [0.422436,
0.283459]</FONT> <BR><FONT size=2>> </FONT><BR><FONT size=2>>
...</FONT> <BR><FONT size=2>> </FONT><BR><FONT size=2>>
198 0.607511 [12.9989, 16.8214]</FONT> <BR><FONT
size=2>> 199 0.603641 [13.0552, 16.9111]</FONT>
<BR><FONT size=2>> Result =</FONT> <BR><FONT size=2>>
Translation X = 13.0552</FONT> <BR><FONT size=2>> Translation
Y = 16.9111</FONT> <BR><FONT size=2>>
Iterations = 200</FONT> <BR><FONT size=2>>
Metric value = 0.603641</FONT> <BR><FONT size=2>> </FONT><BR><FONT
size=2>> </FONT><BR><FONT size=2>> </FONT><BR><FONT size=2>>
</FONT><BR><FONT size=2>> </FONT><BR><FONT size=2>> You should
probably update your version</FONT> <BR><FONT size=2>> of ITK in order
to use CVS.</FONT> <BR><FONT size=2>> </FONT><BR><FONT size=2>>
</FONT><BR><FONT size=2>> </FONT><BR><FONT size=2>> Regards,</FONT>
<BR><FONT size=2>> </FONT><BR><FONT size=2>> </FONT><BR><FONT
size=2>> </FONT><BR><FONT size=2>> Luis</FONT>
<BR><FONT size=2>> </FONT><BR><FONT size=2>> </FONT><BR><FONT
size=2>> </FONT><BR><FONT size=2>>
------------------------------------------------------------------</FONT>
<BR><FONT size=2>> Woo, John wrote:</FONT> <BR><FONT size=2>>
</FONT><BR><FONT size=2>> > Hi, I'm a new user to ITK.</FONT>
<BR><FONT size=2>> ></FONT> <BR><FONT size=2>> > I
have succeeded in running ImageRegistration1 and</FONT> <BR><FONT
size=2>ImageRegistration3</FONT> <BR><FONT size=2>> > with their
respective Example data.</FONT> <BR><FONT size=2>> ></FONT>
<BR><FONT size=2>> > However, I cannot seem to run
ImageRegistration2 (MI Registration)</FONT> <BR><FONT size=2>> >
correctly with BrainT1SliceBorder20.png and</FONT> <BR><FONT
size=2>> > BrainProtonDensitySliceShifted13x17y.png.</FONT>
<BR><FONT size=2>> ></FONT> <BR><FONT size=2>> > It
seems to compile ok. However, when running, it seems to give a</FONT>
<BR><FONT size=2>> > Result of</FONT> <BR><FONT
size=2>> ></FONT> <BR><FONT size=2>> > Result
=</FONT> <BR><FONT size=2>> > Translation X = 0</FONT>
<BR><FONT size=2>> > Translation Y = 0</FONT> <BR><FONT
size=2>> > Iterations = 200</FONT>
<BR><FONT size=2>> > Metric value =
2.5398e-06.</FONT> <BR><FONT size=2>> ></FONT> <BR><FONT
size=2>> > It seems that all 200 iterations have values
of</FONT> <BR><FONT size=2>> >
2.5398e-06 [0, 0]</FONT> <BR><FONT size=2>>
></FONT> <BR><FONT size=2>> > Am I doing something
incorrectly? I am running ITK on Cygwin on a</FONT> <BR><FONT
size=2>> > Windows platform.</FONT> <BR><FONT size=2>>
></FONT> <BR><FONT size=2>> > - John.</FONT> <BR><FONT
size=2>> ></FONT> <BR><FONT size=2>> ></FONT>
<BR><FONT size=2>> ></FONT> <BR><FONT size=2>></FONT>
<BR><FONT
size=2>------------------------------------------------------------------------</FONT>
<BR><FONT size=2>> ></FONT> <BR><FONT size=2>> >
_______________________________________________</FONT> <BR><FONT
size=2>> > Insight-users mailing list</FONT> <BR><FONT
size=2>> > <A class=moz-txt-link-abbreviated
href="mailto:Insight-users@itk.org">Insight-users@itk.org</A></FONT>
<BR><FONT size=2>> > <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>> </FONT><BR><FONT size=2>> </FONT><BR><FONT
size=2>> </FONT><BR><FONT size=2>></FONT> <BR><FONT
size=2>------------------------------------------------------------------------</FONT>
<BR><FONT size=2>> </FONT><BR><FONT size=2>>
_______________________________________________</FONT> <BR><FONT size=2>>
Insight-users mailing list</FONT> <BR><FONT size=2>> <A
class=moz-txt-link-abbreviated
href="mailto:Insight-users@itk.org">Insight-users@itk.org</A></FONT>
<BR><FONT size=2>> <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 width="90%" SIZE=4>
_______________________________________________
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 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<TFixedImage,TMovingImage>::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></BLOCKQUOTE></BODY></HTML>