<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Fong,<br>
<br>
Your problem is related to the minor descripency in VNL behaviour in
Cygwin. I've given a temporary fix below that should make your code
work, before we commit those changes. Thanks for pointing out.<br>
<br>
Just add the line <br>
ReinitializeSeed();<br>
in the constructor MutualInformationImageToImageMetric < , >
::MutualInformationImageToImageMetric()<br>
<br>
Now your code should work fine with Cygwin. If you want to know why,
read the explanation below:<br>
<br>
Basically the family of pseudo-random generators, ie drand48(),
lrand48(), or mrand48(), seem to behave differently under different
operating systems. Strictly speaking, before any calls to these
functions are made, we need to go through initialization entry points,
srand48(), seed48() and lcong48() respectively to initialize the seed.
Now, on most compilers relax this behaviour and supply a default seed.
Cygwin's gcc does not. So all calls to vnl_sample_normal,
vnl_sample_uniform etc failed in Cygwin since they are often called
without seeding in ITK. <br>
<br>
Your MultiresMIRegistration example uses the
MutualInformationImageToImageMetric, which uses a
ImageRandomConstIteratorWithIndex to randomly pick evaluation points.
VNL is used to generate these random numbers. <br>
<br>
A more exact solution would be to replace ReinitializeSeed() with
ReinitializeSeed(vcl_time(0)). This does a quasi-random initialization.
You will now need to include the file "vcl_ctime.h"<br>
<br>
Thanks<br>
Hope this helps<br>
karthik<br>
<br>
<br>
Fong Ming Hooi wrote:
<blockquote cite="mid200412041829.iB4ITLUL000134@eddings.acpub.duke.edu"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Tahoma;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<div class="Section1">
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Hello,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">I’m having some trouble
with the
MultiResMIRegistration program. I’m using the input of
BrainWebT1toT2b.txt and have been getting this corresponding output: </span></font><font
face="Courier New" size="2"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Courier New" size="2"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Output: <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Parsing input ... <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Fixed image filename:
C:\ITKFiles\ITKAppBin2\MultiResMIRegistration\brainweb165a10f17.mha<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Moving image filename:
C:\ITKFiles\ITKAppBin2\MultiResMIRegistration\brainweb1e5a10f17Rot10Tx15.mha<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Permute order: [0, 1, 2]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Flip axes: [0, 0, 0]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Number of levels: 5<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Fixed image shrink
factors: [4, 4, 1]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Moving image shrink
factors: [8, 8, 1]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Number of iterations:
[2500, 2500, 2500, 2500, 2500]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Learning rates: [0.0001,
1e-05, 5e-06, 1e-06, 5e-07]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Translation scale: 320<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Output filename:
t1tot2.mhd<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Preprocess the images
... <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Register the images ... <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">--- Starting level 0<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"> No. Iterations: 2500
Learning rate: 0.0001<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">--- Starting level 1<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"> No. Iterations: 2500
Learning rate: 1e-05<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">--- Starting level 2<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"> No. Iterations: 2500
Learning rate: 5e-06<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">--- Starting level 3<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"> No. Iterations: 2500
Learning rate: 1e-06<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">--- Starting level 4<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"> No. Iterations: 2500
Learning rate: 5e-07<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Final parameters: [0, 0,
0, 1, 0, 0, 0]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Overall transform
matrix: <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">1 0 0<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">0 1 0<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">0 0 1<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Overall transform
offset: <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">[0, 0, 0]<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Generating output ...<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">The output image is
unchanged from the moving image. Does
anyone have any advice as to what I can do to troubleshoot this? I’ve
built the ITK 1.8 framework using cygwin along with FLTK 1.1.4 and Qt
2.3.1 as
well. Also, the Hello World example works fine along with the
Registration examples. <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Thanks,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">Fong Ming<o:p></o:p></span></font></p>
</div>
<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>
<br>
</body>
</html>