[Insight-users] Re: randomness in MRIRegistration example
Luis Ibanez
luis.ibanez@kitware.com
Tue, 24 Sep 2002 16:30:40 -0400
Hi Peter,
According to the policy of leaving the choice to
the user, the following additions were made:
1) The itkImageRandomConstIteratorWithIndex
has now a method:
void ReinitializeSeed();
That internally just call vnl_sample_reseed();
2) The itkMutualInformationImageToImageMetric
has a new method:
void ReinitializeSeed();
That also call vnl_sample_reseed();
--
None of these methods is invoked by default during
the setup of the registration process. In that way,
the current code will behave as before. Users who
want to increase the randomness of the metric evaluations
should invoke the ReinitializeSeed() method from the metric
before calling StartRegistration() on the RegistrationMethod
class.
like:
metric->ReinitializeSeed();
registration->SetMetric( metric );
try
{
registration->StartRegistration();
}
catch( itk::ExceptionObject & exp )
{
... etc
}
Users can always just call vnl_sample_reseed() at any
point in their program where they want the sequence of
random numbers not to be repeated.
Just for the record, the method used for measuring the
time is vcl_time() which depending on the platform may
be mapped to ::time, ::ctime or std::time.
The first two have only precision on the order of seconds.
Details on "vcl_time" function can be found at:
Insight/Code/Numeric/vxl/vcl/vcl_time.h
Please let us know if these additions fit your needs,
Thanks
Luis
=======================================================
Stephen R. Aylward wrote:
> Hi,
>
> There is an appeal to leaving the setting of the random seed to the main
> app. This way the user decides if a run/program should produce
> consistent results or not. Also, this way the seed is not set multiple
> times.
>
> Just a vote.
>
> Stephen
>
> P K wrote:
>
>> My one concern about putting a re-seeding step in the
>> RandomIterator constructor would be to what precision
>> the time is calculated. The metric is taking a lot of
>> samples in rapid succession, and it's pretty important
>> to have different seeds for those samples. If the
>> precision is high enough, that would make sense. Otherwise perhaps
>> either include it in the metric
>> constructor or have a SetReseedingOn() method in the
>> metric to re-seed?
>> --Peter
>>
>> __________________________________________________
>> Do you Yahoo!?
>> New DSL Internet Access from SBC & Yahoo!
>> http://sbc.yahoo.com
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users@public.kitware.com
>> http://public.kitware.com/mailman/listinfo/insight-users
>
>
>