<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<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>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>Hello again,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>I added the line ReinitializeSeed() in the constructor at:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>/code/algorithms/itkMutualInformationImageToImageMetric.txx
<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>I then removed the object file generated in
/MultiRes/MIRegistration/Common directory before recompiling the program, which
seemed to work perfectly since I get a transform matrix now. Thanks for all
your help!<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>--Fong Ming <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabIndex=-1>
</span></font></div>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;font-weight:
bold'>From:</span></font></b><font size=2 face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma'> Karthik Krishnan [<a
href="mailto:Karthik.Krishnan@kitware.com"
title="mailto:Karthik.Krishnan@kitware.com">mailto:Karthik.Krishnan@kitware.com</a>]
<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, December 07, 2004
2:54 PM<br>
<b><span style='font-weight:bold'>To:</span></b> Fong Ming Hooi<br>
<b><span style='font-weight:bold'>Cc:</span></b> <ST1:PERSONNAME u4:st="on"><a
href="mailto:insight-users@itk.org" title="mailto:insight-users@itk.org">insight-users@itk.org</a></ST1:PERSONNAME><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Insight-users]
Problem with MultiResMIRegistration [And the VNL behaviour under Cygwin]</span></font><O:P></O:P><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>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: <U1:P></U1:P><O:P></O:P><o:p></o:p></span></font></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Hello,<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;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><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Output: <U5:P></U5:P><o:p></o:p></span></font><U1:P></U1:P><O:P></O:P></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Parsing
input ... <U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Fixed
image filename:
C:\ITKFiles\ITKAppBin2\MultiResMIRegistration\brainweb165a10f17.mha<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Moving
image filename: C:\ITKFiles\ITKAppBin2\MultiResMIRegistration\brainweb1e5a10f17Rot10Tx15.mha<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Permute
order: [0, 1, 2]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Flip axes:
[0, 0, 0]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Number of
levels: 5<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Fixed
image shrink factors: [4, 4, 1]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Moving
image shrink factors: [8, 8, 1]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Number of
iterations: [2500, 2500, 2500, 2500, 2500]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Learning
rates: [0.0001, 1e-05, 5e-06, 1e-06, 5e-07]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Translation
scale: 320<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Output
filename: t1tot2.mhd<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><U5:P> </U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Preprocess
the images ... <U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Register
the images ... <U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>---
Starting level 0<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> No.
Iterations: 2500 Learning rate: 0.0001<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>---
Starting level 1<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> No.
Iterations: 2500 Learning rate: 1e-05<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>---
Starting level 2<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> No.
Iterations: 2500 Learning rate: 5e-06<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>---
Starting level 3<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> No.
Iterations: 2500 Learning rate: 1e-06<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>---
Starting level 4<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> No.
Iterations: 2500 Learning rate: 5e-07<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Final
parameters: [0, 0, 0, 1, 0, 0, 0]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Overall
transform matrix: <U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>1 0 0<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>0 1 0<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>0 0 1<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><U5:P> </U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Overall
transform offset: <U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>[0, 0, 0]<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Generating
output ...<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;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. <U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Thanks,<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Fong Ming<U5:P></U5:P></span></font><U1:P></U1:P><O:P></O:P><o:p></o:p></p>
<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'><o:p> </o:p></span></font></p>
</div>
</body>
</html>