[Insight-users] Problem with MultiResMIRegistration [And the VNL behaviour under Cygwin]

Fong Ming Hooi fongming.hooi at duke.edu
Thu Dec 9 12:21:20 EST 2004


Hello again,

 

I added the line ReinitializeSeed() in the constructor at:

/code/algorithms/itkMutualInformationImageToImageMetric.txx 

 

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!

 

--Fong Ming  

 

  _____  

From: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com] 
Sent: Tuesday, December 07, 2004 2:54 PM
To: Fong Ming Hooi
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Problem with MultiResMIRegistration [And the
VNL behaviour under Cygwin]

Hi Fong,

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.

Just add the line 
    ReinitializeSeed();
in the constructor MutualInformationImageToImageMetric < , >
::MutualInformationImageToImageMetric()

Now your code should work fine with Cygwin. If you want to know why, read
the explanation below:

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. 

Your MultiresMIRegistration example uses the
MutualInformationImageToImageMetric, which uses a
ImageRandomConstIteratorWithIndex to randomly pick evaluation points. VNL is
used to generate these random numbers. 

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"

Thanks
Hope this helps
karthik


Fong Ming Hooi wrote: 

Hello,

I'm having some trouble with the MultiResMIRegistration program.  I'm using
the input of BrainWebT1toT2b.txt and have been getting this corresponding
output:  

Output: 

Parsing input ... 

Fixed image filename:
C:\ITKFiles\ITKAppBin2\MultiResMIRegistration\brainweb165a10f17.mha

Moving image filename:
C:\ITKFiles\ITKAppBin2\MultiResMIRegistration\brainweb1e5a10f17Rot10Tx15.mha

Permute order: [0, 1, 2]

Flip axes: [0, 0, 0]

Number of levels: 5

Fixed image shrink factors: [4, 4, 1]

Moving image shrink factors: [8, 8, 1]

Number of iterations: [2500, 2500, 2500, 2500, 2500]

Learning rates: [0.0001, 1e-05, 5e-06, 1e-06, 5e-07]

Translation scale: 320

Output filename: t1tot2.mhd

 

Preprocess the images ... 

Register the images ... 

--- Starting level 0

 No. Iterations: 2500 Learning rate: 0.0001

--- Starting level 1

 No. Iterations: 2500 Learning rate: 1e-05

--- Starting level 2

 No. Iterations: 2500 Learning rate: 5e-06

--- Starting level 3

 No. Iterations: 2500 Learning rate: 1e-06

--- Starting level 4

 No. Iterations: 2500 Learning rate: 5e-07

Final parameters: [0, 0, 0, 1, 0, 0, 0]

Overall transform matrix: 

1 0 0

0 1 0

0 0 1

 

Overall transform offset: 

[0, 0, 0]

Generating output ...

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.   

Thanks,

Fong Ming

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20041209/180f5d0f/attachment.html


More information about the Insight-users mailing list