[vtkusers] Python Bindings & GIL (Blocking issues)

Lic. José M. Rodriguez Bacallao jmrbcu at gmail.com
Wed Feb 3 13:13:36 EST 2010


here I send the patch thanks to Charl Botha

On 2/2/10, Christopher Denter <dennda at the-space-station.com> wrote:
> Can you provide the patch or a link to it?
>
> On 2. Feb, 2010, at 6:15 PM, Lic. José M. Rodriguez Bacallao wrote:
>
>> well, my problems are all from the past, right now I have patched the
>> vtk with the patch from DRE and everything work ok!!!
>>
>> On 1/22/10, Lic. José M. Rodriguez Bacallao <jmrbcu at gmail.com> wrote:
>>> could you send me a code snippet that you used to achieve the load,
>>> because I am trying to load an XA image of 5.5 Mb and my user
>>> interface is freezing?
>>>
>>> PS: I am not using a progress bar and I need to keep my user interface
>>> responsive.
>>>
>>> On Thu, Jan 21, 2010 at 4:29 PM, Christopher Denter
>>> <dennda at the-space-station.com> wrote:
>>>> Yes.
>>>>
>>>> I just tested it. In my case it is sufficient to sleep 0.001 seconds to
>>>> keep the UI responsive. I got 433 callbacks, so it is 0.433 seconds
>>>> slower. I got no problem trading that for a functioning progress bar.
>>>>
>>>> On 21. Jan, 2010, at 10:10 PM, Lic. José M. Rodriguez Bacallao wrote:
>>>>
>>>>> yes, I did the same with the callback to ProgressEvents. If U sleep
>>>>> the thread, the load of the dataset will be (number_of_callback_fired
>>>>> * time_thread_is_sleeping) slower, isn't it?
>>>>>
>>>>> PS: sorry, I will press the <reply all> next time.
>>>>>
>>>>> On 1/21/10, Christopher Denter <dennda at the-space-station.com> wrote:
>>>>>> Hello,
>>>>>>
>>>>>> in my particular case I have been able to work around the problem to
>>>>>> some
>>>>>> degree by using callbacks for ProgressEvents (I need those anyway for
>>>>>> a
>>>>>> progress bar) and a bad hack.
>>>>>> The bad hack is now that each time the callback is called, I make the
>>>>>> thread
>>>>>> sleep for 0.05 seconds so that the main thread has some time to catch
>>>>>> up.
>>>>>>
>>>>>> Of course this is not a proper solution but just a bad hack. It helps
>>>>>> animate a progress bar though.
>>>>>>
>>>>>> Jose, please make sure to hit 'Reply All' to also send a mail to the
>>>>>> VTK
>>>>>> mailing list.
>>>>>>
>>>>>> HTH,
>>>>>>      Christopher
>>>>>>
>>>>>> On 21. Jan, 2010, at 4:11 PM, Lic. José M. Rodriguez Bacallao wrote:
>>>>>>
>>>>>>> I have the same issue, with vtk and PyQt threads or python threads,
>>>>>>> any suggestions?
>>>>>>>
>>>>>>> On 1/20/10, Christopher Denter <dennda at the-space-station.com> wrote:
>>>>>>>> Hello.
>>>>>>>>
>>>>>>>> In my application I want to load a large dataset in a different
>>>>>>>> thread
>>>>>>>> to
>>>>>>>> keep the UI responsive. However, as soon as the VTK code is
>>>>>>>> executed,
>>>>>>>> only
>>>>>>>> that one thread runs and my UI freezes for the duration of the
>>>>>>>> loading
>>>>>>>> operation. Do the VTK bindings block the python interpreter?
>>>>>>>> VTK_NO_PYTHON_THREADS is disabled. I'm running Python 2.6.4 on OSX
>>>>>>>> 10.6.
>>>>>>>>
>>>>>>>> (To be precise, all the thread does currently - for testing reasons
>>>>>>>> -
>>>>>>>> is
>>>>>>>> create a vtkDICOMImageReader and read a dataset. If I replace all
>>>>>>>> VTK
>>>>>>>> related stuff with a simple time.sleep(10), the UI remains
>>>>>>>> responsive,
>>>>>>>> hence
>>>>>>>> my conclusion.)
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>    Christopher
>>>>>>>> _______________________________________________
>>>>>>>> Powered by www.kitware.com
>>>>>>>>
>>>>>>>> Visit other Kitware open-source projects at
>>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>>
>>>>>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>>>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>>>
>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Lic. José M. Rodriguez Bacallao
>>>>>>> Centro de Biofisica Medica
>>>>>>> -----------------------------------------------------------------
>>>>>>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos
>>>>>>> lo
>>>>>>> mismo.
>>>>>>>
>>>>>>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>>>>>>> por profesionales
>>>>>>> -----------------------------------------------------------------
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Lic. José M. Rodriguez Bacallao
>>>>> Centro de Biofisica Medica
>>>>> -----------------------------------------------------------------
>>>>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
>>>>> mismo.
>>>>>
>>>>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>>>>> por profesionales
>>>>> -----------------------------------------------------------------
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Lic. José M. Rodriguez Bacallao
>>> Centro de Biofisica Medica
>>> -----------------------------------------------------------------
>>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
>>> mismo.
>>>
>>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>>> por profesionales
>>> -----------------------------------------------------------------
>>>
>>
>>
>> --
>> Lic. José M. Rodriguez Bacallao
>> Centro de Biofisica Medica
>> -----------------------------------------------------------------
>> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
>> mismo.
>>
>> Recuerda: El arca de Noe fue construida por aficionados, el titanic
>> por profesionales
>> -----------------------------------------------------------------
>
>


-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-----------------------------------------------------------------
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-----------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyvtk_tryexcept_and_pyexceptions.diff
Type: text/x-patch
Size: 8884 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100203/268a4857/attachment.bin>


More information about the vtkusers mailing list