[Insight-users] registration consistency

qing xu qingxu8 at hotmail.com
Fri Jul 20 16:09:35 EDT 2007


Hi,

Thank you for all your nice suggestions. My problem does seem related to the 
random number gernerator. According to Luis's suggestions, I fixed the 
initial seed, and the results seems reproducible. (Bad result is always bad, 
good result is always good).  In addition, when I used mean square 
difference before, I had never met such a problem. So I think my problem is 
the initial seed of Mattes mutual information. Thank you again.

Qing


>From: Luis Ibanez <luis.ibanez at kitware.com>
>To: qing xu <qingxu8 at hotmail.com>
>CC: insight-users at itk.org
>Subject: Re: [Insight-users] registration consistency
>Date: Fri, 20 Jul 2007 11:38:07 -0400
>
>
>Hi Qing,
>
>The class
>
>    itkMattesMutualInformationImageToImageMetric
>http://www.itk.org/Insight/Doxygen/html/classitk_1_1MattesMutualInformationImageToImageMetric.html
>
>uses the iterator
>
>    itkImageRandomConstIteratorWithIndex
>http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageRandomConstIteratorWithIndex.html
>
>for generating a random sample of pixels from the Fixed image.
>
>The ImageRandomConstIteratorWithIndex generates the index
>position of the pixels by making calls to the class
>
>    itkMersenneTwisterRandomVariateGenerator
>http://www.itk.org/Insight/Doxygen/html/classitk_1_1Statistics_1_1MersenneTwisterRandomVariateGenerator.html
>
>This random number generator is instantiated as a *Singleton*
>in your program.
>
>
>Upon construction its seed is initialized to the value "121212".
>(See line 541) of itkMersenneTwisterRandomVariateGenerator.h
>in Insight/Code/Common.
>
>A call to its "SetSeed()" method [with no arguments] will use a
>new seed computed from a hash of the current time as it is returned
>by vcl_time() and vcl_clock().
>
>
>--
>
>
>As a user of the registration framework, if you want to guarantee
>reproducible results when using the Mattes MI metric, you will have
>to initialize the seed to a given value (any value, as long as you
>always use the same).
>
>
>The Mattes MI Metric offers the method:
>
>            metric->ReinitializeSeed(int seed)
>
>
>If you call this method with the *SAME* seed value, *BEFORE* you
>call the StartRegistration() or the Update() method of the
>itkImageRegistrationMethod  object, then your registration
>results should be reproducible, regardless of whether you are
>registering other images before.
>
>To be more specific, *INSIDE* your for loop, you must call Reinitialized
>Seed before triggering the registration process for the current dataset.
>
>
>
>    Please note the in its current form, the MersenneTwister random
>    generator *IS NOT THREAD SAFE*. A bug on this issue is pending to
>    be solved.
>
>
>    Please *DO NOT* use the GetInstance() method of the random number
>    generator, as this API is likely to be removed from the toolkit,
>    in order to solve the lack of thread-safety in this random number
>    generator.
>
>
>---
>
>
>Please make sure *also* that you are initializing the Transform inside
>the for loop, so that each image is starting always with the same
>transform. You may be doing this by initializing the Transform,
>or by using an array of InitialParameters for the
>ImageRegistationMethod. In either case, you must reset it at every
>iteration of the for loop.
>
>
>
>       Regards,
>
>
>         Luis
>
>
>
>
>-------------
>qing xu wrote:
>>Hi,
>>
>>Does the same registration code with the same input always give the same 
>>output?
>>
>>I am doing a 3D registration for a dataset consisting of 50 volumes. I put 
>>the registration code in a loop so that the registration can be done one 
>>by one for each volume. However, the reults are much different from what I 
>>got by processing one volume once a time. The only reason I can think of 
>>is that running reigstration for too long would consume too much memory, 
>>so the registration performance is affected. Is that possible?  Does 
>>anybody have the same experience? Thanks in advance.
>>
>>
>>(my metric is mattes mutual information and transform is 
>>VersorRigid3DTransform)
>>
>>
>>Qing
>>
>>_________________________________________________________________
>>http://newlivehotmail.com
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>>

_________________________________________________________________
Don't get caught with egg on your face. Play Chicktionary!  
http://club.live.com/chicktionary.aspx?icid=chick_hotmailtextlink2



More information about the Insight-users mailing list