[Insight-users] Problem with MultiResMIRegistration [And the VNL
behaviour under Cygwin]
Fong Ming Hooi
fongming.hooi at duke.edu
Tue Dec 7 19:18:19 EST 2004
Hi Vincent and Karthik,
Thanks for your input. I changed the constructor in
MutualInformationImageToImageMetric.txx file to add ReinitializeSeed() to
the constructor and ran MultiResMIRegistration again, but the output is
still the same as the input. I tried both the general one and also the one
with vcl_time as a parameter.
I then tried running itkAlgorithmsTests as well, and 55 and 67 also fails
for me. I added the output from those tests at the bottom in case it might
help. It looks like my problem is similar to yours Vincent, because I ran
the other tests that you had problems with (33, 34, 62, 63) which also
failed.
Is there anything else that I should try looking into to troubleshoot?
Thanks!
--Fong Ming
Outputs from itkAlgorithmsTests
Test 67:
param[4] MI dMI/dparam[4]
ITK test driver caught an ITK exception:
/home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMutualInformationImageToImageMetric.txx:1
55:
itk::ERROR: MutualInformationImageToImageMetric(0xa059880): All the sampled
point mapped to outside of the moving image
Test 55:
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkImageToImageMetrich, line 170
MattesMutualInformationImageToImageMetric (0xa0598d8): returning
FixedImageRegin of ImageRegion (0xa059918)
Dimension: 2
Index: [2, 2]
Size: [96, 96]
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 194
MattesMutualInformationImageToImageMetric (0xa0598d8): FixedImageMin: 31
FixedmageMax: 200
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 196
MattesMutualInformationImageToImageMetric (0xa0598d8): MovingImageMin: 19
MovigImageMax: 200
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 228
MattesMutualInformationImageToImageMetric (0xa0598d8):
FixedImageNormalizedMin:6.43787
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 229
MattesMutualInformationImageToImageMetric (0xa0598d8):
MovingImageNormalizedMin 2.82873
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 230
MattesMutualInformationImageToImageMetric (0xa0598d8): FixedImageBinSize:
3.6731
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 231
MattesMutualInformationImageToImageMetric (0xa0598d8): MovingImageBinSize;
3.9378
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkImageToImageMetrich, line 170
MattesMutualInformationImageToImageMetric (0xa0598d8): returning
FixedImageRegin of ImageRegion (0xa059918)
Dimension: 2
Index: [2, 2]
Size: [96, 96]
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 334
MattesMutualInformationImageToImageMetric (0xa0598d8): Interpolator is not
BSplne
Debug: In /home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformtionImageToImageMetric.
txx, line 361
MattesMutualInformationImageToImageMetric (0xa0598d8): Transform is not
BSplineeformable
param[4] MI MI2 dMI/dparam[4]
ITK test driver caught an ITK exception:
/home/Fong Ming
Hooi/src/ITK1.8/Code/Algorithms/itkMattesMutualInformationImageoImageMetric.
txx:897:
itk::ERROR: MattesMutualInformationImageToImageMetric(0xa0598d8): Too many
samples map outside moving image buffer: 0 / 500
_____
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
_____
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20041207/567e799a/attachment-0001.htm
More information about the Insight-users
mailing list