[Insight-users] ImageRandomNonRepeatingConstIteratorWithIndex repeatability

Julien Malik julien.malik at c-s.fr
Thu Mar 18 12:52:02 EDT 2010


Hi Luis,

Thanks for your quick answer. I will file the bug report.

I currently (at work) don't have access to the CVS repository (network 
port blocked), so if I run an experimental build, it will be from the 
3.16 release. Is it OK for you ?

I'm not yet familiar with running an Experimental build for ITK, but I 
shall succeed with little effort ;).
I saw the wiki page about Dashboard submission and I will strive to do 
this right.

My dev platform is a Debian lenny.

If everything goes well, I'll try to adopt my bug.

Regards,
Julien



Luis Ibanez a écrit :
> Hi Julien,
>
> Thanks for your detailed email.
>
> It looks like you actually found a bug.
>
>
> Please do the following:
>
> File a bug report at
> http://public.kitware.com/Bug/my_view_page.php
>
> and attach to the bug report the code that
> you have for reproducing the problem.
>
>
> If you are interested,
> you can also sign up for the:
>
>                  "Adopt-a-Bug"
>
> program
> http://www.itk.org/Wiki/ITK_Adopt_a_Bug_Program
>
> and you will get  CVS write access to ITK.
> (along with full developer status).
>
>
> In this way you can commit the fix directly.
>
>
> The main concern at this point will be to run a full
> experimental build with your modification in order
> to verify that the proposed fix doesn't break anything
> else.
>
> Are you familiar with the process for running an
> Experimental build ?
>
> What is your development platform ?
> (Windows/Linux/Mac)  ?
>
>
>     Please let us know,
>
>
>           Thanks
>
>
>                Luis
>
>
>
> --------------------------------------------------------------------------------------
> On Thu, Mar 18, 2010 at 10:05 AM, Julien Malik <julien.malik at c-s.fr> wrote:
>   
>> Hello,
>>
>> I'm experiencing a problem with
>> itk::ImageRandomNonRepeatingConstIteratorWithIndex.
>>
>> I need the following feature :
>> [1] iterate on an image by choosing randomly and uniformly a subset of
>> pixels of predefined size.
>> [2] later, i need to iterate on other images (of the same size of course)
>> and iterate on the same set of pixels chosen by the previous walk, in the
>> same order : basically, i need to 'replay' the iterations done in [1]
>>
>> I found itk::ImageRandomNonRepeatingConstIteratorWithIndex to be a very
>> elegant solution to my problem.
>> For [1], no problem : this is exactly what it does (using SetNumberOfSamples
>> to iterate only on a fraction of the image).
>> For [2], using ReinitializeSeed(int) with the same seed as in [1] seems to
>> be the way to go. With that, I only need to save the seed to be able to
>> regenerate the same iterations.
>>
>> Now the problems :
>> * [BUG] when i use
>> itk::ImageRandomNonRepeatingConstIteratorWithIndex::ReinitializeSeed(int)
>> with the same seed in [1] and [2], i don't get the same set of pixels
>> selected.
>> I found that modifying RandomPermutation::ReinitializeSeed(int) from
>> "m_Generator->Initialize(seed);"
>> to
>> "m_Generator->SetSeed(seed);"
>> solves my problem. It seems there is some kind of buffered data in the
>> MersenneTwisterGenerator, and SetSeed calls Initialize + a reload() method
>> that must clear those buffered data.
>>
>> * [Feature Request] the constructor of
>> ImageRandomNonRepeatingConstIteratorWithIndex creates a permutation
>> internally so that the iterator is ready to walk the image. Calling
>> ReinitializeSeed recreate the permutation, involving the generation of a
>> random number for each pixel in the region + a std::sort of all these random
>> numbers.
>> For performance, it would be nice to have an additionnal constructor where
>> the seed can be explicitely specified.
>>
>>
>> Can you confirm the bug ? Or am I doing something wrong ?
>> If needed, I can provide code demonstrating the non-repeatability of the
>> iterator.
>>
>>
>> Regards,
>> Julien
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>     
>
>   

-- 
<www.c-s.fr> 	*Julien MALIK*
Ingénieur d'études - Traitement d'images

*CS Systèmes d'Information - Division Espace & Renseignement*
Département Information Géographique & Image
Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
31506 Toulouse Cedex 05 - FRANCE
Tel : +33 561 17 63 14
Email : julien.malik at c-s.fr



More information about the Insight-users mailing list