[Insight-users] Multiresolution ITK Guide example fails on VS2005
- fixed but results are not the expected ones
Axel Martinez Möller
axelus at gmail.com
Fri Dec 23 12:08:13 EST 2005
Hi,
I was just writing the details of the platform, good that Simon saw that!
In the manual it is said "Lets execute this example using the same
multi-modality images as before", and the last couple of images used in the
manual were the 2 images I was trying out, but I should have realized that
there was a rotation in the name of the file... sorry for the confusion.
Well, let's be positive: we know now that the manual is not up to date.
Besides, the multiresolution approach seems to be working fine with the
volumes I was trying to register.
Thanks a lot to both,
axel
-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Friday, December 23, 2005 15:44
To: Simon Warfield
Cc: 'Insight Users'; 'Karthik Krishnan'; Axel Martinez Möller
Subject: Re: [Insight-users] Multiresolution ITK Guide example fails on
VS2005 - fixed but results are not the expected ones
Hi Simon,
Thanks a lot for pointing this out !
It great to have one person with
enough coffee reading at the details :-)
I should have paid more attention to Axel's email.
Thanks
Luis
---------------------
Simon Warfield wrote:
>
> The difference in the results is due to in one case registering to :
>
InsightToolkit-2-4-1/Examples/Data/BrainProtonDensitySliceShifted13x17y.png
> and in the other to :
> InsightToolkit-2-4-1/Examples/Data/BrainProtonDensitySliceR10X13Y17.png
>
> /opt/x86_64/builds/itk/2.4.1/gcc-release/bin/MultiResImageRegistration1
>
/opt/x86_64/src/ITK/InsightToolkit-2-4-1/Examples/Data/BrainProtonDensitySli
ceBorder20.png
>
/opt/x86_64/src/ITK/InsightToolkit-2-4-1/Examples/Data/BrainProtonDensitySli
ceShifted13x17y.png
>
> 0 -0.419408 [11.0796, 11.5431]
> 1 -0.775143 [18.0515, 25.9442]
> 2 -0.621443 [15.2813, 18.4392]
> 3 -1.00688 [7.81465, 15.567]
> 4 -0.733843 [11.7844, 16.0582]
> 5 -1.17593 [15.2929, 17.9792]
> 0 -0.902265 [13.4257, 17.2627]
> 1 -1.21519 [11.6959, 16.2588]
> 2 -1.04207 [12.6029, 16.68]
> 3 -1.21741 [13.4286, 17.2439]
> 4 -1.21605 [12.9899, 17.0041]
> 5 -1.26825 [13.163, 16.8237]
> 0 -1.25692 [13.0716, 16.909]
> 1 -1.29465 [12.9896, 17.0033]
> 2 -1.30922 [13.0513, 16.9934]
> 3 -1.30722 [13.0205, 16.9987]
> 4 -1.30978 [12.9897, 17.0039]
> Result =
> Translation X = 12.9897
> Translation Y = 17.0039
> Iterations = 6
> Metric value = -1.30921
>
> /opt/x86_64/builds/itk/2.4.1/gcc-release/bin/MultiResImageRegistration1
>
/opt/x86_64/src/ITK/InsightToolkit-2-4-1/Examples/Data/BrainProtonDensitySli
ceBorder20.png
>
/opt/x86_64/src/ITK/InsightToolkit-2-4-1/Examples/Data/BrainProtonDensitySli
ceR10X13Y17.png
>
> 0 -0.428819 [12.2116, 10.3381]
> 1 -0.711042 [13.3697, 26.2961]
> 2 -0.649285 [6.58014, 22.0651]
> 3 -0.625776 [10.5504, 21.5783]
> 4 -0.730836 [12.8036, 18.2733]
> 5 -0.840357 [11.0623, 14.6722]
> 0 -0.742633 [13.0232, 15.0656]
> 1 -0.756987 [14.3962, 16.5198]
> 2 -0.734524 [13.6065, 15.9065]
> 3 -0.743746 [13.6888, 16.3996]
> 4 -0.740966 [13.5939, 16.1683]
> 5 -0.743034 [13.5182, 15.9301]
> 0 -0.673919 [13.6369, 15.9691]
> 1 -0.672428 [13.7589, 15.9963]
> 2 -0.670211 [13.8822, 16.0172]
> 3 -0.667172 [13.9833, 15.9437]
> 4 -0.66599 [13.9184, 15.8369]
> 5 -0.669801 [13.961, 15.8826]
> 6 -0.667906 [14.0018, 15.9299]
> 7 -0.66525 [13.9811, 15.9065]
> Result =
> Translation X = 13.9811
> Translation Y = 15.9065
> Iterations = 9
> Metric value = -0.666861
>
>
>
> Luis Ibanez wrote:
>
>>
>> Hi Axel,
>>
>> The values in the Software Guide don't seem to be up to date.
>> This is because they were typed manually from the output of
>> the test in an early version of ITK.
>>
>> We should modify the build process of the guide in order to get
>> these number also automatically from the output of the test,
>> just as we are doing with the images.
>> (Hopefully for the next version of the guide).
>>
>>
>> In the meantime, for your reference, here are some of the output
>> values that I get with today's build of ITK.
>>
>>
>> The Linux results are from zion.kitware which is a
>> Dual processor, with Pentium IV at 2.8Ghz running
>> Linux Debian: uname -a
>> Linux zion 2.4.27-2-686-smp #1 SMP
>> Mon May 16 16:55:31 JST 2005 i686 GNU/Linux
>>
>>
>> The Windows results are from darwinia.kitware which is
>> a Dell D810 laptop with a Pentium R (M) at 1.86GHz
>>
>>
>> ---------------------------------
>>
>> Windows XP, Visual Studio 8, 2005 (Beta)
>> Release mode
>>
>> $ ./Release/MultiResImageRegistration1.exe
>> BrainProtonDensitySliceBorder20.png
>> BrainProtonDensitySliceShifted13x17y.png
>> output.png
>> 0 -0.419408 [11.0796, 11.5431]
>> 1 -0.775143 [18.0515, 25.9442]
>> 2 -0.621443 [15.2813, 18.4392]
>> 3 -1.00688 [7.81465, 15.567]
>> 4 -0.733843 [11.7844, 16.0582]
>> 5 -1.17593 [15.2929, 17.9792]
>> 0 -0.902265 [13.4257, 17.2627]
>> 1 -1.21519 [11.6959, 16.2588]
>> 2 -1.04207 [12.6029, 16.68]
>> 3 -1.21741 [13.4286, 17.2439]
>> 4 -1.21605 [12.9899, 17.0041]
>> 5 -1.26825 [13.163, 16.8237]
>> 0 -1.25692 [13.0716, 16.909]
>> 1 -1.29465 [12.9896, 17.0033]
>> 2 -1.30922 [13.0513, 16.9934]
>> 3 -1.30722 [13.0205, 16.9987]
>> 4 -1.30978 [12.9897, 17.0039]
>> Result =
>> Translation X = 12.9897
>> Translation Y = 17.0039
>> Iterations = 6
>> Metric value = -1.30921
>>
>> ----------------------------------------
>>
>> Linux Debian with GCC 3.3
>> on Release mode (-O3):
>>
>> 0 -0.419408 [11.0796, 11.5431]
>> 1 -0.775143 [18.0515, 25.9442]
>> 2 -0.621443 [15.2813, 18.4392]
>> 3 -1.00688 [7.81465, 15.567]
>> 4 -0.733843 [11.7844, 16.0582]
>> 5 -1.17593 [15.2929, 17.9792]
>> 0 -0.902265 [13.4257, 17.2627]
>> 1 -1.21519 [11.6959, 16.2588]
>> 2 -1.04207 [12.6029, 16.68]
>> 3 -1.21741 [13.4286, 17.2439]
>> 4 -1.21605 [12.9899, 17.0041]
>> 5 -1.26825 [13.163, 16.8237]
>> 0 -1.25692 [13.0716, 16.909]
>> 1 -1.29465 [12.9896, 17.0033]
>> 2 -1.30922 [13.0513, 16.9934]
>> 3 -1.30722 [13.0205, 16.9987]
>> 4 -1.30978 [12.9897, 17.0039]
>> Result =
>> Translation X = 12.9897
>> Translation Y = 17.0039
>> Iterations = 6
>> Metric value = -1.30921
>>
>> ----------------------------------------
>>
>> and here are the results in Linux Debian, with gcc 3.4
>> on normal mode (no optimization, no debug):
>>
>> 0 -0.419408 [11.0796, 11.5431]
>> 1 -0.775143 [18.0515, 25.9442]
>> 2 -0.621443 [15.2813, 18.4392]
>> 3 -1.00688 [7.81465, 15.567]
>> 4 -0.733843 [11.7844, 16.0582]
>> 5 -1.17593 [15.2929, 17.9792]
>> 0 -0.902265 [13.4257, 17.2627]
>> 1 -1.21519 [11.6959, 16.2588]
>> 2 -1.04207 [12.6029, 16.68]
>> 3 -1.21741 [13.4286, 17.2439]
>> 4 -1.21605 [12.9899, 17.0041]
>> 5 -1.26825 [13.163, 16.8237]
>> 0 -1.25692 [13.0716, 16.909]
>> 1 -1.29465 [12.9896, 17.0033]
>> 2 -1.30922 [13.0513, 16.9934]
>> 3 -1.30722 [13.0205, 16.9987]
>> 4 -1.30978 [12.9897, 17.0039]
>> Result =
>> Translation X = 12.9897
>> Translation Y = 17.0039
>> Iterations = 6
>> Metric value = -1.30921
>>
>> ----------------------------------------
>>
>> Here are the results in Linux Debian, with gcc 2.95
>> in Release mode (-O3)
>>
>> 0 -0.419408 [11.0796, 11.5431]
>> 1 -0.775143 [18.0515, 25.9442]
>> 2 -0.621443 [15.2813, 18.4392]
>> 3 -1.00688 [7.81465, 15.567]
>> 4 -0.733843 [11.7844, 16.0582]
>> 5 -1.17593 [15.2929, 17.9792]
>> 0 -0.902265 [13.4257, 17.2627]
>> 1 -1.21519 [11.6959, 16.2588]
>> 2 -1.04207 [12.6029, 16.68]
>> 3 -1.21741 [13.4286, 17.2439]
>> 4 -1.21605 [12.9899, 17.0041]
>> 5 -1.26825 [13.163, 16.8237]
>> 0 -1.25692 [13.0716, 16.909]
>> 1 -1.29465 [12.9896, 17.0033]
>> 2 -1.30922 [13.0513, 16.9934]
>> 3 -1.30722 [13.0205, 16.9987]
>> 4 -1.30978 [12.9897, 17.0039]
>> Result =
>> Translation X = 12.9897
>> Translation Y = 17.0039
>> Iterations = 6
>> Metric value = -1.30921
>>
>> ----------------------------------------
>>
>>
>> Interestingly, these values are different
>> from the ones you get too, so I would
>> guess that your platform is performing
>> float computations slightly different.
>>
>>
>>
>>
>> Please let us know details about your platform.
>>
>>
>>
>>
>> We could run basic numerical tests in order
>> to determine if float point computations are
>> done differently in your particular machine.
>>
>>
>>
>>
>> Thanks
>>
>>
>>
>> Luis
>>
>>
>>
>> -----------------------------
>> Axel Martinez Möller wrote:
>>
>>> Hi Luis,
>>>
>>> I have tried in both modes, obtaining the same results in both (the
>>> results
>>> I wrote in the last mail).
>>>
>>> axel
>>> -----Original Message-----
>>> From: Luis Ibanez [mailto:luis.ibanez at kitware.com] Sent: Friday,
>>> December 23, 2005 12:25
>>> To: Axel Martinez Möller
>>> Cc: 'Karthik Krishnan'; 'Insight Users'
>>> Subject: Re: [Insight-users] Multiresolution ITK Guide example fails on
>>> VS2005 - fixed but results are not the expected ones
>>>
>>>
>>> Hi Axel,
>>>
>>> Are you running the test in Debug mode or in Release mode ?
>>>
>>> The result of numerical computations may differ due to the
>>> way in which the compiler will decide how to manipulate
>>> float numbers.
>>>
>>>
>>>
>>> Please let us know.
>>>
>>>
>>> Luis
>>>
>>>
>>>
>>> ----------------------------
>>> Axel Martinez Möller wrote:
>>>
>>>> Hello,
>>>>
>>>> The code is not crashing anymore.
>>>>
>>>> Karthik: thanks a lot for the correction.
>>>> Luis: thanks a lot for your help and for directing the problem to the
>>>
>>>
>>>
>>> right
>>>
>>>> person.
>>>>
>>>> Only one additional comment. The result I get is not the result
>>>> shown in
>>>> the manual. I get:
>>>>
>>>> Translation X = 13.9811
>>>> Translation Y = 15.9065
>>>> Iterations = 9
>>>> Metric value = -0.666861
>>>>
>>>> In the manual it is said that I should get:
>>>>
>>>> Translation X = 13.1035
>>>> Translation Y = 17.19
>>>>
>>>> Which is much closer to the real displacement (13,17). The number of
>>>> iterations performed is also different than the one indicated in the
>>>
>>>
>>>
>>> manual:
>>>
>>>> 0 -0.428819 [12.2116, 10.3381]
>>>> 1 -0.711042 [13.3697, 26.2961]
>>>> 2 -0.649285 [6.58014, 22.0651]
>>>> 3 -0.625776 [10.5504, 21.5783]
>>>> 4 -0.730836 [12.8036, 18.2733]
>>>> 5 -0.840357 [11.0623, 14.6722]
>>>> 0 -0.742633 [13.0232, 15.0656]
>>>> 1 -0.756987 [14.3962, 16.5198]
>>>> 2 -0.734524 [13.6065, 15.9065]
>>>> 3 -0.743746 [13.6888, 16.3996]
>>>> 4 -0.740966 [13.5939, 16.1683]
>>>> 5 -0.743034 [13.5182, 15.9301]
>>>> 0 -0.673919 [13.6369, 15.9691]
>>>> 1 -0.672428 [13.7589, 15.9963]
>>>> 2 -0.670211 [13.8822, 16.0172]
>>>> 3 -0.667172 [13.9833, 15.9437]
>>>> 4 -0.66599 [13.9184, 15.8369]
>>>> 5 -0.669801 [13.961, 15.8826]
>>>> 6 -0.667906 [14.0018, 15.9299]
>>>> 7 -0.66525 [13.9811, 15.9065]
>>>>
>>>> I do not see how this might be related to the correction of the bug. I
>>>
>>>
>>>
>>> also
>>>
>>>> thought it might be related to the random generator, but since I am
>>>> using
>>>> the same seed given in the example it should not have an
>>>> influence... is
>>>
>>>
>>>
>>> it
>>>
>>>> also something related to VS2005? Luis: do you get the same results?
>>>>
>>>> Sorry that I find so many problems, and many thanks in advance in any
>>>
>>>
>>>
>>> case,
>>>
>>>> axel
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com] Sent:
>>>> Thursday, December 22, 2005 19:16
>>>> To: Axel Martinez Möller
>>>> Cc: 'Luis Ibanez'; 'Insight Users'
>>>> Subject: Re: [Insight-users] Multiresolution ITK Guide example fails on
>>>> VS2005 - fixed
>>>>
>>>> Thanks for the bug report. Its been fixed. Please update your
>>>> repository orthe file below.
>>>>
>>>>
>>>
>>>
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Algorithms/itkMultiResolutionIma
>>>
>>>
>>>
geRegistrationMethod.txx?root=Insight&r1=text&tr1=1.12&r2=text&tr2=1.11&diff
>>>
>>>
>>>> _format=h
>>>>
>>>> VS8 is stricter ( and more correct ) in catching bugs with std::vector
>>>>
>>>> vector::reserve(n) does not change the size of the vector. It only a
>>>> request for allocation of additional memory. vector::size() is
>>>> unchanged by reserve(). (from http://www.sgi.com/tech/stl/Vector.html)
>>>>
>>>> Earlier VS8 caught a few other bugs by checking if an iterator is
>>>> dereferencible prior to derefencing it.
>>>> (http://www.itk.org/Bug/bug.php?op=show&bugid=2485)
>>>>
>>>> Thanks
>>>> -karthik
>>>>
>>>> Axel Martinez Möller wrote:
>>>>
>>>>
>>>>
>>>>> Hi Luis,
>>>>>
>>>>> I am running the program in Debug mode (ITK is also built in Debug
>>>>> mode),
>>>>> and the wrong line is the line:
>>>>>
>>>>> registration->StartRegistration(); (line 492)
>>>>>
>>>>> As I said in the first mail, while debugging I "stepped into" until I
>>>>> localized the problem at line 208 from
>>>>> itkMultiResolutionImageRegistrationMethod.txx:
>>>>>
>>>>> m_FixedImageRegionPyramid[ level ].SetSize( size );
>>>>>
>>>>> This causes an error in the "vector" class from C++, line 753 and
>>>>> consecutive:
>>>>>
>>>>> #if _HAS_ITERATOR_DEBUGGING
>>>>> if (size() <= _Pos)
>>>>> {
>>>>> _DEBUG_ERROR("vector subscript out of range");
>>>>> _SCL_SECURE_OUT_OF_RANGE;
>>>>> }
>>>>>
>>>>> Which explains the "Expression: vector subscript out of range" error I
>>>>> referenced in the first mail.
>>>>>
>>>>> That's all the information I managed to extract, I hope it helps. I
>>>>> do not
>>>>> see a logical explanation if it works for you since I made no
>>>>> changes to
>>>>
>>>>
>>>>
>>>> the
>>>>
>>>>
>>>>> code... I have ITK release 2.4.1, working under VS2005. If you have
>>>>> any
>>>>> other suggestion, I will be happy to try it.
>>>>>
>>>>> Thanks again for the help,
>>>>>
>>>>> axel
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Luis Ibanez [mailto:luis.ibanez at kitware.com] Sent: Thursday,
>>>>> December 22, 2005 16:04
>>>>> To: Axel Martinez Möller
>>>>> Cc: 'Insight Users'
>>>>> Subject: Re: [Insight-users] Multiresolution ITK Guide example
>>>>> fails on
>>>>> VS2005
>>>>>
>>>>>
>>>>> Hi Axel,
>>>>>
>>>>> Thanks for your clarification.
>>>>>
>>>>> The program runs fine for me when I pass three
>>>>> arguments.
>>>>>
>>>>> Something else should be going wrong then...
>>>>>
>>>>>
>>>>>
>>>>> Could you please run this program in Debug mode
>>>>> and let us know in what line it is crashing ?
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>>> Luis
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------
>>>>> Axel Martinez Möller wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi Luis,
>>>>>>
>>>>>> I am using three arguments for the execution, this is the command
>>>>>> line I
>>>>>> use:
>>>>>>
>>>>>> register
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
F:\ITK\InsightToolkit-2.4.1\Examples\Data\BrainProtonDensitySliceBorder20.
>>>>>
>>>>
>>>>
>>>
>>> p
>>>
>>>> n
>>>>
>>>>
>>>>>
>>>>>
>>>>>> g
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
F:\ITK\InsightToolkit-2.4.1\Examples\Data\BrainProtonDensitySliceR10X13Y17
>>>>>
>>>>
>>>>
>>>
>>> .
>>>
>>>> p
>>>>
>>>>
>>>>>
>>>>>
>>>>>> ng C:\axel\registertest\removeme.mhd
>>>>>>
>>>>>> "register" is the name I use for the file, but it has similar
>>>>>> contents as
>>>>>> MultiResImageRegistration1.
>>>>>>
>>>>>> Do you know if anything else could explain the problem?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> axel
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Luis Ibanez [mailto:luis.ibanez at kitware.com] Sent: Thursday,
>>>>>> December 22, 2005 14:43
>>>>>> To: Axel Martinez Möller
>>>>>> Cc: 'Insight Users'
>>>>>> Subject: Re: [Insight-users] Multiresolution ITK Guide example
>>>>>> fails on
>>>>>> VS2005
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hi Axel,
>>>>>>
>>>>>> Thanks for pointing this out.
>>>>>>
>>>>>> The example that you are using requires three arguments
>>>>>> in the command line.
>>>>>>
>>>>>> You are probably setting only two, and due to a bug in
>>>>>> the example, the program is attempting to use the third
>>>>>> argument, and crashes in the process.
>>>>>>
>>>>>>
>>>>>> We just committed a fix in the CVS repository.
>>>>>>
>>>>>>
>>>>>> Please run the program as:
>>>>>>
>>>>>>
>>>>>> MultiResImageRegistration1 fixedImage movingImage outputImage
>>>>>>
>>>>>>
>>>>>> you can also add a forth and fifth arguments in order to
>>>>>> get the checkerboard combination of the fixed and moving
>>>>>> images before and after the registration.
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> Luis
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------
>>>>>> Axel Martinez Möller wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I was wanting to try the MultiResImageRegistration1 example. It
>>>>>>> compiled
>>>>>>> fine with VS2005, but when I executed it using the images
>>>>>>> indicated in
>>>>>>
>>>>>>
>>>>
>>>> the
>>>>
>>>>
>>>>>>> example, it crashed with the error:
>>>>>>>
>>>>>>> ---
>>>>>>> Debug Assertion Failed!
>>>>>>> Program: F:\ITK\Register\Debug\Register.exe
>>>>>>> File: C:\Program Files\Microsoft Visual Studio 8\VC\include\vector
>>>>>>> Line: 756
>>>>>>>
>>>>>>> Expression: vector subscript out of range
>>>>>>> ---
>>>>>>>
>>>>>>> I do not attach the code as it is EXACTLY the one from the
>>>>>>> example. I am
>>>>>>> running it in Debug mode (the same way I compiled ITK), and other
>>>>>>
>>>>>>
>>>>
>>>> examples
>>>>
>>>>
>>>>>>> worked fine.
>>>>>>>
>>>>>>> Debugging, I localized the problem at line 208 from
>>>>>>> itkMultiResolutionImageRegistrationMethod.txx:
>>>>>>> m_FixedImageRegionPyramid[ level ].SetSize( size );
>>>>>>>
>>>>>>> Thank you in advance for any hint,
>>>>>>>
>>>>>>> axel
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Insight-users mailing list
>>>>>>> Insight-users at itk.org
>>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Insight-users mailing list
>>>>> Insight-users at itk.org
>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
>
More information about the Insight-users
mailing list