[vtkusers] [FORGED] Re: Qt-based VTK app shows black image content if VTK is linked statically

Sophonet vtk12af6bc42 at kant.sophonet.de
Thu Aug 11 07:15:36 EDT 2016


Okay, I found the problem for my application myself. It seems that the 
scenario I have mentioned below in my very first e-mail (application 
depends on a number of dlls, each dll statically links VTK) does not 
work (as it is the case with many other libraries). The reason is that 
static variables defined in VTK are replicated in each dll, making them 
inconsistent.

Still, as mentioned below, I could reproduce the crash of the VTK 
FourPaneViewer once, which might be related to a different problem.

Thanks,

      Sophonet

Am 2016-08-09 21:24, schrieb Sophonet:
> Indeed, I can reproduce this problem with VTK 7.0.0 (statically 
> linked).
> 
> Is there any plan going forward, e.g. Dženan, have you planned on
> discussing with colleagues how to tackle this problem, or would you
> like Enzo or myself to file some kind of bug report? (If so, where is
> the best place)?
> 
> Thanks,
> 
> 
>      Sophonet
> 
> Am 2016-08-09 20:25, schrieb Dženan Zukić:
>> Hi Enzo,
>> 
>> I have a statically built VTK (6.3.0 and a recent git version), and
>> compiling that example produces an executable [7] which loads an
>> image and reslice views are shown. The example does not work totally
>> correctly - 2D and 3D views are not synchronized, fiddling with
>> options on the right can make reslice views disappear or crash the
>> program, blue slice is not initialized in the correct position etc.
>> Here is a screenshot:
>> 
>> Regards,
>> Dženan
>> 
>> On Tue, Aug 9, 2016 at 1:08 PM, Enzo Matsumiya
>> <enzo.matsumiya at gmail.com> wrote:
>> 
>>> Dženan,
>>> 
>>> I’m pretty sure I was using the correct libraries (VTK 7.0 static
>>> with Qt 5.7).
>>> 
>>> My current test case is heavily based on this VTK example, so I
>>> believe it will reproduce this buggy
>>> 
>> behaviour:http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/GUI/Qt/FourPaneViewer/QtVTKRenderWindows.cxx
>>> [1]
>>> 
>>> I’m sorry I can’t look deeper into this issue, but I’m up to
>>> testing new future fixes and also sending additional information if
>>> necessary.
>>> 
>>> Thanks!
>>> 
>>> On Aug 9, 2016, at 13:34, Sophonet <vtk12af6bc42 at kant.sophonet.de>
>>> wrote:
>>> 
>>> Hi all,
>>> 
>>> regarding this topic: In the meantime, I have found out that indeed,
>>> when using static VTK libraries, the image-related components (e.g.
>>> vtkImageResliceMapper) always retrieve invalid bounds / whole data
>>> extent from the input image data (0,-1,0,-1,0,-1) - and the
>>> corresponding content is black. When using dynamic VTK libraries,
>>> the information is correct, and the resliced image is shown as
>>> expected.
>>> 
>>> The only function which (indirectly) sets invalid image dimensions
>>> is PrepareForNewData(), which is called from vtkImageResliceMapper's
>>> Update().
>>> 
>>> Ideally, I would like to continue debugging and find out why, in
>>> case of static VTK libraries, the information is not correctly
>>> overwritten later in my case, but would appreciate any help, since
>>> the processing / updating mechanism during a Render() call are not
>>> clear to me.
>>> 
>>> Any hints or ideas?
>>> 
>>> Thanks,
>>> 
>>>    sophonet
>>> 
>>> Hi,
>>> great that this is beine picked up. No, absolutely no changes
>>> besides
>>> switching from dynamic to static. The revision was exactly the same,
>>> the CMake flags as well.
>>> Again, some content (vtkPolyData) was shown, but other content (in
>>> my
>>> case results of vtkImageReslice) was not. If you guys have already a
>>> clue about what might be the cause, please go ahead, otherwise, I
>>> will
>>> try to set up a minimal example in the next days/weeks, and if I
>>> find
>>> something, I will file a merge request.
>>> Cheers,
>>>     Sophonet
>>> Hi Sophonet and Enzo,
>>> is it possible you made other changes besides switching VTK from
>>> DLLs
>>> to static libraries? Perhaps your application was using a different
>>> version of VTK DLLs than you thought etc.
>>> If that is not the case, can you point to an example which exhibits
>>> the problem?
>>> Regards,
>>> Dženan
>>> On Wed, Aug 3, 2016 at 2:24 PM, Gib Bogle <g.bogle at auckland.ac.nz>
>>> wrote:
>>> Statically linked VTK 5.10 works fine with Qt.
>>> ________________________________________
>>> From: vtkusers [vtkusers-bounces at vtk.org] on behalf of Enzo
>>> Matsumiya [enzo.matsumiya at gmail.com]
>>> Sent: Thursday, 4 August 2016 6:21 a.m.
>>> To: Constantinescu Mihai via vtkusers
>>> Subject: [FORGED] Re: [vtkusers] Qt-based VTK app shows black image
>>> content if VTK is   linked statically
>>> I can confirm that some issues occur when using VTK static as well
>>> (VTK stable 7.0.0).
>>> I could not look further into the issue, but my application crashed
>>> instead of just black window, and I just rolled back to dynamic
>>> build.
>>> Appreciate any details on this.
>>> Thanks,
>>> Enzo
>>> On Aug 3, 2016, at 15:05, Sophonet
>>> <vtk12af6bc42 at kant.sophonet.de> wrote:
>>> Hi list,
>>> recently, I have been working on a Qt application (using VTK
>>> functionality in the main .exe and a bunch of underlying DLLs).
>>> If VTK is built dynamically, the application behaves as expected.
>>> However, if VTK is built statically (and - obviously - the
>>> application and underlying DLLs are then built using the static
>>> libraries of VTK), some content (vtkImageSlice) is missing in the
>>> render window, i.e. does not appear at all. Other parts (e.g.
>>> vtkPolyData) are shown correctly.
>>> Anyone knows how to fix this? If possible, I would like to do
>>> static linking of VTK.
>>> Thanks,
>>>     sophonet
>>> _______________________________________________



More information about the vtkusers mailing list