From almog.yalin at gmail.com Wed Jun 1 02:41:50 2016 From: almog.yalin at gmail.com (almog yalin) Date: Wed, 1 Jun 2016 09:41:50 +0300 Subject: [vtkusers] Dump 3d voronoi cells into files Message-ID: I've written a script that generates a 3d voronoi tessellation and visualises it with python vtk. However, when I try to dump a single voronoi cell to a file, paraview does not load the files. Link to code http://pastebin.com/cafAPpjj Thanks in advance, - Almog -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjchen.work at gmail.com Thu Jun 2 12:30:42 2016 From: hjchen.work at gmail.com (hchen) Date: Thu, 2 Jun 2016 09:30:42 -0700 (MST) Subject: [vtkusers] line is visible when camera focal spot is moved behind the slice the line is drawn? Message-ID: <1464885042311-5738544.post@n5.nabble.com> Hello, Sorry I could not come up with a better subject line..... I am drawing a 2D slice from a 3D volume, using vtkImageResliceMapper and vtkImageSlice. I scroll through slices by changing camera focal spot. Say, on a slice located at z=0, I draw a line using vtkPolyData, vtkPolyDataMapper and vtkActor, everything looks just fine. Now, if I move the focal spot closer to camera (eg. z=5), the correct slice will show, and the line does not, which is good. But, if I move the focal spot further away from the camera (eg, z=-5), the line would persist. The line would persist for all focal spot that is behind the slice on which the line is drawn. Can anyone help me understand why and if there is an easy way to have the line show only when the camera focal spot is on the slice where the line is drawn? Thanks! Chen -- View this message in context: http://vtk.1045678.n5.nabble.com/line-is-visible-when-camera-focal-spot-is-moved-behind-the-slice-the-line-is-drawn-tp5738544.html Sent from the VTK - Users mailing list archive at Nabble.com. From martin.affolter at ntb.ch Fri Jun 3 04:30:24 2016 From: martin.affolter at ntb.ch (Affolter Martin) Date: Fri, 3 Jun 2016 08:30:24 +0000 Subject: [vtkusers] VTK and MFC access violation Message-ID: Hi vtk-users, We have an MFC application which contains a vtk-window (vtk 6.1). The application runs fine in different versions (32-/64-bit) on Windows 7, 8 and 10. However, there is an access violation with Windows 10 using a 64-bit Unicode build when the tab, in which the window is situated, is activated. This is the code from vtkWin32OpenGLRenderWindow::SetSize(int x, int y) that we manage to debug into before the access violation occurs somewhere in the system-dlls: ... else if (this->Mapped) { if (!resizing) { resizing = 1; if (this->ParentId) { SetWindowExtEx(this->DeviceContext,x,y,NULL); SetViewportExtEx(this->DeviceContext,x,y,NULL); SetWindowPos(this->WindowId,HWND_TOP,0,0, x, y, SWP_NOMOVE | SWP_NOZORDER); } ... The call-stack is attached as a .png I know, this is a vague description. Nevertheless... any hints or guesses what could be going wrong here? Thanks. Martin Martin Affolter MSc FHO in Engineering Wissenschaftlicher Mitarbeiter ___________________________________________ NTB Interstaatliche Hochschule f?r Technik Buchs Institut f?r Ingenieurinformatik Sch?nauweg 4 CH-9013 St. Gallen Tel: +41 81 755 32 49 Web: http://www.ntb.ch -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: callstack.png Type: image/png Size: 16534 bytes Desc: callstack.png URL: From saeedbakhshmand at gmail.com Fri Jun 3 11:30:42 2016 From: saeedbakhshmand at gmail.com (Saeed Mahdizadeh Bakhshmand) Date: Fri, 3 Jun 2016 11:30:42 -0400 Subject: [vtkusers] Extract certain set of points from a vtkcellarray Message-ID: Hello, Is there any trick to obtain a set of points from a vtkCellArray quickly?(in a real time fashion without using GetNextCell that loads all of the points one by one)? I have scanned all of the point sets of a vtkCellArray(inLines) in a first round (inLines.GetNextCell) and generated a list of favourite points (e.g [5,13,46]) that I want to extract as quickly as possible in a second round. I wonder if GetCell() method can be used for this purpose and how? Or maybe there is another way that I am not aware of? Cheers, Saeed -------------- next part -------------- An HTML attachment was scrubbed... URL: From shawn.waldon at kitware.com Fri Jun 3 11:45:08 2016 From: shawn.waldon at kitware.com (Shawn Waldon) Date: Fri, 3 Jun 2016 11:45:08 -0400 Subject: [vtkusers] Extract certain set of points from a vtkcellarray In-Reply-To: References: Message-ID: Hi Saeed, If you have the dataset object there is a GetPoint(i) [1] function that returns a point given its index in the list of points. You can call GetPoint(i) with each of your indices to get the point at that index. HTH, Shawn [1]: http://www.vtk.org/doc/nightly/html/classvtkDataSet.html#ae8406fa1dc144b392ef28111c71a47b0 On Fri, Jun 3, 2016 at 11:30 AM, Saeed Mahdizadeh Bakhshmand < saeedbakhshmand at gmail.com> wrote: > Hello, > > Is there any trick to obtain a set of points from a vtkCellArray > quickly?(in a real time fashion without using GetNextCell that loads all of > the points one by one)? > > I have scanned all of the point sets of a vtkCellArray(inLines) in a first > round (inLines.GetNextCell) and generated a list of favourite points (e.g > [5,13,46]) that I want to extract as quickly as possible in a second round. > I wonder if GetCell() method can be used for this purpose and how? Or maybe > there is another way that I am not aware of? > > Cheers, > Saeed > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikewithascarf at yahoo.com Fri Jun 3 17:34:43 2016 From: mikewithascarf at yahoo.com (mikewithascarf) Date: Fri, 3 Jun 2016 14:34:43 -0700 (MST) Subject: [vtkusers] building vtk in 64-bit mode Message-ID: <1464989683109-5738548.post@n5.nabble.com> I have been running into issues building VTK in 64-bit mode. I am using CMake 3.5.0, Visual Studio 2015 (Community), and VTK 7.0.0 When I try to build the projects in visual studio (in the VTK.sln solution file), I receive link errors for many of the projects like this: LNK1112: module machine type 'x64' conflicts with target machine type 'X86' I've double-checked that all the target machine types in the configuration manager are set to x64. Any help would be much appreciated. For reference, I can build in 32-bit mode without any issues. -- View this message in context: http://vtk.1045678.n5.nabble.com/building-vtk-in-64-bit-mode-tp5738548.html Sent from the VTK - Users mailing list archive at Nabble.com. From sychen52 at gmail.com Fri Jun 3 19:34:08 2016 From: sychen52 at gmail.com (SY Chen) Date: Fri, 3 Jun 2016 16:34:08 -0700 Subject: [vtkusers] =?utf-8?q?Why_are_all_the_GetXXX_functions_in_vtkPolyD?= =?utf-8?q?ata_class_not_const=EF=BC=9F?= In-Reply-To: References: Message-ID: Does anyone know the reason why all the GetXXX functions in vtkPolyData class are not const? -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Fri Jun 3 20:30:36 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Fri, 3 Jun 2016 18:30:36 -0600 Subject: [vtkusers] =?utf-8?q?Why_are_all_the_GetXXX_functions_in_vtkPolyD?= =?utf-8?q?ata_class_not_const=EF=BC=9F?= In-Reply-To: References: Message-ID: On Fri, Jun 3, 2016 at 5:34 PM, SY Chen wrote: > Does anyone know the reason why all the GetXXX functions in vtkPolyData > class are not const? > In the VTK code, all objects derived from vtkObjectBase are always accessed though non-const pointers, and have only non-const methods. Twenty-some years ago when VTK began, the use of "const" was much less common than it is now. And compilers often had const-related bugs -- for example, MSVC would often choke if "const" was used with templates. Changing all these methods would be a huge task, especially considering all of the other projects that use VTK and derive classes from VTK classes. I think the general consensus is that, in terms of improving VTK code quality, time would be better spent on chasing bugs and writing more unit tests for VTK. I'm sure this change will come eventually. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From sychen52 at gmail.com Fri Jun 3 20:38:23 2016 From: sychen52 at gmail.com (SY Chen) Date: Fri, 3 Jun 2016 17:38:23 -0700 Subject: [vtkusers] =?utf-8?q?Why_are_all_the_GetXXX_functions_in_vtkPolyD?= =?utf-8?q?ata_class_not_const=EF=BC=9F?= In-Reply-To: References: Message-ID: Thank you for your explanation, David. On Jun 3, 2016 17:30, "David Gobbi" wrote: > On Fri, Jun 3, 2016 at 5:34 PM, SY Chen wrote: > >> Does anyone know the reason why all the GetXXX functions in vtkPolyData >> class are not const? >> > In the VTK code, all objects derived from vtkObjectBase are always accessed > though non-const pointers, and have only non-const methods. Twenty-some > years ago when VTK began, the use of "const" was much less common than > it is now. And compilers often had const-related bugs -- for example, MSVC > would often choke if "const" was used with templates. > > Changing all these methods would be a huge task, especially considering > all of the other projects that use VTK and derive classes from VTK classes. > I think the general consensus is that, in terms of improving VTK code > quality, > time would be better spent on chasing bugs and writing more unit tests for > VTK. > > I'm sure this change will come eventually. > > - David > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From minaninina1 at gmail.com Sat Jun 4 02:32:56 2016 From: minaninina1 at gmail.com (aria dob) Date: Fri, 3 Jun 2016 23:32:56 -0700 (MST) Subject: [vtkusers] obbtree Message-ID: <1465021976846-5738552.post@n5.nabble.com> hi guys please can any body help me i want to khnow what's the obb tree and what's the points of using it to detect collisionand how it detect collision please i need an answer? -- View this message in context: http://vtk.1045678.n5.nabble.com/obbtree-tp5738552.html Sent from the VTK - Users mailing list archive at Nabble.com. From aborsic at ne-scientific.com Sat Jun 4 04:55:58 2016 From: aborsic at ne-scientific.com (Andrea Borsic) Date: Sat, 4 Jun 2016 10:55:58 +0200 Subject: [vtkusers] VTK7 and VS 2015 compatibility? In-Reply-To: References: Message-ID: <741b7af9-bd86-5530-d0c9-ecfecaef8cc8@ne-scientific.com> Hi Elvis, Just to contribute one data point: I build VTK 7.0.0 with VS 2015 Community Edition with no problems. In my configurations I use both OpenGL and OpenGL2 back-ends, Qt 5.6, python 3 wrapping, VTK Imaging, VTK Views, and SMP = OpenMP. Sorry, but have instead no suggestions regarding the cause of the issues you are encountering. Best Regards, Andrea On 2/24/2016 5:28 PM, Elvis Chen wrote: > Greetings, > > Trying to compile VTK 7 using Visual Studio 2015 (Enterprise) and got > the following error. Can anyone confirm if compatibility is a problem? > > 1>------ Build started: Project: vtkhdf5, Configuration: Debug Win32 > ------ > 2>------ Build started: Project: vtkIOImport, Configuration: Debug > Win32 ------ > 3>------ Build started: Project: vtkIOLSDyna, Configuration: Debug > Win32 ------ > 4>------ Skipped Build: Project: vtkCompileTools, Configuration: Debug > Win32 ------ > 4>Project not selected to build for this solution configuration > 1> vtkhdf5.vcxproj -> G:\works\bin\vtk-7.0.0\bin\Debug\vtkhdf5-7.0.dll > 3> vtkLSDynaPart.cxx > 2> vtkVRMLImporter.cxx > 5>------ Build started: Project: vtkNetCDF, Configuration: Debug Win32 > ------ > 3>C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler > used, but unwind semantics are not enabled. Specify /EHsc > 2>C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler > used, but unwind semantics are not enabled. Specify /EHsc > 3>g:\works\src\vtk\vtk-7.0.0\io\lsdyna\private\LSDynaFamily.h(46): > fatal error C1083: Cannot open include file: 'unistd.h': No such file > or directory > 3> vtkLSDynaPartCollection.cxx > 3>C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler > used, but unwind semantics are not enabled. Specify /EHsc > 3>g:\works\src\vtk\vtk-7.0.0\io\lsdyna\private\LSDynaFamily.h(46): > fatal error C1083: Cannot open include file: 'unistd.h': No such file > or directory > 3> vtkLSDynaReader.cxx > 3>C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler > used, but unwind semantics are not enabled. Specify /EHsc > 3>g:\works\src\vtk\vtk-7.0.0\io\lsdyna\private\LSDynaFamily.h(46): > fatal error C1083: Cannot open include file: 'unistd.h': No such file > or directory > 3> vtkLSDynaSummaryParser.cxx > 3>C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler > used, but unwind semantics are not enabled. Specify /EHsc > 3>g:\works\src\vtk\vtk-7.0.0\io\lsdyna\private\LSDynaFamily.h(46): > fatal error C1083: Cannot open include file: 'unistd.h': No such file > or directory > 3> LSDynaFamily.cxx > 3>C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler > used, but unwind semantics are not enabled. Specify /EHsc > 3>g:\works\src\vtk\vtk-7.0.0\io\lsdyna\private\LSDynaFamily.h(46): > fatal error C1083: Cannot open include file: 'unistd.h': No such file > or directory > 3> LSDynaMetaData.cxx > 3>C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\include\xlocale(341): warning C4530: C++ exception handler > used, but unwind semantics are not enabled. Specify /EHsc > 3>g:\works\src\vtk\vtk-7.0.0\io\lsdyna\private\LSDynaFamily.h(46): > fatal error C1083: Cannot open include file: 'unistd.h': No such file > or directory > 3> Generating Code... > 5> lookup3.c > 2>g:\works\src\vtk\vtk-7.0.0\io\import\vtkVRMLImporter_Yacc.h(1708): > fatal error C1083: Cannot open include file: 'unistd.h': No such file > or directory > 5>G:\works\src\vtk\VTK-7.0.0\ThirdParty\netcdf\vtknetcdf\libsrc\lookup3.c(58): > fatal error C1083: Cannot open include file: 'sys/param.h': No such > file or directory > 5> error4.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4attr.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4dim.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4file.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4grp.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4type.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4var.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> ncfunc.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4internal.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5> nc4hdf.c > 5>g:\works\src\vtk\vtk-7.0.0\thirdparty\hdf5\vtkhdf5\src\H5public.h(157): > error C2632: 'int' followed by 'int' is illegal > 5>G:\works\src\vtk\VTK-7.0.0\ThirdParty\netcdf\vtknetcdf\libsrc4\nc4hdf.c(3666): > error C2177: constant too big > 5> Generating Code... > 6>------ Build started: Project: vtkNetCDF_cxx, Configuration: Debug > Win32 ------ > 6>LINK : fatal error LNK1104: cannot open file > '..\..\..\lib\Debug\vtkNetCDF-7.0.lib' > 7>------ Build started: Project: vtkIONetCDF, Configuration: Debug > Win32 ------ > 8>------ Build started: Project: vtkexoIIc, Configuration: Debug Win32 > ------ > 9>------ Build started: Project: vtkIOMINC, Configuration: Debug Win32 > ------ > 8>LINK : fatal error LNK1104: cannot open file > '..\..\..\lib\Debug\vtkNetCDF_cxx-7.0.lib' > 10>------ Build started: Project: vtkIOExodus, Configuration: Debug > Win32 ------ > 7>LINK : fatal error LNK1104: cannot open file > '..\..\lib\Debug\vtkNetCDF_cxx-7.0.lib' > 11>------ Build started: Project: vtkIOParallel, Configuration: Debug > Win32 ------ > 9>LINK : fatal error LNK1104: cannot open file > '..\..\lib\Debug\vtkNetCDF_cxx-7.0.lib' > 10>LINK : fatal error LNK1104: cannot open file > '..\..\lib\Debug\vtkexoIIc-7.0.lib' > 11>LINK : fatal error LNK1104: cannot open file > '..\..\lib\Debug\vtkIONetCDF-7.0.lib' > 12>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 > ------ > 12>Project not selected to build for this solution configuration > ========== Build: 1 succeeded, 9 failed, 104 up-to-date, 2 skipped > ==========Description Project File Line Suppression State > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- ++++++++++++++++++++++++++++++++++++ Andrea Borsic Ph.D. Founder NE Scientific LLC Tel: +1 603 676 7450 Web: www.ne-scientific.com Twitter: https://twitter.com/ne_scientific -------------- next part -------------- An HTML attachment was scrubbed... URL: From aborsic at ne-scientific.com Sat Jun 4 08:11:00 2016 From: aborsic at ne-scientific.com (Andrea Borsic) Date: Sat, 4 Jun 2016 14:11:00 +0200 Subject: [vtkusers] building vtk in 64-bit mode In-Reply-To: <1464989683109-5738548.post@n5.nabble.com> References: <1464989683109-5738548.post@n5.nabble.com> Message-ID: <14e3cc73-27c6-9117-e5f3-aac8f047718e@ne-scientific.com> Hi, Are both the CMake generator and the VS 2015 configuration set to x64 as in the attached screenshots? Best Regards, Andrea On 6/3/2016 11:34 PM, mikewithascarf via vtkusers wrote: > I have been running into issues building VTK in 64-bit mode. I am using CMake > 3.5.0, Visual Studio 2015 (Community), and VTK 7.0.0 > > When I try to build the projects in visual studio (in the VTK.sln solution > file), I receive link errors for many of the projects like this: > > LNK1112: module machine type 'x64' conflicts with target machine type 'X86' > > I've double-checked that all the target machine types in the configuration > manager are set to x64. Any help would be much appreciated. For reference, I > can build in 32-bit mode without any issues. > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/building-vtk-in-64-bit-mode-tp5738548.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- ++++++++++++++++++++++++++++++++++++ Andrea Borsic Ph.D. Founder NE Scientific LLC Tel: +1 603 676 7450 Web: www.ne-scientific.com Twitter: https://twitter.com/ne_scientific -------------- next part -------------- A non-text attachment was scrubbed... Name: Cmake.PNG Type: image/png Size: 16926 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: VS 2015.PNG Type: image/png Size: 9730 bytes Desc: not available URL: From tamas.egeresi at c3d.eu Sat Jun 4 12:03:57 2016 From: tamas.egeresi at c3d.eu (=?UTF-8?Q?Tam=C3=A1s_Egeresi?=) Date: Sat, 04 Jun 2016 18:03:57 +0200 Subject: [vtkusers] Parallel/multi-threaded FLUENT VTK reader Message-ID: <80d952972c930968611ed5aa0ee5479c@c3d.hu> Dear All, I've written a serial FLUENT post-processing code in Python using its VTK module, and just found out that the code reaches the limit of the readable file size. My sample FLUENT file consists of 1.5 millions of cells, and the serial code runs with it smoothly producing a matplotlib surface plot, but with another mesh with 4 millions cells it fails to run, giving "Kernel died unexpectedly ...". My computer has 8 CPUs, 16GB RAM and runs with Windows 10, so I'm about to use threaded version of the reader. My question is if it is adaptable or not, and if yes, how it is possible to be implemented. I have read a vast amount of material focusing on parallel filters, but my issue is different since I need the parallelism (or threading) right in the reader section, which is the bottleneck of the problem. I've also tried to start developing the reader by using pickable vtk function, but could not find any appropriate information of its usage. Some details of it, or any homepage is very welcome. The only solution has been up till now that I use ParaVIEW to produce slices in separate files, and run my serial FLUENT reader on them. My goal is to exclude the ParaVIEW step and to work in Python, only. -- T. Egeresi Design engineer From andreas.schuh.84 at gmail.com Sat Jun 4 13:20:56 2016 From: andreas.schuh.84 at gmail.com (Andreas Schuh) Date: Sat, 4 Jun 2016 18:20:56 +0100 Subject: [vtkusers] vtkPolygon.cxx To do comment MVC angle computation Message-ID: <5DF4825F-CAFB-47C8-ADA0-562A3B0FFE4A@gmail.com> Hi, I was recently implementing MVC based texture mapping and thereby introduced to the concept of mean value coordinates. Coincidentally, I found the vtkPolygon.cxx implementation of MVC interpolation for planar polygons. In the VTK source code, there is the following note: // Now loop over all vertices to compute weight // w_i = ( tan(theta_i/2) + tan(theta_(i+1)/2) ) / dist_i // To do consider the simplification of // tan(alpha/2) = (1-cos(alpha))/sin(alpha) // = (d0*d1 - cross(u0, u1))/(2*dot(u0,u1)) where the needed weights are based on the actual computation of the angles and the expensive/numerically less robust use of trigonometric functions yet. This note provides the needed identity for the tan(alpha/2) based on cos(alpha) and sin(alpha) only. However, the second line of the simplification is incorrect. I just thought I?d drop a note here for somebody to correct the comment to not mislead anyone how wants to actually implement it. The correct formula uses the following relations between cos/sin and inner/outer vector products: cos(alpha) = dot(u0, u1) / (d0 * d1) sin(alpha) = norm(cross(u0, u1)) / (d0 * d1) which when substituted into tan(alpha/2) = (1 - cos(alpha)) / sin(alpha) gives tan(alpha/2) = (d0 * d1 - dot(u0, u1)) / norm(cross(u0, u1)) instead of the above formula. Best, Andreas From yassminabdallah at gmail.com Sat Jun 4 13:26:56 2016 From: yassminabdallah at gmail.com (YassminAbdallah) Date: Sat, 4 Jun 2016 10:26:56 -0700 (MST) Subject: [vtkusers] VR in VTK Message-ID: <1465061216546-5738557.post@n5.nabble.com> Hello, i just read the article posted in kitware blog about VR in VTK, and i was asking if ?vtkOpenVR? available also for VTK iOS framework ?? if yes could you please explain the steps i needed to integrate it with the iOS VTK framework i have? also does it need a specific VR glasses ?? or any brand will be okay ? (if i use google VR glasses for example does that will be okay) Thanks a lot, Yassmin -- View this message in context: http://vtk.1045678.n5.nabble.com/VR-in-VTK-tp5738557.html Sent from the VTK - Users mailing list archive at Nabble.com. From mikewithascarf at yahoo.com Sat Jun 4 19:02:11 2016 From: mikewithascarf at yahoo.com (mikewithascarf) Date: Sat, 4 Jun 2016 16:02:11 -0700 (MST) Subject: [vtkusers] building vtk in 64-bit mode In-Reply-To: <14e3cc73-27c6-9117-e5f3-aac8f047718e@ne-scientific.com> References: <1464989683109-5738548.post@n5.nabble.com> <14e3cc73-27c6-9117-e5f3-aac8f047718e@ne-scientific.com> Message-ID: <1465081331153-5738558.post@n5.nabble.com> The CMake note was the issue. Thank you! -- View this message in context: http://vtk.1045678.n5.nabble.com/building-vtk-in-64-bit-mode-tp5738548p5738558.html Sent from the VTK - Users mailing list archive at Nabble.com. From lackodan at outlook.com Sat Jun 4 19:22:07 2016 From: lackodan at outlook.com (D L) Date: Sun, 5 Jun 2016 01:22:07 +0200 Subject: [vtkusers] obbtree In-Reply-To: <1465021976846-5738552.post@n5.nabble.com> References: <1465021976846-5738552.post@n5.nabble.com> Message-ID: Hi! Take a look at this post about ray casting with Python and VTK, it explains the basics of vtkOBBTree quite well: https://pyscience.wordpress.com/2014/09/21/ray-casting-with-python-and-vtk-intersecting-linesrays-with-surface-meshes/ Kind regards, Daniel > Date: Fri, 3 Jun 2016 23:32:56 -0700 > From: minaninina1 at gmail.com > To: vtkusers at vtk.org > Subject: [vtkusers] obbtree > > hi guys please can any body help me i want to khnow what's the obb tree and > what's the points of using it to detect collisionand how it detect collision > please i need an answer? > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/obbtree-tp5738552.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjlp at netease.com Sun Jun 5 06:26:11 2016 From: tjlp at netease.com (Liu_tj) Date: Sun, 5 Jun 2016 18:26:11 +0800 (CST) Subject: [vtkusers] why the world coordinate of vtkRenderer is different from the coordinate of vtkCoordinate Message-ID: <41f626ab.15.1552019393d.Coremail.tjlp@netease.com> Hi, I use vtkBorderWidget to select area of DICOM image on vtkImageViewer2. I want to set the initial left-bottom and right-top position of the vtkBorderWidget. Take the Coronal view for example, I get the display bounds of the image actor. These display bounds forms the left-bottom and right-top world coordinate. And then I call the vtkRenderer.WorldToView() to transform the world coordinate to view coordinate; with these 2 view coordinates, the vtkBorderWidget displays correctly. The value of the display bounds is: MinX: 0, MaxX: 228.552734375, MinY: 114.052734375, MaxY: 114.052734375, MinZ: 0, MaxZ: 151.19 But, I use the methods of vtkBorderWidget to get the world coordinate of the left-bottom and right-top, the value is different from display bounds. The value is: x1 1.142763671875, x2 114.2763671875, y1 108.75879924706, y2 108.75879924706, z1 0.75595, z2 75.595 Interesting thing is: x2 is half of MaxX, x1 is 1% of x2; z2 is half of MaxZ, z1 is 1% of z2. There might be some misunderstanding of VTK coordinate system. My C# code is as follow. Where do I make mistake? vtkImageActor actor = m_imageViewer.GetImageActor(); IntPtr boundsptr = actor.GetDisplayBounds(); double[] displaybounds= new double[ 6 ]; Marshal.Copy( boundsptr, displaybounds, 0, displaybounds.Length ); //Here I get the display bounds of vtkIamgeActor. m_renderer.SetWorldPoint( displaybounds[ 1 ], displaybounds[ 3 ], displaybounds[ 5 ], 1 ); m_renderer.WorldToView(); double[] viewpint1 = m_renderer.GetViewPoint(); //Transform the world coordinate of right-top to view coordinate m_renderer.SetWorldPoint( displaybounds[ 0 ], displaybounds[ 2 ], displaybounds[ 4 ], 1 ); m_renderer.WorldToView(); double[] viewpint = m_renderer.GetViewPoint(); //Transform the world coordinate of left-bottom to view coordinate borderrep.GetPositionCoordinate().SetCoordinateSystemToView(); borderrep.GetPosition2Coordinate().SetCoordinateSystemToView(); borderrep.SetPosition( viewpint[ 0 ], viewpint[ 1 ] ); borderrep.SetPosition2( viewpint1[ 0 ], viewpint1[ 1 ] ); vtkCoordinate lowerleftCorr = borderrep.GetPositionCoordinate(); double[] lowerleft = lowerleftCorr.GetComputedWorldValue(m_renderer); vtkCoordinate upperRightCorr = borderrep.GetPosition2Coordinate(); double[] upperright = upperRightCorr.GetComputedWorldValue(m_renderer); displaybounds is: MinX: 0, MaxX: 228.552734375, MinY: 114.052734375, MaxY: 114.052734375, MinZ: 0, MaxZ: 151.19 lowerleft and upperright is: x1 1.142763671875, x2 114.2763671875, y1 108.75879924706, y2 108.75879924706, z1 0.75595, z2 75.595 Any tips on that? Thanks very much. Liu Peng -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrewkeeling at hotmail.com Sun Jun 5 16:47:49 2016 From: andrewkeeling at hotmail.com (andyjk) Date: Sun, 5 Jun 2016 13:47:49 -0700 (MST) Subject: [vtkusers] Weird Render results with smartpointer in class Message-ID: <1465159669899-5738563.post@n5.nabble.com> I have a feeling I am using smart pointers wrongly in a class, and it is causing weird rendering results. Can anyone help ? I am trying to compare the distances between 2 polydatas using different techniques. One function measures the vertex to surface distance. The other takes lots of samples on the test polydata and measures the distance to the surface of the reference polydata. The test and reference polydatas do not change, and the numbers (mean distance etc ) given by the functions are correct. However, the display deteriorates with use. I guess I need to know how to completely reset the pipeline in the class, ensuring the members are wiped before being reused (polydata, actor, mapper and renderer), although I had hoped I could just reset the polydata witha DeepCopy, and the pipeline would update. I have a class and in the header I declare : (QTCompare.h) vtkSmartPointer resultMapper_; vtkSmartPointer resultRenderer_; vtkSmartPointer resultActor_; vtkSmartPointer resultPolydata_; vtkSmartPointer distances_; // The scalar array holding the distances vtkSmartPointer scalarBar_; // To show the colour scale (I also declare two more polydatas : TestPolydata and targetPolydata, which are read in fine from a file) When the class is instantiated : (QTCompare.cpp) resultPolydata_ = vtkSmartPointer::New(); resultMapper_ = vtkSmartPointer::New(); resultActor_ = vtkSmartPointer::New(); resultMapper_->SetInputData(resultPolydata_); resultActor_->SetMapper(resultMapper_); resultRenderer_ = vtkSmartPointer::New(); resultRenderer_->AddActor(resultActor_); // VTK/Qt wedded this->qvtkWidgetResult->GetRenderWindow()->AddRenderer(resultRenderer_); // The distances array distances_ = vtkSmartPointer::New(); scalarBar_ = vtkSmartPointer::New(); So far, I have created the pipeline with a blank polydata. Then, when a certain button is pressed I do : void QtCompare::sampleVertices() { txtOutput->append("Sampling vertices..."); vtkIdType nPoints = testPolydata_->GetNumberOfPoints(); if (nPoints == 0) return; distances_->Initialize(); distances_->SetNumberOfValues(nPoints); resultPolydata_->DeepCopy(testPolydata_); // Create the tree if (referencePolydata_->GetNumberOfCells() == 0) return; vtkSmartPointer cellLocator = vtkSmartPointer::New(); cellLocator->SetDataSet(referencePolydata_); cellLocator->BuildLocator(); txtOutput->append("Number of Samples : " + QString::number(nPoints)); // Main loop for (vtkIdType i = 0; i < nPoints; i++) { double testPoint[3]; testPolydata_->GetPoint(i, testPoint); //Find the closest points to TestPoint double closestPoint[3];//the coordinates of the closest point will be returned here double closestPointDist2; //the squared distance to the closest point will be returned here vtkIdType cellId; //the cell id of the cell containing the closest point will be returned here int subId; //this is rarely used (in triangle strips only, I believe) cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, subId, closestPointDist2); double distance = sqrt(closestPointDist2); distances_->SetValue(i, (float)distance); } cout << "N scalars :" << this->distances_->GetSize() << endl; // Add the distances to the result polydata (for colour) resultPolydata_->GetPointData()->SetScalars(distances_); // Get min and max double range[2]; distances_->Modified(); distances_->GetRange(range); txtOutput->append("Range of Samples : " + QString::number(range[0],'f',4) + " to " + QString::number(range[1],'f',4)); range[0] = 0.0; range[1] = 0.5; // Add in the mapper and set up scalar colours resultMapper_->ScalarVisibilityOn(); resultMapper_->SetScalarModeToUsePointData(); resultMapper_->SetColorModeToMapScalars(); resultMapper_->SetScalarRange(range[0], range[1]); resultMapper_->Modified(); //resultActor_->SetMapper(resultMapper_); resultActor_->GetProperty()->SetRepresentationToSurface(); resultActor_->Modified(); scalarBar_->SetTitle("Vertex Distances"); scalarBar_->SetNumberOfLabels(6); vtkSmartPointer hueLUT = vtkSmartPointer::New(); hueLUT->SetNumberOfTableValues(10); hueLUT->SetTableRange(range[0], range[1]); hueLUT->SetHueRange(0.625, 0.0); hueLUT->SetValueRange(1, 1); hueLUT->SetSaturationRange(1, 1); hueLUT->Build(); resultMapper_->SetLookupTable(hueLUT); scalarBar_->SetLookupTable(hueLUT); this->resultRenderer_->Clear(); this->resultRenderer_->AddActor2D(scalarBar_); this->resultRenderer_->ResetCamera(); this->qvtkWidgetResult->GetRenderWindow()->Render(); float sd = standard_deviation(); // Reports mean and SD in the output window } This all works once, but I have another function (almost the same) which refills the class members distances_, resultPolydata_, resultMapper_ and resultActor_. In this function the pointrepresentation is set to points, and the polydata has many more points than the original. This function looks like : void QtCompare::uniformSample() { txtOutput->append("Uniform sampling at 10 microns..."); // Sample points at 0.01mm intervals vtkSmartPointer pointSampler = vtkSmartPointer::New(); pointSampler->SetDistance(.01); pointSampler->SetInputData(testPolydata_); pointSampler->Update(); vtkIdType nPoints = pointSampler->GetOutput()->GetNumberOfPoints(); if (nPoints == 0) return; distances_->Initialize(); distances_->SetNumberOfValues(nPoints); txtOutput->append("Number of Samples : " + QString::number(nPoints)); // Create a polydata made from all the samples resultPolydata_->DeepCopy(pointSampler->GetOutput()); // Create the tree if (referencePolydata_->GetNumberOfCells() == 0) return; vtkSmartPointer cellLocator = vtkSmartPointer::New(); cellLocator->SetDataSet(referencePolydata_); cellLocator->BuildLocator(); // Main loop for (vtkIdType i = 0; i < nPoints; i++) { double testPoint[3]; resultPolydata_->GetPoint(i, testPoint); //Find the closest points to TestPoint double closestPoint[3];//the coordinates of the closest point will be returned here double closestPointDist2; //the squared distance to the closest point will be returned here vtkIdType cellId; //the cell id of the cell containing the closest point will be returned here int subId; //this is rarely used (in triangle strips only, I believe) cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, subId, closestPointDist2); double distance = sqrt(closestPointDist2); distances_->SetValue(i, (float)distance); } // Add the distances to the result polydata (for colour) resultPolydata_->GetPointData()->SetScalars(distances_); // Get min and max double range[2]; distances_->Modified(); distances_->GetRange(range); txtOutput->append("Range of Samples : " + QString::number(range[0],'f',4) + " to " + QString::number(range[1],'f',4)); // Add in the mapper and set up scalar colours resultMapper_->ScalarVisibilityOn(); resultMapper_->SetScalarModeToUsePointData(); resultMapper_->SetColorModeToMapScalars(); resultMapper_->SetScalarRange(range[0], range[1]); resultMapper_->Modified(); resultActor_->SetMapper(resultMapper_); resultActor_->Modified(); resultActor_->GetProperty()->SetRepresentationToPoints(); resultActor_->Modified(); scalarBar_->SetTitle("Uniform Sampling Distances"); scalarBar_->SetNumberOfLabels(6); vtkSmartPointer hueLUT = vtkSmartPointer::New(); hueLUT->SetNumberOfTableValues(10); hueLUT->SetTableRange(range[0], range[1]); hueLUT->SetHueRange(0.3, 0.0); hueLUT->SetValueRange(1, 1); hueLUT->SetSaturationRange(1, 1); hueLUT->Build(); resultMapper_->SetLookupTable(hueLUT); scalarBar_->SetLookupTable(hueLUT); txtOutput->append(QString::number( resultActor_->GetReferenceCount())); this->resultRenderer_->Clear(); this->resultRenderer_->AddActor2D(scalarBar_); this->resultRenderer_->ResetCamera(); this->qvtkWidgetResult->GetRenderWindow()->Render(); float sd = standard_deviation(); // Reports mean and SD in the output window } This also works fine. Now the strange bit. If I call the first function again, everything displays as expected. BUT, if I then call the first function again (so nothing should change) the data from the second function gets displayed. This toggles every time I call the first function! The values given by my ?standard_deviation()? function remain correct throughout, so the maths is being done on the correct data each time, but for some reason the display keeps changing its source data! Does anyone know what I am doing wrong ? Thanks -- View this message in context: http://vtk.1045678.n5.nabble.com/Weird-Render-results-with-smartpointer-in-class-tp5738563.html Sent from the VTK - Users mailing list archive at Nabble.com. From litianhong15 at gmail.com Mon Jun 6 04:49:48 2016 From: litianhong15 at gmail.com (Tianhong Lee) Date: Mon, 6 Jun 2016 16:49:48 +0800 Subject: [vtkusers] [vtk7.0][DeviceIndex] Message-ID: Hello EVERYONE! my environment is : CPU: Xeon E5-2680 v3 @2.50 GHz, GTX750 + GTX TITAN X , VTK 7.0, QT 5.3.2, VS2013, Windows7 x64 Now my program run on GTX750 ,i want to run the program on GTX TITAN X. Could you please tell me if it is possible to choose graphics card in my program? I find the code below in vtkRenderWindow.h file: // Description: // If there are several graphics card installed on a system, // this index can be used to specify which card you want to render to. // the default is 0. This may not work on all derived render window and // it may need to be set before the first render. vtkSetMacro(*DeviceIndex*,int); vtkGetMacro(*DeviceIndex*,int); // Description: // Returns the number of devices (graphics cards) on a system. // This may not work on all derived render windows. virtual int GetNumberOfDevices() { return 0; } I tried changing the *DeviceIndex* variable to different values but with no effect.my code is: renWin->SetDeviceIndex(1); hoping for help! Thank you! -------------- next part -------------- An HTML attachment was scrubbed... URL: From claude.goubet at e.ujf-grenoble.fr Mon Jun 6 06:14:24 2016 From: claude.goubet at e.ujf-grenoble.fr (gouc) Date: Mon, 6 Jun 2016 03:14:24 -0700 (MST) Subject: [vtkusers] Declare and initialize a vtkPointSet with vtkPoints Message-ID: <1465208064821-5738565.post@n5.nabble.com> Hello, I need to use a vtkPointSet in order to create a mesh. Problem, vtkPointSet has a private constructor. I then used a vtkPolyData initialised as following: vtkSmartPointer points1Set = vtkSmartPointer::New(); points1Set->SetPoints(points1); where points is of type vtkSmartPointer and contains 70 points. In order to get a vtkPointSet, I use vtkPointSet::SafeDownCast(points1Set) The problem is that it seems that it seems to return an empty set of point. What is a good way to generate a vtkPointSet from vtkPoints? Thank you. -- View this message in context: http://vtk.1045678.n5.nabble.com/Declare-and-initialize-a-vtkPointSet-with-vtkPoints-tp5738565.html Sent from the VTK - Users mailing list archive at Nabble.com. From lucadambros at outlook.com Mon Jun 6 07:42:51 2016 From: lucadambros at outlook.com (Luca D'Ambros) Date: Mon, 6 Jun 2016 13:42:51 +0200 Subject: [vtkusers] Android VR example Message-ID: Can someone help me? http://stackoverflow.com/questions/37563919/jni-function-error-in-android?noredirect=1#comment62620643_37563919 What is the android vr example? From lucadambros at outlook.com Mon Jun 6 07:56:13 2016 From: lucadambros at outlook.com (Luca D'Ambros) Date: Mon, 6 Jun 2016 13:56:13 +0200 Subject: [vtkusers] Vtk function Message-ID: Hi to everyone, I need some help. I tried to install VTK following this guide (http://www.vtk.org/Wiki/VTK/Configure_and_Build) and I have a question: how can I calculate the volume starting from point clouds? From dejan.zivkovic90 at gmail.com Mon Jun 6 09:44:09 2016 From: dejan.zivkovic90 at gmail.com (Dejan Zivkovic) Date: Mon, 6 Jun 2016 15:44:09 +0200 Subject: [vtkusers] Help with vtkActor2D picking Message-ID: I have some problems with picking vtkActor2D. Part of the code that constructs actor2D is here: vtkSmartPointer pngReader = vtkSmartPointer::New(); pngReader->SetFileName(filename.c_str()); pngReader->Update(); vtkSmartPointer imageMapper = vtkSmartPointer::New(); imageMapper->SetInputConnection(pngReader->GetOutputPort()); imageMapper->Update(); imageActor = vtkSmartPointer::New(); imageActor->SetMapper(imageMapper); imageActor->GetProperty()->SetOpacity(1.0); imageActor->SetPickable(true); I use vtkActor2D::SetPosition(...) to set the actor position on the sceen and the image really moves where I position it. The problem is in picking (using vtkPropPicker). The actors image on the screen doesn't react on picking, but when I click near the bottom left corner of the screen (screen coordinates near zero), the propPicker detects that picked actor. So, the actor2D seems to be in screen origin, regardless of which position I set using vtkActor2D::SetPosition(), but its image is moved as it should. Do you have any idea why? Thanks, Dejan -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Mon Jun 6 10:47:15 2016 From: david.lonie at kitware.com (David Lonie) Date: Mon, 6 Jun 2016 10:47:15 -0400 Subject: [vtkusers] Weird Render results with smartpointer in class In-Reply-To: <1465159669899-5738563.post@n5.nabble.com> References: <1465159669899-5738563.post@n5.nabble.com> Message-ID: Hi Andy, Smart pointers shouldn't be causing this sort of issue, and from glancing at the example code they appear to be used correctly. Have you set breakpoints in these functions or added debug output to ensure that the correct functions are being called as-expected? I suspect that walking through the code with a debugger would shine some light on the issue. HTH, Dave On Sun, Jun 5, 2016 at 4:47 PM, andyjk wrote: > I have a feeling I am using smart pointers wrongly in a class, and it is > causing weird rendering results. Can anyone help ? > I am trying to compare the distances between 2 polydatas using different > techniques. One function measures the vertex to surface distance. The other > takes lots of samples on the test polydata and measures the distance to the > surface of the reference polydata. The test and reference polydatas do not > change, and the numbers (mean distance etc ) given by the functions are > correct. However, the display deteriorates with use. > > I guess I need to know how to completely reset the pipeline in the class, > ensuring the members are wiped before being reused (polydata, actor, mapper > and renderer), although I had hoped I could just reset the polydata witha > DeepCopy, and the pipeline would update. > > I have a class and in the header I declare : > (QTCompare.h) > > vtkSmartPointer resultMapper_; > vtkSmartPointer resultRenderer_; > vtkSmartPointer resultActor_; > > vtkSmartPointer resultPolydata_; > > vtkSmartPointer distances_; // The scalar array holding the > distances > vtkSmartPointer scalarBar_; // To show the colour scale > > (I also declare two more polydatas : TestPolydata and targetPolydata, which > are read in fine from a file) > > When the class is instantiated : > (QTCompare.cpp) > > resultPolydata_ = vtkSmartPointer::New(); > resultMapper_ = vtkSmartPointer::New(); > resultActor_ = vtkSmartPointer::New(); > resultMapper_->SetInputData(resultPolydata_); > resultActor_->SetMapper(resultMapper_); > resultRenderer_ = vtkSmartPointer::New(); > resultRenderer_->AddActor(resultActor_); > // VTK/Qt wedded > this->qvtkWidgetResult->GetRenderWindow()->AddRenderer(resultRenderer_); > > // The distances array > distances_ = vtkSmartPointer::New(); > scalarBar_ = vtkSmartPointer::New(); > > > So far, I have created the pipeline with a blank polydata. Then, when a > certain button is pressed I do : > > void QtCompare::sampleVertices() > { > > txtOutput->append("Sampling vertices..."); > > vtkIdType nPoints = testPolydata_->GetNumberOfPoints(); > if (nPoints == 0) return; > distances_->Initialize(); > distances_->SetNumberOfValues(nPoints); > > resultPolydata_->DeepCopy(testPolydata_); > > // Create the tree > if (referencePolydata_->GetNumberOfCells() == 0) return; > vtkSmartPointer cellLocator = > vtkSmartPointer::New(); > cellLocator->SetDataSet(referencePolydata_); > cellLocator->BuildLocator(); > > > txtOutput->append("Number of Samples : " + > QString::number(nPoints)); > > > // Main loop > for (vtkIdType i = 0; i < nPoints; i++) { > > double testPoint[3]; > testPolydata_->GetPoint(i, testPoint); > > //Find the closest points to TestPoint > double closestPoint[3];//the coordinates of the closest point > will be returned here > double closestPointDist2; //the squared distance to the > closest > point will be returned here > vtkIdType cellId; //the cell id of the cell containing the > closest point will be returned here > int subId; //this is rarely used (in triangle strips only, I > believe) > cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, > subId, closestPointDist2); > > double distance = sqrt(closestPointDist2); > > distances_->SetValue(i, (float)distance); > > } > cout << "N scalars :" << this->distances_->GetSize() << endl; > // Add the distances to the result polydata (for colour) > resultPolydata_->GetPointData()->SetScalars(distances_); > > // Get min and max > double range[2]; > distances_->Modified(); > distances_->GetRange(range); > txtOutput->append("Range of Samples : " + > QString::number(range[0],'f',4) + " to " + > QString::number(range[1],'f',4)); > range[0] = 0.0; range[1] = 0.5; > > // Add in the mapper and set up scalar colours > resultMapper_->ScalarVisibilityOn(); > resultMapper_->SetScalarModeToUsePointData(); > resultMapper_->SetColorModeToMapScalars(); > resultMapper_->SetScalarRange(range[0], range[1]); > resultMapper_->Modified(); > > //resultActor_->SetMapper(resultMapper_); > resultActor_->GetProperty()->SetRepresentationToSurface(); > resultActor_->Modified(); > > > scalarBar_->SetTitle("Vertex Distances"); > scalarBar_->SetNumberOfLabels(6); > > vtkSmartPointer hueLUT = > vtkSmartPointer::New(); > hueLUT->SetNumberOfTableValues(10); > hueLUT->SetTableRange(range[0], range[1]); > hueLUT->SetHueRange(0.625, 0.0); > hueLUT->SetValueRange(1, 1); > hueLUT->SetSaturationRange(1, 1); > hueLUT->Build(); > > resultMapper_->SetLookupTable(hueLUT); > scalarBar_->SetLookupTable(hueLUT); > > this->resultRenderer_->Clear(); > this->resultRenderer_->AddActor2D(scalarBar_); > this->resultRenderer_->ResetCamera(); > this->qvtkWidgetResult->GetRenderWindow()->Render(); > > float sd = standard_deviation(); // Reports mean and SD in the > output > window > > } > > This all works once, but I have another function (almost the same) which > refills the class members distances_, resultPolydata_, resultMapper_ and > resultActor_. In this function the pointrepresentation is set to points, > and > the polydata has many more points than the original. > > This function looks like : > void QtCompare::uniformSample() > { > txtOutput->append("Uniform sampling at 10 microns..."); > > // Sample points at 0.01mm intervals > vtkSmartPointer pointSampler = > vtkSmartPointer::New(); > pointSampler->SetDistance(.01); > pointSampler->SetInputData(testPolydata_); > pointSampler->Update(); > > vtkIdType nPoints = pointSampler->GetOutput()->GetNumberOfPoints(); > > if (nPoints == 0) return; > distances_->Initialize(); > distances_->SetNumberOfValues(nPoints); > > txtOutput->append("Number of Samples : " + > QString::number(nPoints)); > > // Create a polydata made from all the samples > resultPolydata_->DeepCopy(pointSampler->GetOutput()); > > // Create the tree > if (referencePolydata_->GetNumberOfCells() == 0) return; > vtkSmartPointer cellLocator = > vtkSmartPointer::New(); > cellLocator->SetDataSet(referencePolydata_); > cellLocator->BuildLocator(); > > // Main loop > for (vtkIdType i = 0; i < nPoints; i++) { > > double testPoint[3]; > resultPolydata_->GetPoint(i, testPoint); > > > //Find the closest points to TestPoint > double closestPoint[3];//the coordinates of the closest point > will be returned here > double closestPointDist2; //the squared distance to the > closest > point will be returned here > vtkIdType cellId; //the cell id of the cell containing the > closest point will be returned here > int subId; //this is rarely used (in triangle strips only, I > believe) > cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, > subId, closestPointDist2); > > double distance = sqrt(closestPointDist2); > > distances_->SetValue(i, (float)distance); > > } > > // Add the distances to the result polydata (for colour) > resultPolydata_->GetPointData()->SetScalars(distances_); > > // Get min and max > double range[2]; > distances_->Modified(); > distances_->GetRange(range); > txtOutput->append("Range of Samples : " + > QString::number(range[0],'f',4) + " to " + > QString::number(range[1],'f',4)); > > // Add in the mapper and set up scalar colours > resultMapper_->ScalarVisibilityOn(); > resultMapper_->SetScalarModeToUsePointData(); > resultMapper_->SetColorModeToMapScalars(); > resultMapper_->SetScalarRange(range[0], range[1]); > resultMapper_->Modified(); > > resultActor_->SetMapper(resultMapper_); > resultActor_->Modified(); > resultActor_->GetProperty()->SetRepresentationToPoints(); > resultActor_->Modified(); > > scalarBar_->SetTitle("Uniform Sampling Distances"); > scalarBar_->SetNumberOfLabels(6); > > vtkSmartPointer hueLUT = > vtkSmartPointer::New(); > hueLUT->SetNumberOfTableValues(10); > hueLUT->SetTableRange(range[0], range[1]); > hueLUT->SetHueRange(0.3, 0.0); > hueLUT->SetValueRange(1, 1); > hueLUT->SetSaturationRange(1, 1); > hueLUT->Build(); > > resultMapper_->SetLookupTable(hueLUT); > scalarBar_->SetLookupTable(hueLUT); > > txtOutput->append(QString::number( > resultActor_->GetReferenceCount())); > > this->resultRenderer_->Clear(); > this->resultRenderer_->AddActor2D(scalarBar_); > this->resultRenderer_->ResetCamera(); > this->qvtkWidgetResult->GetRenderWindow()->Render(); > > > float sd = standard_deviation(); // Reports mean and SD in the > output > window > > > } > > > This also works fine. Now the strange bit. If I call the first function > again, everything displays as expected. BUT, if I then call the first > function again (so nothing should change) the data from the second function > gets displayed. This toggles every time I call the first function! The > values given by my ?standard_deviation()? function remain correct > throughout, so the maths is being done on the correct data each time, but > for some reason the display keeps changing its source data! > > Does anyone know what I am doing wrong ? > > Thanks > > > > > > -- > View this message in context: > http://vtk.1045678.n5.nabble.com/Weird-Render-results-with-smartpointer-in-class-tp5738563.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From claude.goubet at e.ujf-grenoble.fr Tue Jun 7 04:35:55 2016 From: claude.goubet at e.ujf-grenoble.fr (gouc) Date: Tue, 7 Jun 2016 01:35:55 -0700 (MST) Subject: [vtkusers] Declare and initialize a vtkPointSet with vtkPoints In-Reply-To: <1465208064821-5738565.post@n5.nabble.com> References: <1465208064821-5738565.post@n5.nabble.com> Message-ID: <1465288555247-5738581.post@n5.nabble.com> So I have my answer, To create a vtkPolyData : 1/ I store the points (in my test it contains 70 points) in the variable of type: vtkSmartPointer points1; 2/ I create a vtkPolyData vtkSmartPointer points1Polydata = vtkSmartPointer::New(); points1Polydata->SetPoints(points1); vtkPolyData inherits from vtkPointSet. -- View this message in context: http://vtk.1045678.n5.nabble.com/Declare-and-initialize-a-vtkPointSet-with-vtkPoints-tp5738565p5738581.html Sent from the VTK - Users mailing list archive at Nabble.com. From s225251 at studenti.polito.it Tue Jun 7 06:18:52 2016 From: s225251 at studenti.polito.it (=?utf-8?Q?Bruno_Gr=C3=A9goire?=) Date: Tue, 7 Jun 2016 12:18:52 +0200 Subject: [vtkusers] Texture problems with vtkClipPolyData Message-ID: Hello everyone! I?m using vtkClipPolyData to cut a poly data into two parts. Everything works like a charm but the textures. As you can see on the picture attached, there are some problems/artifacts appearing on the model after the clipping. After some research, I still have no idea where it comes from. Furthermore, these problems also occur when I?m trying to copy/paste the texture coordinates from a model to another. If you have any idea, please tell me. Thank you in advance for your help! Bruno G -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ClipTextureProblem.jpg Type: image/jpeg Size: 92335 bytes Desc: not available URL: From lackodan at outlook.com Tue Jun 7 06:47:20 2016 From: lackodan at outlook.com (D L) Date: Tue, 7 Jun 2016 12:47:20 +0200 Subject: [vtkusers] Debugging VTK in Python - finding exact class of VTK object Message-ID: Hi everyone, I'm having some trouble using VTK in Python and I was wondering if there is any way to find out the exact class of a VTK object. For example, in this particular case I'd like to verify that the output of a vtkNIFTIImageReader.GetOutput() is indeed a vtkImageData (for debugging purposes), but when I do type(niftiReader.GetOutput()) I get . It seems like it's the same for all VTK objects. Is there any other python or VTK function I can use? Kind regards, Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: From aborsic at ne-scientific.com Tue Jun 7 06:55:02 2016 From: aborsic at ne-scientific.com (Andrea Borsic) Date: Tue, 7 Jun 2016 12:55:02 +0200 Subject: [vtkusers] Texture problems with vtkClipPolyData In-Reply-To: <20160607101853.1AC2CF31D3@public.kitware.com> References: <20160607101853.1AC2CF31D3@public.kitware.com> Message-ID: Hi Bruno, This has probably to do with how the vtkClipPolyData handles the texture coordinates of the dataset you are clipping. As an alternative, you can try clipping your dataset with vtkBooleanOperationPolyDataFilter (more info http://www.vtkjournal.org/browse/publication/797) (I guess you will need to use a triangulated box and not a plane for clipping in this case) Perhaps you might have better luck ! Best, Andrea On 07-Jun-16 12:18 PM, Bruno Gr?goire wrote: > > Hello everyone! > > I?m using vtkClipPolyData to cut a poly data into two parts. > Everything works like a charm but the textures. > > As you can see on the picture attached, there are some > problems/artifacts appearing on the model after the clipping. After > some research, I still have no idea where it comes from. Furthermore, > these problems also occur when I?m trying to copy/paste the texture > coordinates from a model to another. > > If you have any idea, please tell me. > > Thank you in advance for your help! > > Bruno G > > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- ++++++++++++++++++++++++++++++++++++ Andrea Borsic Ph.D. CEO & Founder NE Scientific LLC Tel: +1 603 676 7450 Web: www.ne-scientific.com Twitter: https://twitter.com/ne_scientific -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Tue Jun 7 08:41:29 2016 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 7 Jun 2016 08:41:29 -0400 Subject: [vtkusers] VR in VTK In-Reply-To: <1465061216546-5738557.post@n5.nabble.com> References: <1465061216546-5738557.post@n5.nabble.com> Message-ID: I have not tried it and I suspect it would take some effort. I'm not sure if OpenVR run on iOS for example and you would need that as a starting point. On Sat, Jun 4, 2016 at 1:26 PM, YassminAbdallah wrote: > Hello, > > > i just read the article posted in kitware blog about VR in VTK, and i was > asking if ?vtkOpenVR? available also for VTK iOS framework ?? > > if yes could you please explain the steps i needed to integrate it with the > iOS VTK framework i have? also does it need a specific VR glasses ?? or > any > brand will be okay ? (if i use google VR glasses for example does that will > be okay) > > > Thanks a lot, > Yassmin > > > > > -- > View this message in context: > http://vtk.1045678.n5.nabble.com/VR-in-VTK-tp5738557.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.boeckel at kitware.com Tue Jun 7 09:24:27 2016 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Tue, 7 Jun 2016 09:24:27 -0400 Subject: [vtkusers] Debugging VTK in Python - finding exact class of VTK object In-Reply-To: References: Message-ID: <20160607132427.GA20995@megas.kitware.com> On Tue, Jun 07, 2016 at 12:47:20 +0200, D L wrote: > Is there any other python or VTK function I can use? There should be a `GetClassName()` method you can use. --Ben From matimontg at gmail.com Tue Jun 7 09:34:53 2016 From: matimontg at gmail.com (Matias Montroull) Date: Tue, 07 Jun 2016 13:34:53 +0000 Subject: [vtkusers] Obtain bone missing on patient head | Dicom Message-ID: Hi, We have a 3D printer which we plan to use to build missing parts of bones after head surgery for skull repair/replacement. For that task we also plan to use VTK to extract the missing parts of the bone. We tried registering the patient head against the same patient head but flipped in X axis (using ITK) then use the subtract module in VTK to try to obtain just the bone that was missing but the results were not so good. Is there a way to accomplish this using VTK or any combination of VTK and other tools? Thanks, Matias. -- Matias -------------- next part -------------- An HTML attachment was scrubbed... URL: From lackodan at outlook.com Tue Jun 7 09:39:33 2016 From: lackodan at outlook.com (D L) Date: Tue, 7 Jun 2016 15:39:33 +0200 Subject: [vtkusers] Debugging VTK in Python - finding exact class of VTK object In-Reply-To: <20160607132427.GA20995@megas.kitware.com> References: , <20160607132427.GA20995@megas.kitware.com> Message-ID: Thanks a lot, I never knew that method existed! Works perfectly. (The output is indeed a vtkImageData. Now to figure out why my application crashes when I try to use it as input to any vtkImageAlgorithm... But I'll start a new question for that if necessary.) > Date: Tue, 7 Jun 2016 09:24:27 -0400 > From: ben.boeckel at kitware.com > To: lackodan at outlook.com > CC: vtkusers at vtk.org > Subject: Re: [vtkusers] Debugging VTK in Python - finding exact class of VTK object > > On Tue, Jun 07, 2016 at 12:47:20 +0200, D L wrote: > > Is there any other python or VTK function I can use? > > There should be a `GetClassName()` method you can use. > > --Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Jun 7 09:40:50 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 7 Jun 2016 07:40:50 -0600 Subject: [vtkusers] Debugging VTK in Python - finding exact class of VTK object In-Reply-To: <20160607132427.GA20995@megas.kitware.com> References: <20160607132427.GA20995@megas.kitware.com> Message-ID: On Tue, Jun 7, 2016 at 7:24 AM, Ben Boeckel wrote: > On Tue, Jun 07, 2016 at 12:47:20 +0200, D L wrote: > > Is there any other python or VTK function I can use? > > There should be a `GetClassName()` method you can use. > And in VTK 7, each VTK class is its own Python type: type(vtkImageData()) - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From lackodan at outlook.com Tue Jun 7 09:54:53 2016 From: lackodan at outlook.com (D L) Date: Tue, 7 Jun 2016 15:54:53 +0200 Subject: [vtkusers] Debugging VTK in Python - finding exact class of VTK object In-Reply-To: References: <20160607132427.GA20995@megas.kitware.com>, Message-ID: Good to know, thanks! I probably should've mentioned I'm using VTK 6.3. Looking forward to trying VTK 7, seems like there are a lot of interesting changes, but for now I have to stick to the version that comes bundled with Anaconda. ~ Daniel From: david.gobbi at gmail.com Date: Tue, 7 Jun 2016 07:40:50 -0600 Subject: Re: [vtkusers] Debugging VTK in Python - finding exact class of VTK object To: lackodan at outlook.com CC: vtkusers at vtk.org On Tue, Jun 7, 2016 at 7:24 AM, Ben Boeckel wrote: On Tue, Jun 07, 2016 at 12:47:20 +0200, D L wrote: > Is there any other python or VTK function I can use? There should be a `GetClassName()` method you can use. And in VTK 7, each VTK class is its own Python type: type(vtkImageData()) - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From lackodan at outlook.com Tue Jun 7 10:22:27 2016 From: lackodan at outlook.com (D L) Date: Tue, 7 Jun 2016 16:22:27 +0200 Subject: [vtkusers] VTK6.3 runtime crash when using vtkImageData as input for vtkImageAlgorithm Message-ID: Hi again, I have another question. I'm using VTK 6.3 in Python 2.7, and every time I try to use an object of type vtkImageData as input for an vtkImageAlgorithm, it crashes, saying "This application has requested the Runtime to terminate it in an unusual way". Here's a minimal example reading and writing a NIFTI-file: niftiReader = vtk.vtkNIFTIImageReader() niftiReader.SetFileName("c4ICBM_MNI_0103.nii") niftiWriter = vtk.vtkNIFTIImageWriter() niftiWriter.SetFileName("output.nii") # niftiWriter.SetInputConnection(niftiReader.GetOutputPort()) # this works niftiWriter.SetInputData(niftiReader.GetOutput()) # this causes a crash niftiWriter.Write() The file I'm using can be downloaded here: https://onedrive.live.com/redir?resid=C74503A42DE708!3266&authkey=!AGdR2dDTvYntgYc&ithint=file%2cnii As far as I understand, niftiReader.GetOutput() returns a vtkImageData (which is a vtkDataObject) and vtkNIFTIWriter.GetInputData() should take a vtkDataObject as input. Could anyone help me understand what's going on? Please let me know if you need any more info. Cheers, Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Jun 7 10:48:08 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 7 Jun 2016 08:48:08 -0600 Subject: [vtkusers] VTK6.3 runtime crash when using vtkImageData as input for vtkImageAlgorithm In-Reply-To: References: Message-ID: On Tue, Jun 7, 2016 at 8:22 AM, D L wrote: > > As far as I understand, niftiReader.GetOutput() returns a vtkImageData > (which is a vtkDataObject) and vtkNIFTIWriter.GetInputData() should take a > vtkDataObject as input. > > Could anyone help me understand what's going on? Please let me know if you > need any more info. > The object returned by GetOutput() cannot be used until the reader's Update() method has been called. In comparison, x.SetInputConnection(y.GetOutputPort()) establishes a pipelined connection where y.Update() is automatically called when necessary. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From lackodan at outlook.com Tue Jun 7 11:29:28 2016 From: lackodan at outlook.com (D L) Date: Tue, 7 Jun 2016 17:29:28 +0200 Subject: [vtkusers] VTK6.3 runtime crash when using vtkImageData as input for vtkImageAlgorithm In-Reply-To: References: , Message-ID: Thanks again, that does the trick. I thought GetOutput() was also supposed to call Update() automatically. Out of curiosity, was this something that was introduced in VTK6? The last time I worked with VTK it with 5.10, and I remember using SetInput() without the intermediate Update()-s. I might be remembering wrong, of course. ~ Daniel From: david.gobbi at gmail.com Date: Tue, 7 Jun 2016 08:48:08 -0600 Subject: Re: [vtkusers] VTK6.3 runtime crash when using vtkImageData as input for vtkImageAlgorithm To: lackodan at outlook.com CC: vtkusers at vtk.org On Tue, Jun 7, 2016 at 8:22 AM, D L wrote: As far as I understand, niftiReader.GetOutput() returns a vtkImageData (which is a vtkDataObject) and vtkNIFTIWriter.GetInputData() should take a vtkDataObject as input. Could anyone help me understand what's going on? Please let me know if you need any more info. The object returned by GetOutput() cannot be used until the reader's Update()method has been called. In comparison, x.SetInputConnection(y.GetOutputPort()) establishes a pipelinedconnection where y.Update() is automatically called when necessary. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Jun 7 11:45:56 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 7 Jun 2016 09:45:56 -0600 Subject: [vtkusers] VTK6.3 runtime crash when using vtkImageData as input for vtkImageAlgorithm In-Reply-To: References: Message-ID: On Tue, Jun 7, 2016 at 9:29 AM, D L wrote: > Thanks again, that does the trick. I thought GetOutput() was also supposed > to call Update() automatically. > > Out of curiosity, was this something that was introduced in VTK6? The last > time I worked with VTK it with 5.10, and I remember using SetInput() > without the intermediate Update()-s. I might be remembering wrong, of > course. > Yes, this was one of the big changes introduced with VTK 6. In VTK 5, the SetInputConnection(), GetOutputPort() methods were introduced as the preferred way to create pipeline connections, and in VTK 6 the SetInput()/ GetOutput() methods were modified so that they don't create pipeline connections. I believe that this was all part of a big plan, but sometimes it's hard to tell ;) - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From papelibassesow at hotmail.com Tue Jun 7 11:46:21 2016 From: papelibassesow at hotmail.com (Ergo) Date: Tue, 7 Jun 2016 08:46:21 -0700 (MST) Subject: [vtkusers] VtkImplicitModeller Issue Message-ID: <1465314381748-5738594.post@n5.nabble.com> Hello, We would like to make a dilation of a 3D Mesh. For that we use the vtkImplicitModeller with the following parameters : vtkSmartPointer implicitModeller = vtkSmartPointer::New(); implicitModeller->SetProcessModeToPerVoxel(); implicitModeller->SetSampleDimensions(50, 50, 50); #if VTK_MAJOR_VERSION <= 5 implicitModeller->SetInput(inputPolyData_); #else implicitModeller->SetInputData(inputPolyData_); #endif implicitModeller->AdjustBoundsOn(); implicitModeller->SetAdjustDistance(threshold); if(2*threshold > 1.0) implicitModeller->SetMaximumDistance(1.0); else implicitModeller->SetMaximumDistance(2*threshold); implicitModeller->ComputeModelBounds(inputPolyData_); implicitModeller->Update(); However, once the dilation is executer, we obtain a mesh of point with both a dilation toward the outside of the model and toward the inside. For example, when using a cylinder, we got as result a cylinder which bigger around the original model (which is the result we expected) but we also have a smaller cylinder generated inside the base model used for the transformation. We would like to know if there is a way to configure the ImplicitModeller to avoid the generation of this sub cylinder. The following picture depict the result : The black mesh is the result of the dilation which is good, the red mesh is the original cylinder and the blue small cylinder the dilation generated toward the inside of the original cylinder which is what we want to avoid -- View this message in context: http://vtk.1045678.n5.nabble.com/VtkImplicitModeller-Issue-tp5738594.html Sent from the VTK - Users mailing list archive at Nabble.com. From s225251 at studenti.polito.it Wed Jun 8 04:45:32 2016 From: s225251 at studenti.polito.it (=?utf-8?Q?Bruno_Gr=C3=A9goire?=) Date: Wed, 8 Jun 2016 10:45:32 +0200 Subject: [vtkusers] Texture problems with vtkClipPolyData In-Reply-To: References: <20160607101853.1AC2CF31D3@public.kitware.com> Message-ID: Thank you Andrea, I will try to use vtkBooleanOperationPolyDataFilter for the clipping. The problem is that I have the same artifacts appearing when I try to copy/paste the texture coordinates from a model to another (see jpg attached). To do that I get the texture coordinates of the source model (GetTCoords). Then for each point of the other model, I give it the texture coordinates of the closest point in the source model. The result is pretty good but for these ??cracks??. Do you have any idea about that? Thanks in advance, Bruno De?: Andrea Borsic Envoy? le?:mardi 7 juin 2016 12:55 ??: vtkusers at vtk.org Objet?:Re: [vtkusers] Texture problems with vtkClipPolyData Hi Bruno, This has probably to do with how the vtkClipPolyData handles the texture coordinates of the dataset you are clipping. As an alternative, you can try clipping your dataset with vtkBooleanOperationPolyDataFilter (more info http://www.vtkjournal.org/browse/publication/797) (I guess you will need to use a triangulated box and not a plane for clipping in this case) Perhaps you might have better luck ! Best, Andrea On 07-Jun-16 12:18 PM, Bruno Gr?goire wrote: Hello everyone! ? I?m using vtkClipPolyData to cut a poly data into two parts. Everything works like a charm but the textures. As you can see on the picture attached, there are some problems/artifacts appearing on the model after the clipping. After some research, I still have no idea where it comes from. Furthermore, these problems also occur when I?m trying to copy/paste the texture coordinates from a model to another. If you have any idea, please tell me. Thank you in advance for your help! ? Bruno G ? _______________________________________________ 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 Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/vtkusers -- ++++++++++++++++++++++++++++++++++++ Andrea Borsic Ph.D. CEO & Founder NE Scientific LLC Tel: +1 603 676 7450 Web: www.ne-scientific.com Twitter: https://twitter.com/ne_scientific -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TextureProblem2.JPG Type: image/jpeg Size: 33086 bytes Desc: not available URL: From lukas.schulte at mpibpc.mpg.de Wed Jun 8 07:32:09 2016 From: lukas.schulte at mpibpc.mpg.de (Schulte, Lukas) Date: Wed, 8 Jun 2016 11:32:09 +0000 Subject: [vtkusers] Widget moving Problem with QWidgets containing vtkRenderer on OSX Message-ID: Hey everyone, I'm currently porting a Linux/Windows Software to OSX 10.11, using C++, Qt5.6, VTK 7.0 and compiling using XCode 7.2 . Also I built the project using CMake. In one of the windows in an MDIArea I'm seeing a strange kind of behavior when the window is moved around : https://gfycat.com/DeficientHatefulGeese To me that looks like a problem with refreshing/updating maybe? The structure of the widget is the following: MainWidget(The one being moved around in the gif): class ImageViewerWidget: public QMainWindow, public AbstractWidget ImageViewerWidgets contains a QStackedWidget where the separate Widgets are added to. The problematic widget containing vtk : class ImageVtkHaloWidget : public QWidget This Widget is setup like this: QVTKWidget *_vtk = new QVTKWidget(this, QFlag(0)); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(_vtk); Till that point everything works fine, but if a renderer is set the weird behavior of the gif can be seen: vtkRenderer* _renderer = vtkRenderer::New(); _vtk->GetRenderWindow()->AddRenderer(_renderer); It's not a problem with rendering in general as the rendering of the stuff inside the viewer works fine if the window is held still, just the moving around oft he widget results in weird behavior of the whole Widget. I couldn't find anything about the reasons for these problems, so I figured I'd turn to people here for help. Has anyone ever seen something like this? If more information about my system or more code is needed, I'll gladly provide it of course. Cheers, Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From lackodan at outlook.com Wed Jun 8 10:52:19 2016 From: lackodan at outlook.com (D L) Date: Wed, 8 Jun 2016 16:52:19 +0200 Subject: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter Message-ID: Hello again! Today, I'm having some trouble understanding how to use vtkConnectivityFilter in python 2.7 and VTK6.3. I've consulted a number of resources and examples, including: http://www.vtk.org/doc/nightly/html/classvtkConnectivityFilter.html http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/ColorDisconnectedRegions http://public.kitware.com/pipermail/vtkusers/2014-October/085430.html http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Common/DataModel/Testing/Python/scalarConn.py http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/Extraction/Testing/Python/extractUGrid.py However, I still can't figure out how to use the filter. I have a number of operations in mind, but let's start with extracting the largest region. From the available documentation, I assumed that this could be done by using vtkConnectivityFilter.SetExtractionModeToLargestRegion(). However, when I apply this to a (segmented and thresholded) MRI image to remove some noise, it just extracts the entire image. On the other hand, if I convert it to a surface first, using vtkMarchingCubes, and then apply a vtkPolyDataConnectivityFilter, that does give me the expected result... Here's a minimal example I'm using to test and compare: import vtk niftiReader = vtk.vtkNIFTIImageReader() niftiReader.SetFileName("test/MNI_0103-thresholded.nii") niftiReader.Update() thresholdedImage = niftiReader.GetOutput() # vtkConnectivityFilter - doesn't work connectivity = vtk.vtkConnectivityFilter() connectivity.SetInputData(thresholdedImage) connectivity.SetExtractionModeToLargestRegion() connectivity.Update() print("\nvtkConnectivityFilter number of extracted regions: " + str(connectivity.GetNumberOfExtractedRegions())) # outputs 1 # Connectivity filter produces an unstructured grid; convert back # to image data for further use. probeFilter = vtk.vtkProbeFilter() probeFilter.SetSourceConnection(connectivity.GetOutputPort()) probeFilter.SetInputData(thresholdedImage) probeFilter.Update() marchingCubes = vtk.vtkMarchingCubes() marchingCubes.SetInputConnection(probeFilter.GetOutputPort()) marchingCubes.GenerateValues(1,1,1) # input was thresholded with 1 as output value marchingCubes.Update() stlWriter = vtk.vtkSTLWriter() stlWriter.SetInputConnection(marchingCubes.GetOutputPort()) stlWriter.SetFileName("test/MNI_0103-vtkConnectivityFilter-largestRegion.stl") stlWriter.Write() # vtkPolyDataConnectivityFilter - works as expected marchingCubes2 = vtk.vtkMarchingCubes() marchingCubes2.SetInputData(thresholdedImage) marchingCubes2.GenerateValues(1,1,1) marchingCubes2.Update() connectivity2 = vtk.vtkPolyDataConnectivityFilter() connectivity2.SetInputConnection(marchingCubes2.GetOutputPort()) connectivity2.SetExtractionModeToLargestRegion() connectivity2.Update() print("\nvtkPolyDataConnectivityFilter number of extracted regions: " + str(connectivity2.GetNumberOfExtractedRegions())) # outputs 1673 stlWriter2 = vtk.vtkSTLWriter() stlWriter2.SetInputConnection(connectivity2.GetOutputPort()) stlWriter2.SetFileName("test/MNI_0103-vtkPolyDataConnectivityFilter-largestRegion.stl") stlWriter2.Write() The input volume can downloaded here: https://onedrive.live.com/redir?resid=C74503A42DE708!3267&authkey=!AMjKnLDNfJzYxGo&ithint=file%2cnii The end result when using vtkConnectivityFilter: https://onedrive.live.com/redir?resid=C74503A42DE708!3269&authkey=!ACgeZNYmu0yYYTQ&ithint=file%2cstl The end result when using vtkPolyDataConnectivityFilter: https://onedrive.live.com/redir?resid=C74503A42DE708!3268&authkey=!ADAeoPw8O09APE8&ithint=file%2cstl The reason I want to apply the connectivity filter before surface extraction is that I would like to so some other morphological operations on the image first (e.g. closing and flood fill). At first, I assumed it might have something to do with scalar connectivity, but using vtkConnectivityFilter.SetScalarConnectivityOff() didn't change anything. Could someone with a better understanding of VTK please explain? Kind regards, Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: From pkorir at ebi.ac.uk Wed Jun 8 11:00:10 2016 From: pkorir at ebi.ac.uk (Paul Kibet Korir) Date: Wed, 8 Jun 2016 16:00:10 +0100 Subject: [vtkusers] Mesh from contours using vtkRuledSurfaceFilter Message-ID: <1c9ed0b2-9f9e-5b54-f400-6c6ddc6ccf47@ebi.ac.uk> Hellos, The vtkRuledSurfaceFilter documentation states that this filter "...can also be used to create surfaces from contours". Can someone please share an example on how this can be achieved? I've tried many things to no avail. -- With kind regards, *Dr. Paul K Korir, PhD* /Scientific Programmer/ EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 8 11:06:14 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 8 Jun 2016 09:06:14 -0600 Subject: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter In-Reply-To: References: Message-ID: Hi Daniel, Within VTK proper, there's the vtkImageThresholdConnectivity filter, but it requires you to seed the regions you want, it can't just give you the largest: http://www.vtk.org/doc/nightly/html/classvtkImageThresholdConnectivity.html I have a better filter called simply "vtkImageConnectivityFilter", but it hasn't made its way into VTK yet: https://github.com/dgobbi/AIRS/blob/master/ImageSegmentation/vtkImageConnectivityFilter.h - David On Wed, Jun 8, 2016 at 8:52 AM, D L wrote: > Hello again! > > Today, I'm having some trouble understanding how to use > vtkConnectivityFilter in python 2.7 and VTK6.3. I've consulted a number of > resources and examples, including: > > http://www.vtk.org/doc/nightly/html/classvtkConnectivityFilter.html > > http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/ColorDisconnectedRegions > http://public.kitware.com/pipermail/vtkusers/2014-October/085430.html > > http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion > > http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Common/DataModel/Testing/Python/scalarConn.py > > http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion > > http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion > > http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/Extraction/Testing/Python/extractUGrid.py > > However, I still can't figure out how to use the filter. I have a number > of operations in mind, but let's start with extracting the largest region. > From the available documentation, I assumed that this could be done by > using vtkConnectivityFilter.SetExtractionModeToLargestRegion(). However, > when I apply this to a (segmented and thresholded) MRI image to remove some > noise, it just extracts the entire image. On the other hand, if I convert > it to a surface first, using vtkMarchingCubes, and then apply a > vtkPolyDataConnectivityFilter, that does give me the expected result... > > Here's a minimal example I'm using to test and compare: > > import vtk > > niftiReader = vtk.vtkNIFTIImageReader() > niftiReader.SetFileName("test/MNI_0103-thresholded.nii") > niftiReader.Update() > thresholdedImage = niftiReader.GetOutput() > > # vtkConnectivityFilter - doesn't work > connectivity = vtk.vtkConnectivityFilter() > connectivity.SetInputData(thresholdedImage) > connectivity.SetExtractionModeToLargestRegion() > connectivity.Update() > > print("\nvtkConnectivityFilter number of extracted regions: " + > str(connectivity.GetNumberOfExtractedRegions())) > # outputs 1 > > # Connectivity filter produces an unstructured grid; convert back > # to image data for further use. > probeFilter = vtk.vtkProbeFilter() > probeFilter.SetSourceConnection(connectivity.GetOutputPort()) > probeFilter.SetInputData(thresholdedImage) > probeFilter.Update() > > marchingCubes = vtk.vtkMarchingCubes() > marchingCubes.SetInputConnection(probeFilter.GetOutputPort()) > marchingCubes.GenerateValues(1,1,1) # input was thresholded with 1 as > output value > marchingCubes.Update() > > stlWriter = vtk.vtkSTLWriter() > stlWriter.SetInputConnection(marchingCubes.GetOutputPort()) > > stlWriter.SetFileName("test/MNI_0103-vtkConnectivityFilter-largestRegion.stl") > stlWriter.Write() > > > # vtkPolyDataConnectivityFilter - works as expected > marchingCubes2 = vtk.vtkMarchingCubes() > marchingCubes2.SetInputData(thresholdedImage) > marchingCubes2.GenerateValues(1,1,1) > marchingCubes2.Update() > > connectivity2 = vtk.vtkPolyDataConnectivityFilter() > connectivity2.SetInputConnection(marchingCubes2.GetOutputPort()) > connectivity2.SetExtractionModeToLargestRegion() > connectivity2.Update() > > print("\nvtkPolyDataConnectivityFilter number of extracted regions: " + > str(connectivity2.GetNumberOfExtractedRegions())) > # outputs 1673 > > stlWriter2 = vtk.vtkSTLWriter() > stlWriter2.SetInputConnection(connectivity2.GetOutputPort()) > > stlWriter2.SetFileName("test/MNI_0103-vtkPolyDataConnectivityFilter-largestRegion.stl") > stlWriter2.Write() > > The input volume can downloaded here: > https://onedrive.live.com/redir?resid=C74503A42DE708!3267&authkey=!AMjKnLDNfJzYxGo&ithint=file%2cnii > The end result when using vtkConnectivityFilter: > https://onedrive.live.com/redir?resid=C74503A42DE708!3269&authkey=!ACgeZNYmu0yYYTQ&ithint=file%2cstl > The end result when using vtkPolyDataConnectivityFilter: > https://onedrive.live.com/redir?resid=C74503A42DE708!3268&authkey=!ADAeoPw8O09APE8&ithint=file%2cstl > > The reason I want to apply the connectivity filter before surface > extraction is that I would like to so some other morphological operations > on the image first (e.g. closing and flood fill). At first, I assumed it > might have something to do with scalar connectivity, but using > vtkConnectivityFilter.SetScalarConnectivityOff() didn't change anything. > > Could someone with a better understanding of VTK please explain? > > Kind regards, > > Daniel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Wed Jun 8 11:14:42 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Wed, 8 Jun 2016 17:14:42 +0200 Subject: [vtkusers] Widget moving Problem with QWidgets containing vtkRenderer on OSX In-Reply-To: References: Message-ID: Lukas, Yes, folks have seen this kind of behavior in other applications that use VTK with Qt 5.x on OS X. The problem has yet to be identified, but should hopefully be resolved in the near future. Cory On Wed, Jun 8, 2016 at 1:32 PM, Schulte, Lukas wrote: > Hey everyone, > > > > I?m currently porting a Linux/Windows Software to OSX 10.11, using C++, > Qt5.6, VTK 7.0 and compiling using XCode 7.2 . Also I built the project > using CMake. > > > > In one of the windows in an MDIArea I?m seeing a strange kind of behavior > when the window is moved around : > > > > https://gfycat.com/DeficientHatefulGeese > > > > To me that looks like a problem with refreshing/updating maybe? > > > > The structure of the widget is the following: > > > > MainWidget(The one being moved around in the gif): > > class ImageViewerWidget: public QMainWindow, public AbstractWidget > > > > ImageViewerWidgets contains a QStackedWidget where the separate Widgets > are added to. > > > > The problematic widget containing vtk : > > class ImageVtkHaloWidget : public QWidget > > > > This Widget is setup like this: > > QVTKWidget *_vtk = new QVTKWidget(this, QFlag(0)); > > QVBoxLayout *layout = new QVBoxLayout; > > layout->addWidget(_vtk); > > > > Till that point everything works fine, but if a renderer is set the weird > behavior of the gif can be seen: > > > > vtkRenderer* _renderer = vtkRenderer::New(); > > _vtk->GetRenderWindow()->AddRenderer(_renderer); > > > > It?s not a problem with rendering in general as the rendering of the stuff > inside the viewer works fine if the window is held still, just the moving > around oft he widget results in weird behavior of the whole Widget. > > > > I couldn?t find anything about the reasons for these problems, so I figured > I?d turn to people here for help. Has anyone ever seen something like this? > If more information about my system or more code is needed, I?ll gladly > provide it of course. > > > > Cheers, > > > > Lukas > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -- Cory Quammen R&D Engineer Kitware, Inc. From lackodan at outlook.com Wed Jun 8 11:56:57 2016 From: lackodan at outlook.com (D L) Date: Wed, 8 Jun 2016 17:56:57 +0200 Subject: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter In-Reply-To: References: , Message-ID: Hi David, First of all, it's amazing how fast you and the other contributers on this list respond. Thanks for making the time! While your filter does indeed look better (and even has comprehensive comments explaining each step), I suspect it would not be easy to use with my precompiled VTK-version in Anaconda. If I'm not mistaking, to use custom VTK classes, you need a custom VTK build, right? I don't think that will be possible. I'm on a tight time schedule (I need to finish my current project ASAP so I have a chance at finishing my PhD thesis before August) and I only have a basic image processing background, so I'm currrently looking for the fastest and easiest solution. This might be a very obvious question, but with vtkImageConnectivityFilter, how would I know which seed point to use? Should I look at the image in Paraview (or use a vtkPicker) to find the coordinates of the region I'd like to extract? Kind regards, Daniel From: david.gobbi at gmail.com Date: Wed, 8 Jun 2016 09:06:14 -0600 Subject: Re: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter To: lackodan at outlook.com CC: vtkusers at vtk.org Hi Daniel, Within VTK proper, there's the vtkImageThresholdConnectivity filter, but itrequires you to seed the regions you want, it can't just give you the largest:http://www.vtk.org/doc/nightly/html/classvtkImageThresholdConnectivity.html I have a better filter called simply "vtkImageConnectivityFilter", but it hasn'tmade its way into VTK yet:https://github.com/dgobbi/AIRS/blob/master/ImageSegmentation/vtkImageConnectivityFilter.h - David On Wed, Jun 8, 2016 at 8:52 AM, D L wrote: Hello again! Today, I'm having some trouble understanding how to use vtkConnectivityFilter in python 2.7 and VTK6.3. I've consulted a number of resources and examples, including: http://www.vtk.org/doc/nightly/html/classvtkConnectivityFilter.html http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/ColorDisconnectedRegions http://public.kitware.com/pipermail/vtkusers/2014-October/085430.html http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Common/DataModel/Testing/Python/scalarConn.py http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion http://www.vtk.org/Wiki/VTK/Examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/Extraction/Testing/Python/extractUGrid.py However, I still can't figure out how to use the filter. I have a number of operations in mind, but let's start with extracting the largest region. From the available documentation, I assumed that this could be done by using vtkConnectivityFilter.SetExtractionModeToLargestRegion(). However, when I apply this to a (segmented and thresholded) MRI image to remove some noise, it just extracts the entire image. On the other hand, if I convert it to a surface first, using vtkMarchingCubes, and then apply a vtkPolyDataConnectivityFilter, that does give me the expected result... Here's a minimal example I'm using to test and compare: import vtk niftiReader = vtk.vtkNIFTIImageReader() niftiReader.SetFileName("test/MNI_0103-thresholded.nii") niftiReader.Update() thresholdedImage = niftiReader.GetOutput() # vtkConnectivityFilter - doesn't work connectivity = vtk.vtkConnectivityFilter() connectivity.SetInputData(thresholdedImage) connectivity.SetExtractionModeToLargestRegion() connectivity.Update() print("\nvtkConnectivityFilter number of extracted regions: " + str(connectivity.GetNumberOfExtractedRegions())) # outputs 1 # Connectivity filter produces an unstructured grid; convert back # to image data for further use. probeFilter = vtk.vtkProbeFilter() probeFilter.SetSourceConnection(connectivity.GetOutputPort()) probeFilter.SetInputData(thresholdedImage) probeFilter.Update() marchingCubes = vtk.vtkMarchingCubes() marchingCubes.SetInputConnection(probeFilter.GetOutputPort()) marchingCubes.GenerateValues(1,1,1) # input was thresholded with 1 as output value marchingCubes.Update() stlWriter = vtk.vtkSTLWriter() stlWriter.SetInputConnection(marchingCubes.GetOutputPort()) stlWriter.SetFileName("test/MNI_0103-vtkConnectivityFilter-largestRegion.stl") stlWriter.Write() # vtkPolyDataConnectivityFilter - works as expected marchingCubes2 = vtk.vtkMarchingCubes() marchingCubes2.SetInputData(thresholdedImage) marchingCubes2.GenerateValues(1,1,1) marchingCubes2.Update() connectivity2 = vtk.vtkPolyDataConnectivityFilter() connectivity2.SetInputConnection(marchingCubes2.GetOutputPort()) connectivity2.SetExtractionModeToLargestRegion() connectivity2.Update() print("\nvtkPolyDataConnectivityFilter number of extracted regions: " + str(connectivity2.GetNumberOfExtractedRegions())) # outputs 1673 stlWriter2 = vtk.vtkSTLWriter() stlWriter2.SetInputConnection(connectivity2.GetOutputPort()) stlWriter2.SetFileName("test/MNI_0103-vtkPolyDataConnectivityFilter-largestRegion.stl") stlWriter2.Write() The input volume can downloaded here: https://onedrive.live.com/redir?resid=C74503A42DE708!3267&authkey=!AMjKnLDNfJzYxGo&ithint=file%2cnii The end result when using vtkConnectivityFilter: https://onedrive.live.com/redir?resid=C74503A42DE708!3269&authkey=!ACgeZNYmu0yYYTQ&ithint=file%2cstl The end result when using vtkPolyDataConnectivityFilter: https://onedrive.live.com/redir?resid=C74503A42DE708!3268&authkey=!ADAeoPw8O09APE8&ithint=file%2cstl The reason I want to apply the connectivity filter before surface extraction is that I would like to so some other morphological operations on the image first (e.g. closing and flood fill). At first, I assumed it might have something to do with scalar connectivity, but using vtkConnectivityFilter.SetScalarConnectivityOff() didn't change anything. Could someone with a better understanding of VTK please explain? Kind regards, Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 8 12:13:53 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 8 Jun 2016 10:13:53 -0600 Subject: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter In-Reply-To: References: Message-ID: On Wed, Jun 8, 2016 at 9:56 AM, D L wrote: > Hi David, > > First of all, it's amazing how fast you and the other contributers on this > list respond. Thanks for making the time! > You're welcome. Your experience is not universal, though, lots of questions on this list go unanswered. If I'm not mistaking, to use custom VTK classes, you need a custom VTK > build, right? > Yup. > This might be a very obvious question, but with > vtkImageConnectivityFilter, how would I know which seed point to use? > Should I look at the image in Paraview (or use a vtkPicker) to find the > coordinates of the region I'd like to extract? > You mean vtkImageThresholdConnectivity? Yes, you could use a picker to get the data coordinates (these are the coordinates measured in mm, not the i,j,k location of the voxel). Or, if you're lucky enough to know that the region will always include the point at the center of the image, you can use the coords of that point as a seed. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From saeedbakhshmand at gmail.com Wed Jun 8 15:48:23 2016 From: saeedbakhshmand at gmail.com (Saeed Mahdizadeh Bakhshmand) Date: Wed, 8 Jun 2016 15:48:23 -0400 Subject: [vtkusers] vtkpoints --- getpoints example Message-ID: Hello, I am trying to copy a group of point coordinates from one vtkPoints to another vtkPoints. I initially used GetPoint(id) in a for loop, but in order to optimize my code and speed up its execution, I am trying to avoid nested loops and as a result I hope to use GetPoints(ptId,fp) but couldn't figure out what fp should be? Regards, Saeed -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Wed Jun 8 16:13:42 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Wed, 8 Jun 2016 22:13:42 +0200 Subject: [vtkusers] Widget moving Problem with QWidgets containing vtkRenderer on OSX In-Reply-To: <988D97F1-DFB4-4DA9-9957-BFA3DB6C1EEE@mpibpc.mpg.de> References: <988D97F1-DFB4-4DA9-9957-BFA3DB6C1EEE@mpibpc.mpg.de> Message-ID: Hi Lukas, I believe qvtkwidget2 is the future, but as far as I know it doesn't solve the problem. If you wanted to try it out and report back if it works with Qt 5.x, that would be great. Someone else with more knowledge about this issue may be able to jump in here to let you know more details than I can provide. Thanks, Cory On Wed, Jun 8, 2016 at 7:25 PM, Schulte, Lukas wrote: > Hey Cory, > > Thanks for the fast reply. Are there any known workarounds like switching to qvtkwidget2 or something similar ? And can I be of any help in identifying or resolving this issue? > Cheers, > Lukas > > >> On 08 Jun 2016, at 17:14, Cory Quammen wrote: >> >> Lukas, >> >> Yes, folks have seen this kind of behavior in other applications that >> use VTK with Qt 5.x on OS X. The problem has yet to be identified, but >> should hopefully be resolved in the near future. >> >> Cory >> >> On Wed, Jun 8, 2016 at 1:32 PM, Schulte, Lukas >> wrote: >>> Hey everyone, >>> >>> >>> >>> I?m currently porting a Linux/Windows Software to OSX 10.11, using C++, >>> Qt5.6, VTK 7.0 and compiling using XCode 7.2 . Also I built the project >>> using CMake. >>> >>> >>> >>> In one of the windows in an MDIArea I?m seeing a strange kind of behavior >>> when the window is moved around : >>> >>> >>> >>> https://gfycat.com/DeficientHatefulGeese >>> >>> >>> >>> To me that looks like a problem with refreshing/updating maybe? >>> >>> >>> >>> The structure of the widget is the following: >>> >>> >>> >>> MainWidget(The one being moved around in the gif): >>> >>> class ImageViewerWidget: public QMainWindow, public AbstractWidget >>> >>> >>> >>> ImageViewerWidgets contains a QStackedWidget where the separate Widgets >>> are added to. >>> >>> >>> >>> The problematic widget containing vtk : >>> >>> class ImageVtkHaloWidget : public QWidget >>> >>> >>> >>> This Widget is setup like this: >>> >>> QVTKWidget *_vtk = new QVTKWidget(this, QFlag(0)); >>> >>> QVBoxLayout *layout = new QVBoxLayout; >>> >>> layout->addWidget(_vtk); >>> >>> >>> >>> Till that point everything works fine, but if a renderer is set the weird >>> behavior of the gif can be seen: >>> >>> >>> >>> vtkRenderer* _renderer = vtkRenderer::New(); >>> >>> _vtk->GetRenderWindow()->AddRenderer(_renderer); >>> >>> >>> >>> It?s not a problem with rendering in general as the rendering of the stuff >>> inside the viewer works fine if the window is held still, just the moving >>> around oft he widget results in weird behavior of the whole Widget. >>> >>> >>> >>> I couldn?t find anything about the reasons for these problems, so I figured >>> I?d turn to people here for help. Has anyone ever seen something like this? >>> If more information about my system or more code is needed, I?ll gladly >>> provide it of course. >>> >>> >>> >>> Cheers, >>> >>> >>> >>> Lukas >>> >>> >>> _______________________________________________ >>> 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 >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/vtkusers >> >> >> >> -- >> Cory Quammen >> R&D Engineer >> Kitware, Inc. -- Cory Quammen R&D Engineer Kitware, Inc. From saeedbakhshmand at gmail.com Wed Jun 8 17:17:04 2016 From: saeedbakhshmand at gmail.com (Saeed Mahdizadeh Bakhshmand) Date: Wed, 8 Jun 2016 17:17:04 -0400 Subject: [vtkusers] vtkpoints --- getpoints example In-Reply-To: References: Message-ID: Just an update and alternative solution that I found: I could figure to copy group of points directly from source vtkpoints to destination vtkPoints using InsertPoints and avoid GetPoints completely: des_pts.InsertPoints(dsStart,n,srcStart,src_pts) On Wed, Jun 8, 2016 at 3:48 PM, Saeed Mahdizadeh Bakhshmand < saeedbakhshmand at gmail.com> wrote: > Hello, > > I am trying to copy a group of point coordinates from one vtkPoints to > another vtkPoints. I initially used GetPoint(id) in a for loop, but in > order to optimize my code and speed up its execution, I am trying to avoid > nested loops and as a result I hope to use GetPoints(ptId,fp) but couldn't > figure out what fp should be? > > Regards, > Saeed > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From indienator at gmx.de Thu Jun 9 07:05:19 2016 From: indienator at gmx.de (Maximilian Dankbar) Date: Thu, 9 Jun 2016 13:05:19 +0200 Subject: [vtkusers] Use depth map from vtkShadowMapBakerPass Message-ID: An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Thu Jun 9 09:35:39 2016 From: ken.martin at kitware.com (Ken Martin) Date: Thu, 9 Jun 2016 09:35:39 -0400 Subject: [vtkusers] Use depth map from vtkShadowMapBakerPass In-Reply-To: References: Message-ID: Not sure if this helps (or is your issue) but the depth values are post light-camera perspective transform. To get them back into world coordinates you have to apply the inverse of that transform (or something simpler if you just want the world coordinate distance). It is a non-linear mapping. If you google zbuffer to world there are usually a number of hits that talk about this process. To do it you need the light-camera clipping range from the original matrix (around line 619 in the shadow map baker pass) Thanks Ken On Thu, Jun 9, 2016 at 7:05 AM, Maximilian Dankbar wrote: > Hi everyone, > > I try to use the depth maps generated by vtkShadowMapBakerPass to > determine which objects are occluded by other objects. To do that I > download the texture to an unsigned int array. > > However I can not figure out how to interpret the values within the map. > Normalizing with the clipping range values of the corresponding light > camera only works for one camera position. In that case the direction of > projection of the camera is (0, 1, 0). In all other cases that I tested the > near clipping range is far too low and the far clipping range probably too > high. > > Is there any other way to normalize the depth values? > > Thank you in advance for your help! > Max > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pkorir at ebi.ac.uk Thu Jun 9 12:00:37 2016 From: pkorir at ebi.ac.uk (Paul Kibet Korir) Date: Thu, 9 Jun 2016 17:00:37 +0100 Subject: [vtkusers] Mesh from contours using vtkRuledSurfaceFilter In-Reply-To: <1c9ed0b2-9f9e-5b54-f400-6c6ddc6ccf47@ebi.ac.uk> References: <1c9ed0b2-9f9e-5b54-f400-6c6ddc6ccf47@ebi.ac.uk> Message-ID: <4a65aac3-815c-47d1-cb3d-932d99b04c44@ebi.ac.uk> In case someone finds this useful... Source: http://www.paraview.org/Wiki/VTK/Examples/Python/PolyData/RuledSurfaceFilter Trick: vtkRuledSurfaceFilter requires the vtkPolyData it works on to have Lines (set with SetLines(cells) method) NOT Polygons --- import vtk # create a rendering window and renderer ren = vtk.vtkRenderer() ren.SetBackground(0.1, 0.2, 0.4) renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) renWin.FullScreenOn() # create a renderwindowinteractor iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera()) #Create the points fot the lines. points = vtk.vtkPoints() points.InsertPoint(0, 0, 0, 1) points.InsertPoint(1, 0, 0, 0) points.InsertPoint(2, 1, 0, 0) points.InsertPoint(3, 0, 1, 1) points.InsertPoint(4, 1, 1, 1) points.InsertPoint(5, 1, 1, 0) line1 = vtk.vtkPolyLine() line1.GetPointIds().SetNumberOfIds(3) line1.GetPointIds().SetId(0, 0) line1.GetPointIds().SetId(1, 1) line1.GetPointIds().SetId(2, 2) line2 = vtk.vtkPolyLine() line2.GetPointIds().SetNumberOfIds(3) line2.GetPointIds().SetId(0, 3) line2.GetPointIds().SetId(1, 4) line2.GetPointIds().SetId(2, 5) #Create a cellArray containing the lines lines =vtk.vtkCellArray() lines.InsertNextCell(line1) lines.InsertNextCell(line2) #Create the vtkPolyData to contain the points and cellArray with the lines polydata = vtk.vtkPolyData() polydata.SetPoints(points) polydata.SetLines(lines) print polydata #Create the ruledSurfaceFilter from the polydata containing the lines ruledSurfaceFilter = vtk.vtkRuledSurfaceFilter() ruledSurfaceFilter.SetInputData(polydata) ruledSurfaceFilter.SetResolution(21, 21) ruledSurfaceFilter.SetRuledModeToResample() ruledSurfaceFilter.Update() #Create the mapper with the ruledSufaceFilter as input mapper = vtk.vtkPolyDataMapper() mapper.SetInputData(ruledSurfaceFilter.GetOutput()) mapper.Update() #create the actor with the mapper actor = vtk.vtkActor() actor.SetMapper(mapper) #add the actor to the display ren.AddActor(actor) # enable user interface interactor iren.Initialize() renWin.Render() iren.Start() --- Regards, Paul On 08/06/2016 16:00, Paul Kibet Korir wrote: > > Hellos, > > The vtkRuledSurfaceFilter documentation > > states that this filter "...can also be used to create surfaces from > contours". > > Can someone please share an example on how this can be achieved? I've > tried many things to no avail. > > > -- > With kind regards, > > *Dr. Paul K Korir, PhD* > /Scientific Programmer/ > EMBL-EBI > Main Building, A2-35, > WTGC, Hinxton, Cambridge CB10 1SD > P: +44 1223 49 44 22 > F: +44 1223 49 44 68 > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- With kind regards, *Dr. Paul K Korir, PhD* /Scientific Programmer/ EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -------------- next part -------------- An HTML attachment was scrubbed... URL: From AlexUtrobin at yandex.ru Fri Jun 10 01:59:15 2016 From: AlexUtrobin at yandex.ru (AlexUtrobin) Date: Thu, 9 Jun 2016 22:59:15 -0700 (MST) Subject: [vtkusers] vtkCubeAxesActor setTitle string utf-8 Message-ID: <1465538355767-5738615.post@n5.nabble.com> I can not change the font and I can not show the Unicode text in vtkCubeAxesActor. The same actions with vtkTextActor work. What am I doing wrong? mCubeAxesActor=new vtkCubeAxesActor(); mCubeAxesActor.SetCamera(mRenderWindowPanel.GetRenderer().GetActiveCamera()); mCubeAxesActor.GetTitleTextProperty(0).SetColor(1.0, 0.0, 0.0); mCubeAxesActor.GetTitleTextProperty(0).SetFontFamily(4); //4-????? ?? ????? mCubeAxesActor.GetTitleTextProperty(0).SetFontFile(jarDir+"font.ttf"); mCubeAxesActor.SetXTitle("????? ?? ??????? ?????"); mActorTitle = new vtkTextActor(); mActorTitle.GetTextProperty().SetFontFamily(4); //4-????? ?? ????? mActorTitle.GetTextProperty().SetFontFile(jarDir+"font.ttf"); mActorTitle.GetTextProperty().SetFontSize(SizeTitle); mActorTitle.SetInput("????? ?? ??????? ?????"); -- View this message in context: http://vtk.1045678.n5.nabble.com/vtkCubeAxesActor-setTitle-string-utf-8-tp5738615.html Sent from the VTK - Users mailing list archive at Nabble.com. From coyarzunlaura at googlemail.com Fri Jun 10 05:22:48 2016 From: coyarzunlaura at googlemail.com (Cristina Oyarzun) Date: Fri, 10 Jun 2016 11:22:48 +0200 Subject: [vtkusers] MICCAI CLIP 2016: DEADLINE EXTENDED! Message-ID: CALL FOR PAPERS MICCAI 2016 Workshop on Clinical Image-based Procedures: Translational Research in Medical Imaging October 17, 2016 Athens, Greece Website:http://miccai-clip.org/ ============================== ========================================== SCOPE The outstanding proliferation of medical image applications has created a need for greater study and scrutiny of the clinical application and validation of such methods. New strategies are essential to ensure a smooth and effective translation of computational image-based techniques into the clinic. For these reasons CLIP 2015?s major focus is on translational research filling the gaps between basic science and clinical applications. A highlight of the workshop is the subject of strategies for personalized medicine to enhance diagnosis, treatment and interventions. Authors are encouraged to submit work centered on specific clinical applications, including techniques and procedures based on comprehensive clinical image data. Submissions related to applications already in use and evaluated by clinical users are particularly encouraged. The event will bring together world-class specialists to present ways to strengthen links between computer scientists and engineers, and clinicians. TOPICS *Strategies for patient-specific and anatomical modeling to support planning and interventions *Clinical studies employing advanced image-guided methods *Clinical translation and validation of image-guided systems *Current challenges and emerging techniques in image-based procedures *Identification of parameters and error analysis in image-based procedures *Multimodal image integration for modeling, planning and guidance *Clinical applications in open and minimally invasive procedures PAPER SUBMISSION Papers will be limited to eight pages following the MICCAI submission guidelines. Prospective authors should refer to the Paper Submission section on the workshop website for details on how to submit papers to be presented at the workshop. All submissions will be peer-reviewed by at least 2 members of the program committee. The selection of the papers will be based on the significance of results, novelty, technical merit, relevance and clarity of presentation. Papers will be presented in a day long single track workshop starting with plenary sessions. Accepted papers will be published as a proceedings volume in the Springer Lecture Notes in Computer Science (LNCS) series after the workshop. WORKSHOP FORMAT Accepted papers will be presented in a day long single track workshop. The final program will consist of invited speakers and original papers with time allocated for discussions. Electronic proceedings will be arranged for all of the papers presented at the workshop. IMPORTANT DATES * June 17, 2016: Paper submission due date * July 10, 2016: Notification of acceptance * July 17, 2016: Final camera-ready paper submission deadline CONTACT Inquires about the workshop should be sent to the Information Desk ( info at miccai-clip.org). ORGANIZERS (in alphabetical order) Klaus Drechsler (Fraunhofer IGD, Germany) Marius Erdt (Fraunhofer IDM at NTU, Singapore) Miguel Gonz?lez Ballester (ICREA - Universitat Pompeu Fabra, Spain) Marius George Linguraru (Children's National Medical Center, USA) Cristina Oyarzun Laura (Fraunhofer IGD, Germany) Yoshinobu Sato (Nara Institute of Science and Technology, Japan) Raj Shekhar (Children's National Medical Center, USA) Stefan Wesarg (Fraunhofer IGD, Germany) ======================================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From svenkramer40 at gmail.com Fri Jun 10 05:41:48 2016 From: svenkramer40 at gmail.com (Sven Kramer) Date: Fri, 10 Jun 2016 11:41:48 +0200 Subject: [vtkusers] create a parallel, distributed dataset from scratch Message-ID: Hello, Vtk comes with a few parallel data sources and readers that distribute the memory usage (and thus later cpu usage of algorithms) between a number of MPI processes. I am wondering, how I can create such parallel datasets "from scratch". The starting point, from which I'd like to build a parallel Vtk dataset, is the equivalent of a vtkUnstructuredGrid (namely points and their connectivity, making cells), which is already decomposed so that each MPI process carries only a fraction of all available points and cells. Of cause, I could simply create one vtkUnstructuredGrid per process from the points an cells local to that process. However, these grids wouldn't have any information about which points and cell surfaces they share with neighbouring pieces. But such connectivity information is essential, if some algorithm has to add additional layers of ghost cells. What I have: MPI rank #0 points p00..p0{n0} cells c00..c0{m0} connectivity information between boundary cells and pieces on other ranks MPI rank #1 points p1{n0+1}..p1{n1} cells c1{n0+1}..c1{m1} connectivity information between boundary cells and pieces on other ranks ... MPI rank #R points pR{n{R-1}+1}..pR{nR} cells cR{n{R-1}+1}..cR{mR} connectivity information between boundary cells and pieces on other ranks What I need: a parallel vtkUnstructuredGrid, decomposed into the same pieces as the input data, including ghost cells and connectivity information between the pieces. Is the construction of such a parallel dataset described in some tutorial or blog? Regards, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolasvtk3 at gmail.com Fri Jun 10 05:49:43 2016 From: nicolasvtk3 at gmail.com (Nicolas) Date: Fri, 10 Jun 2016 11:49:43 +0200 Subject: [vtkusers] problem with normal calculation for output of linear extrusion filter Message-ID: Hi, I am having some troubles with the normal computation of an object. I am using vtk 7.0.0 and C++ code. More precisely, the list of operation I am doing from an stl input is: 1) reading the STL file with vtkSTLReader; 2) computing the normals with vtkPolyDataNormals; 3) applying a vtkThreshold filter on cell which have a z normal component lower than a given value; 4) applying a vtkConnectivityFilter to put together the regions which are connected; 5) for each of such regions, applying a linear extrusion with vtkLinearExtrusionFilter vtkSmartPointer extrude = vtkSmartPointer::New(); extrude->SetInputData(geometryFilterInn->GetOutput()); extrude->SetVector(0, 0, -1); extrude->CappingOn(); extrude->SetScaleFactor(extrusionLength); extrude->Update(); being geometryFilterInn the output of point 4). 6) exporting the output of linear extrusion filter to stl files with vtkSTLWriter. You can find two files generated in this way here https://app.box.com/s/wkiougfwwxga6vc4rmtyjz25fm1eu9du https://app.box.com/s/lvzcu3uvk363ycddcsyd838yccyt2sqq If I calculate the cell normals for such object, I obtain some wrong results (with Paraview 5.0.1 version as well), especially for cells which are connected to the rest of cells only by a vertex and for cells which define a "hole" inside the connected region (for instance, an empty parallelepiped). At present the code I use to compute the normals is the following vtkSmartPointer computeNormals = vtkSmartPointer::New(); computeNormals->SetInputData(polyDataPtr); computeNormals->ComputeCellNormalsOn(); computeNormals->Update(); I've also unsuccessfully tried to play with computeNormals->ConsistencyOn(); computeNormals->AutoOrientNormalsOn(); So, I wonder: 1) is it possible to compute the normals for objects which have "holes" and with cells connected to the other cells only by vertex? 2) am I doing something wrong with the linear extrusion filter? Thank you very much, Nicolas -------------- next part -------------- An HTML attachment was scrubbed... URL: From lackodan at outlook.com Fri Jun 10 06:15:53 2016 From: lackodan at outlook.com (D L) Date: Fri, 10 Jun 2016 12:15:53 +0200 Subject: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter In-Reply-To: References: , , Message-ID: Sorry for the late response on my part, I've been busy with other work yesterday. >You're welcome. Your experience is not universal, though, lots of questions on this list go unanswered. So I've noticed. Wish I knew enough to help, but this is not my area of expertise. >You mean vtkImageThresholdConnectivity? Yes, you could use a picker to get the data coordinates (these are the coordinates measured in mm, not the i,j,k location of the voxel). Or, if you're lucky enough to know that the region will always include the point at the center of the image, you can use the coords of that point as a seed. Yes, I meant vtkImageThresholdConnectivity, sorry. Unfortunately, since I'm trying to extract the bone layer out of MRI images, I know that the region doesn't include the point at the center of the image... Just to confirm: there is no way to automate this process? If I have a dataset of 100 scans, I need to pick a seed point manually for all 100 of them? Kind regards, Daniel P.S. I assume you're only including the relevant parts of the message you're responding to in order to keep redundancy to a minimum and help others who look at this conversation later on to keep an oversight, correct? (I haven't actively participated in a mailing list before, so I'm trying to learn best practices as I go along.) -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Fri Jun 10 07:46:30 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Fri, 10 Jun 2016 05:46:30 -0600 Subject: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter In-Reply-To: References: Message-ID: On Fri, Jun 10, 2016 at 4:15 AM, D L wrote: > > Yes, I meant vtkImageThresholdConnectivity, sorry. Unfortunately, since > I'm trying to extract the bone layer out of MRI images, I know that the > region doesn't include the point at the center of the image... Just to > confirm: there is no way to automate this process? If I have a dataset of > 100 scans, I need to pick a seed point manually for all 100 of them? > For vtkImageThresholdConnectivity, yes. For your final output, do you need a surface made of polygons, or do you need the voxels? What was wrong with the result from using vtkMarchingCubes and vtkPolyDataConnectivityFilter? You mentioned that the image was already thresholded, so maybe vtkDiscreteMarchingCubes will give better output? > P.S. I assume you're only including the relevant parts of the message > you're responding to in order to keep redundancy to a minimum and help > others who look at this conversation later on to keep an oversight, > correct? (I haven't actively participated in a mailing list before, so I'm > trying to learn best practices as I go along.) > Usenet etiquette, but this list doesn't have any specific rules and replying at the top is perfectly acceptable. Cheers, - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From ultam93 at yahoo.com Fri Jun 10 08:02:03 2016 From: ultam93 at yahoo.com (c_mihai) Date: Fri, 10 Jun 2016 05:02:03 -0700 (MST) Subject: [vtkusers] Moving the origin of the scene Message-ID: <1465560123517-5738621.post@n5.nabble.com> Hello, I have an issue and I'd appreciate any help on figuring this one out. After loading two objects in vtk, I want to move/translate the origin of the scene to a point on the first object, let's say cell 0. That way I can see the coordinates for object nr.2 from the new set origin. -- View this message in context: http://vtk.1045678.n5.nabble.com/Moving-the-origin-of-the-scene-tp5738621.html Sent from the VTK - Users mailing list archive at Nabble.com. From indienator at gmx.de Fri Jun 10 08:34:35 2016 From: indienator at gmx.de (Maximilian Dankbar) Date: Fri, 10 Jun 2016 14:34:35 +0200 Subject: [vtkusers] Use depth map from vtkShadowMapBakerPass In-Reply-To: References: , Message-ID: An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Fri Jun 10 08:52:25 2016 From: david.lonie at kitware.com (David Lonie) Date: Fri, 10 Jun 2016 08:52:25 -0400 Subject: [vtkusers] vtkCubeAxesActor setTitle string utf-8 In-Reply-To: <1465538355767-5738615.post@n5.nabble.com> References: <1465538355767-5738615.post@n5.nabble.com> Message-ID: On Fri, Jun 10, 2016 at 1:59 AM, AlexUtrobin wrote: > I can not change the font and I can not show the Unicode text in > vtkCubeAxesActor. The same actions with vtkTextActor work. > What am I doing wrong? > vtkCubeAxes unfortunately still uses the vtkVectorText class to render text by default. This class only supports a subset of ASCII characters, and lacks many of the newer features available in the vtkTextActor/vtkTextActor3D/vtkTextMapper classes. The good news is that there is a switch on the class to tell it to use vtkTextActor3D instead of vtkVectorText: Add mCubeAxesActor.SetUseTextActor3D(1) to your test and it should work as expected. HTH, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From lackodan at outlook.com Fri Jun 10 09:01:32 2016 From: lackodan at outlook.com (D L) Date: Fri, 10 Jun 2016 15:01:32 +0200 Subject: [vtkusers] Extracting largest region works with vtkPolyDataConnectivityFilter, but not with vtkConnectivityFilter In-Reply-To: References: , , , Message-ID: >For your final output, do you need a surface made of polygons, or do you need the voxels? The final output should be a polygon surface, ideally the surface of the connected inner and outer skull layers (although a separate surface for each layer would also be fine). >What was wrong with the result from using vtkMarchingCubes and vtkPolyDataConnectivityFilter? It still had some holes and artifacts, which I would like to remove. I wanted to close it first (using vtkImageOpenClose3D) and maybe some other morphological operations, depending on the result. I assume that these kind of image processing algorithms are best done on voxel-based data. >You mentioned that the image was already thresholded, so maybe vtkDiscreteMarchingCubes will give better output? Didn't seem to make a difference in this case. Maybe I could do marching cubes, use vtkPolyDataConnectivityFilter for largest region extraction, convert that to a vtkImageData using vtkProbeFilter (with the original image as input and the output of the connectivity filter as source), do the morphological operations and then extract the surface from the result again using marching cubes? Not very elegant, but still more efficient than the alternatives. Kind regards, Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: From grothausmann.roman at mh-hannover.de Sat Jun 11 05:00:29 2016 From: grothausmann.roman at mh-hannover.de (Grothausmann, Roman Dr.) Date: Sat, 11 Jun 2016 11:00:29 +0200 Subject: [vtkusers] export vtp-FieldData with arrays of varying length In-Reply-To: References: <548070F4.4070508@gmx.net> <5742E8E3.40800@mh-hannover.de> Message-ID: <575BD32D.1080309@mh-hannover.de> Dear mailing list members, I'm trying to export vtp-FieldData with arrays of varying length (as in the attached VTP) to CSV: https://github.com/romangrothausmann/VTK-CLIs/blob/master/vtp2csv.cxx However, it seems the vtkTable returned by vtkDataObjectToTable only holds as many rows as the first encountered array has. I had a look at vtkDataSetAttributes.cxx and vtkFieldData.cxx but their ShallowCopy do not use an iterator whose length I could set. How can I export as many rows as the longest array holds, as e.g. Paraview's CSV-exporter does? Any help or hints are very much appreciated Roman -- Dr. Roman Grothausmann Tomographie und Digitale Bildverarbeitung Tomography and Digital Image Analysis Institut f?r Funktionelle und Angewandte Anatomie, OE 4120 Medizinische Hochschule Hannover Carl-Neuberg-Str. 1 D-30625 Hannover Tel. +49 511 532-2900 -------------- next part -------------- A non-text attachment was scrubbed... Name: 8faced-rhombic-dodecahedron_twinned_simp+def.vtp Type: text/xml Size: 97560 bytes Desc: not available URL: From ultam93 at yahoo.com Mon Jun 13 04:02:16 2016 From: ultam93 at yahoo.com (c_mihai) Date: Mon, 13 Jun 2016 01:02:16 -0700 (MST) Subject: [vtkusers] Moving the origin of the scene In-Reply-To: <1465560123517-5738621.post@n5.nabble.com> References: <1465560123517-5738621.post@n5.nabble.com> Message-ID: <1465804936668-5738634.post@n5.nabble.com> Should I be using vtkCoordinate? There aren't many examples with it, so I don't really understand how it would give me the transformation I need to move the world's origin. -- View this message in context: http://vtk.1045678.n5.nabble.com/Moving-the-origin-of-the-scene-tp5738621p5738634.html Sent from the VTK - Users mailing list archive at Nabble.com. From martin.genet at polytechnique.edu Mon Jun 13 06:17:05 2016 From: martin.genet at polytechnique.edu (Martin Genet) Date: Mon, 13 Jun 2016 12:17:05 +0200 Subject: [vtkusers] vtkImageInterpolator -> gradient Message-ID: <575E8821.1080409@polytechnique.edu> Dear all: On the wiki page on image interpolators , I read the following: > It would be possible to add methods to the interpolator classes so that they could return the gradient of the image at any (X,Y,Z) point. I was wondering: has there been any progress on this side? It would quite useful. Any thought on the implementation? Thanks! Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Mon Jun 13 06:23:43 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Mon, 13 Jun 2016 12:23:43 +0200 Subject: [vtkusers] Moving the origin of the scene In-Reply-To: <1465804936668-5738634.post@n5.nabble.com> References: <1465560123517-5738621.post@n5.nabble.com> <1465804936668-5738634.post@n5.nabble.com> Message-ID: You'll want to use vtkCamera to move the view to the origin of the scene. http://www.vtk.org/doc/nightly/html/classvtkCamera.html vtkCamera::SetPosition(const double[3]) vtkCamera::SetFocalPoint(const double[3]) Set the focal point to the origin of the scene. You can independently set the position of the camera and it will look at the focal point wherever you position it. You may want to call vtkCamera::OrthogonalizeViewUp() after setting these points to ensure the camera behaves nicely. You can get the current camera from the vtkRenderer via vtkCamera* vtkRenderer::GetActiveCamera() See http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/vtkCamera For an example that positions the camera in this way. HTH, Cory On Mon, Jun 13, 2016 at 10:02 AM, c_mihai via vtkusers wrote: > Should I be using vtkCoordinate? There aren't many examples with it, so I > don't really understand how it would give me the transformation I need to > move the world's origin. > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/Moving-the-origin-of-the-scene-tp5738621p5738634.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- Cory Quammen R&D Engineer Kitware, Inc. From jan.hirsch at st.ovgu.de Mon Jun 13 06:24:19 2016 From: jan.hirsch at st.ovgu.de (jhirsch) Date: Mon, 13 Jun 2016 03:24:19 -0700 (MST) Subject: [vtkusers] FixedPointVolumeRayCastMapper - Does size matter? Message-ID: <1465813459936-5738638.post@n5.nabble.com> Hello guys, I have a problem rendering an interpolated structured grid (vtkImageData). In order to narrow the problem, I've created a grid and write it as a VTI file with this kind of data: The rendering works pretty well. But when I'm rendering this grid, nothing appears: Scalar data range, compression, encoding, format etc. is the same in both files. So I'm guessing that the rendering algorithm steps over this small grid. How can I setup the mapper to make it right? I've learnt that the extent is defined by the index of the first point and the index of the last point. So that should be okay. Thanks in advance! Jan -- View this message in context: http://vtk.1045678.n5.nabble.com/FixedPointVolumeRayCastMapper-Does-size-matter-tp5738638.html Sent from the VTK - Users mailing list archive at Nabble.com. From zionman.hsu at gmail.com Mon Jun 13 06:46:34 2016 From: zionman.hsu at gmail.com (=?big5?B?rn2n07XY?=) Date: Mon, 13 Jun 2016 18:46:34 +0800 Subject: [vtkusers] Bug report about vtkLine.cpp Message-ID: <0C4E7788054544B3BFD755FC7A75463E@zionladynb> The Common Datamodel vtkLine.cpp has the following paragraph for calculating distance between two lines, --------------------------------------------------------------------------- const double D = a*c - b*b; // always >= 0 // compute the line parameters of the two closest points if (D < 1e-6) { // the lines are almost parallel ---------------------------------------------------------------------------- - for rather small line segments, the a*c and b*b maybe very small compare to 1e-6, which case, the used criterial for almost parallel may cause error, maybe the D<1e-6 is better use floating criterial value. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Mon Jun 13 08:00:43 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Mon, 13 Jun 2016 06:00:43 -0600 Subject: [vtkusers] vtkImageInterpolator -> gradient In-Reply-To: <575E8821.1080409@polytechnique.edu> References: <575E8821.1080409@polytechnique.edu> Message-ID: On Mon, Jun 13, 2016 at 4:17 AM, Martin Genet < martin.genet at polytechnique.edu> wrote: > > > I was wondering: has there been any progress on this side? It would quite > useful. Any thought on the implementation? Thanks! > No progress, it's still just an idea. When I wrote that wiki page, I was thinking the gradient would be useful if these interpolators were used for either isosurfacing or ray casting. What were you thinking of using the gradient for? The computation of derivatives for b-spline interpolation is currently implemented in the vtkBSplineTransform class, which uses the derivatives to provide the Jacobian matrix for the transformation: https://gitlab.kitware.com/vtk/vtk/blob/master/Filters/Hybrid/vtkBSplineTransform.cxx#L202 Computing a gradient would be similar, but would need only three derivatives instead of nine. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.genet at polytechnique.edu Mon Jun 13 08:21:05 2016 From: martin.genet at polytechnique.edu (Martin Genet) Date: Mon, 13 Jun 2016 14:21:05 +0200 Subject: [vtkusers] vtkImageInterpolator -> gradient In-Reply-To: References: <575E8821.1080409@polytechnique.edu> Message-ID: <575EA531.8030203@polytechnique.edu> On 13/06/2016 14:00, David Gobbi wrote: > On Mon, Jun 13, 2016 at 4:17 AM, Martin Genet > > wrote: > > > I was wondering: has there been any progress on this side? It would > quite useful. Any thought on the implementation? Thanks! > > > No progress, it's still just an idea. When I wrote that wiki page, I > was thinking the gradient would be useful if these interpolators were > used for either isosurfacing or ray casting. What were you thinking of > using the gradient for? > > The computation of derivatives for b-spline interpolation is currently > implemented in the vtkBSplineTransform class, which uses the > derivatives to provide the Jacobian matrix for the transformation: > https://gitlab.kitware.com/vtk/vtk/blob/master/Filters/Hybrid/vtkBSplineTransform.cxx#L202 > Computing a gradient would be similar, but would need only three > derivatives instead of nine. > Right now I'm working on some (finite element-based) image correlation tool, for which I need to compute some integral on the image (the residual), as well as some integral on the image gradient (the search direction). For the moment I'm using an ImageInterpolator for the images, and an ImageGradient+ImageInterpolator for their gradients, but of course that way the interpolated gradients are not the actual gradients of the interpolated images. Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjchen.work at gmail.com Mon Jun 13 15:05:48 2016 From: hjchen.work at gmail.com (hchen) Date: Mon, 13 Jun 2016 12:05:48 -0700 (MST) Subject: [vtkusers] get patient Name/ID in vtkGDCMPolyDataReader? Message-ID: <1465844748533-5738648.post@n5.nabble.com> Hello, I am using vtkGDCMPolyDataReader to read RT structure and display them in VTK. I need to do this for multiple patients, but I couldn't patient name and ID in vtkGDCMPolyDataReader, is it not there or is it just me not find it? Thank you! Best, Chen -- View this message in context: http://vtk.1045678.n5.nabble.com/get-patient-Name-ID-in-vtkGDCMPolyDataReader-tp5738648.html Sent from the VTK - Users mailing list archive at Nabble.com. From grothausmann.roman at mh-hannover.de Tue Jun 14 02:34:21 2016 From: grothausmann.roman at mh-hannover.de (Grothausmann, Roman Dr.) Date: Tue, 14 Jun 2016 08:34:21 +0200 Subject: [vtkusers] Bug or feature: incomplete table returned by vtkDataObjectToTable for arrays of varying length In-Reply-To: <575BD32D.1080309@mh-hannover.de> References: <548070F4.4070508@gmx.net> <5742E8E3.40800@mh-hannover.de> <575BD32D.1080309@mh-hannover.de> Message-ID: <575FA56D.7030801@mh-hannover.de> Before I start to write my own CSV export, iterating over each array individually, I'm wondering whether the incomplete table returned by vtkDataObjectToTable for arrays of varying length is intended? On 11/06/16 11:00, Grothausmann, Roman Dr. wrote: > Dear mailing list members, > > > I'm trying to export vtp-FieldData with arrays of varying length (as in the > attached VTP) to CSV: > https://github.com/romangrothausmann/VTK-CLIs/blob/master/vtp2csv.cxx > > However, it seems the vtkTable returned by vtkDataObjectToTable only holds as > many rows as the first encountered array has. I had a look at > vtkDataSetAttributes.cxx and vtkFieldData.cxx but their ShallowCopy do not use > an iterator whose length I could set. > How can I export as many rows as the longest array holds, as e.g. Paraview's > CSV-exporter does? > > Any help or hints are very much appreciated > Roman > > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -- Dr. Roman Grothausmann Tomographie und Digitale Bildverarbeitung Tomography and Digital Image Analysis Institut f?r Funktionelle und Angewandte Anatomie, OE 4120 Medizinische Hochschule Hannover Carl-Neuberg-Str. 1 D-30625 Hannover Tel. +49 511 532-2900 From zeinsalah at gmail.com Tue Jun 14 03:44:08 2016 From: zeinsalah at gmail.com (Zein Salah) Date: Tue, 14 Jun 2016 09:44:08 +0200 Subject: [vtkusers] Sharing 3D textures on GPU between multiple openGL contexts In-Reply-To: References: Message-ID: Thanks, Ken, for the feedback. Actually I am not a big expert. Any ideas how to do this? 2016-05-31 21:11 GMT+02:00 Ken Martin : > We have not added that capability into VTK. OpenGL supports it, we just have > not provided an API to do it directly. > > On Tue, May 31, 2016 at 4:31 AM, Zein Salah wrote: >> >> Hi everybody, >> >> I have a 3D texture (i.e., a 3D image volume) on the GPU that I want to >> share >> between multiple contexts. In essence, I want to display different views >> of the >> same texture in different widgets using different shader/fragement >> programs. >> >> 1. Is this possible in VTK? >> 2. Which version of VTK supports this? >> >> Much thanks, >> Zein >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers > > > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and > legally privileged information, and it is intended only for the use of the > addressee. Access to this email by anyone else is unauthorized. If you are > not the intended recipient, any disclosure, copying, distribution or any > action taken in reliance on it is prohibited and may be unlawful. If you > received this communication in error please notify us immediately and > destroy the original message. Thank you. From fr.ponzio at gmail.com Tue Jun 14 06:18:50 2016 From: fr.ponzio at gmail.com (Francesco Ponzio) Date: Tue, 14 Jun 2016 12:18:50 +0200 Subject: [vtkusers] vtkImageReslice, qform and sform Message-ID: Dear all, I need to align two images in the same physical space. I've the following .mat file with a transform matrix stored : 0.993732 -0.050437 0.099759 118.608807 0.107197 0.176938 -0.978367 175.246022 0.031695 0.982929 0.181236 46.150529 0 0 0 1 I don't have supplementary information. Reading previous related discussion in the forum ( http://public.kitware.com/pipermail/vtkusers/2014-March/083528.html ) I've become more confused. What is data coordinate? Is is voxel space (I mean i,j,k space of the voxel)? What is the relation between a transfomation expressed in physical space and the same in data coordinate space? My images are nifti and I have qform and sform matrix which are the same. How to use them? Thanks, Francesco -- Francesco Ponzio -------------- next part -------------- An HTML attachment was scrubbed... URL: From hinesh_88 at hotmail.co.uk Tue Jun 14 07:30:26 2016 From: hinesh_88 at hotmail.co.uk (Hp07) Date: Tue, 14 Jun 2016 04:30:26 -0700 (MST) Subject: [vtkusers] STLWriter producing pixelated images? Message-ID: <1465903826660-5738653.post@n5.nabble.com> Hi all, I am using CT image scans rendered into a 3d graphic. When the image is displayed in OpenGL the 3d image is smooth and clear - im happy with the image. When i however try to read the saved .stl file in wxpython, the image is more pixelated compared to the orignally displayed image in vtk. Is there paramters that i may need to inlcude to reproduce a similar image to the orginal? any advice will be much appreciated. Many thanks in advance. The code i used to open a .STL files using 3d rendered images from vtk is found on: https://sukhbinder.wordpress.com/2013/12/24/lights-cameras-action-a-simple-example-to-embed-vtk-with-wxpython/ -- View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653.html Sent from the VTK - Users mailing list archive at Nabble.com. From cory.quammen at kitware.com Tue Jun 14 08:03:19 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Tue, 14 Jun 2016 14:03:19 +0200 Subject: [vtkusers] STLWriter producing pixelated images? In-Reply-To: <1465903826660-5738653.post@n5.nabble.com> References: <1465903826660-5738653.post@n5.nabble.com> Message-ID: I think you mean that the surface from the STL file appears to not be smooth. This is because STL does not store surface normal information at the vertices, so your geometry is being rendered with flat shading of the triangles. To get a smoother appearance, generate surface normals with the vtkPolyDataNormals filter. See, for example, http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataExtractNormals HTH, Cory On Tue, Jun 14, 2016 at 1:30 PM, Hp07 wrote: > Hi all, > > I am using CT image scans rendered into a 3d graphic. When the image is > displayed in OpenGL the 3d image is smooth and clear - im happy with the > image. When i however try to read the saved .stl file in wxpython, the image > is more pixelated compared to the orignally displayed image in vtk. > Is there paramters that i may need to inlcude to reproduce a similar image > to the orginal? > > any advice will be much appreciated. > > Many thanks in advance. > > The code i used to open a .STL files using 3d rendered images from vtk is > found on: > > https://sukhbinder.wordpress.com/2013/12/24/lights-cameras-action-a-simple-example-to-embed-vtk-with-wxpython/ > > > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- Cory Quammen R&D Engineer Kitware, Inc. From flaviu2 at yahoo.com Tue Jun 14 09:14:25 2016 From: flaviu2 at yahoo.com (Flaviu2) Date: Tue, 14 Jun 2016 13:14:25 +0000 (UTC) Subject: [vtkusers] Error: vtkDICOMImageReader.cxx, line 333 References: <1996010844.2831140.1465910065070.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <1996010844.2831140.1465910065070.JavaMail.yahoo@mail.yahoo.com> Hi all of you. I have a very simple code: ?vtkSmartPointer reader = ??vtkSmartPointer::New(); ?reader->SetDirectoryName(_T("D:\\Tempx\\Birtoc\\")); ?reader->Update(); "Birtoc" is a CT series, axial, 125, with 778 images. But the program get me an error: ERROR: In ..\..\..\IO\Image\vtkDICOMImageReader.cxx, line 333 vtkDICOMImageReader (032F3428): There was a problem retrieving data from: D:\Tempx\Birtoc\/001_2300802301961 _BIRTOC MARIA.dcm ERROR: In ..\..\..\Common\ExecutionModel\vtkExecutive.cxx, line 784 vtkCompositeDataPipeline (032F4260): Algorithm vtkDICOMImageReader(032F3428) returned failure for request: vtkInformation (03300D30) ? Debug: Off ? Modified Time: 135 ? Reference Count: 1 ? Registered Events: (none) ? Request: REQUEST_DATA ? FORWARD_DIRECTION: 0 ? ALGORITHM_AFTER_FORWARD: 1 ? FROM_OUTPUT_PORT: 0 My question is: I have done something wrong ? I mention that on other CT series, I have not any error ... can you help me ? I am stuck here ... Flaviu. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vianamp at gmail.com Tue Jun 14 09:33:03 2016 From: vianamp at gmail.com (matheus_viana) Date: Tue, 14 Jun 2016 06:33:03 -0700 (MST) Subject: [vtkusers] In OSX vtk window does not get the focus In-Reply-To: References: Message-ID: <1465911183252-5738656.post@n5.nabble.com> Hi guys. Is there any update on this issue? Thanks a lot. -m -- View this message in context: http://vtk.1045678.n5.nabble.com/In-OSX-vtk-window-does-not-get-the-focus-tp5734953p5738656.html Sent from the VTK - Users mailing list archive at Nabble.com. From inglis.dl at gmail.com Tue Jun 14 09:43:13 2016 From: inglis.dl at gmail.com (Dean Inglis) Date: Tue, 14 Jun 2016 09:43:13 -0400 Subject: [vtkusers] Error: vtkDICOMImageReader.cxx, line 333 In-Reply-To: <1996010844.2831140.1465910065070.JavaMail.yahoo@mail.yahoo.com> References: <1996010844.2831140.1465910065070.JavaMail.yahoo.ref@mail.yahoo.com> <1996010844.2831140.1465910065070.JavaMail.yahoo@mail.yahoo.com> Message-ID: Hi Flaviu, it seems like you are expecting the reader to look for a series of individual slice files within a directory, but maybe you are just trying to read a single volume in one file. Try this: if( reader->CanReadFile( "your_file.dcm" ) ) { reader->SetFileName( "your_file.dcm" ); reader->Update(); // do other stuff ... } - Dean On Tue, Jun 14, 2016 at 9:14 AM, Flaviu2 via vtkusers wrote: > Hi all of you. I have a very simple code: > > vtkSmartPointer reader = > vtkSmartPointer::New(); > reader->SetDirectoryName(_T("D:\\Tempx\\Birtoc\\")); > reader->Update(); > > "Birtoc" is a CT series, axial, 125, with 778 images. But the program get > me an error: > > ERROR: In ..\..\..\IO\Image\vtkDICOMImageReader.cxx, line 333 > vtkDICOMImageReader (032F3428): There was a problem retrieving data from: > D:\Tempx\Birtoc\/001_2300802301961 _BIRTOC MARIA.dcm > > ERROR: In ..\..\..\Common\ExecutionModel\vtkExecutive.cxx, line 784 > vtkCompositeDataPipeline (032F4260): Algorithm > vtkDICOMImageReader(032F3428) returned failure for request: vtkInformation > (03300D30) > > Debug: Off > Modified Time: 135 > Reference Count: 1 > Registered Events: (none) > Request: REQUEST_DATA > FORWARD_DIRECTION: 0 > ALGORITHM_AFTER_FORWARD: 1 > FROM_OUTPUT_PORT: 0 > > My question is: I have done something wrong ? I mention that on other CT > series, I have not any error ... can you help me ? I am stuck here ... > > Flaviu. > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hinesh_88 at hotmail.co.uk Tue Jun 14 09:45:59 2016 From: hinesh_88 at hotmail.co.uk (Hp07) Date: Tue, 14 Jun 2016 06:45:59 -0700 (MST) Subject: [vtkusers] STLWriter producing pixelated images? In-Reply-To: References: <1465903826660-5738653.post@n5.nabble.com> Message-ID: <1465911959333-5738659.post@n5.nabble.com> Hi Cory, Many thanks for the reply. I looked into vtkPolyDataNormals as you mentioned. Can you please see below the images generated from VTK (right) and wxpython (left) which was generated using the vtkPolyDataNormals data and saving it in STL. Is that wat you were referring too? writing the STL using the vtkPolyDataNormals? norm = vtk.vtkPolyDataNormals() norm.SetInputConnection(DicomMC.GetOutputPort()) norm.Update() writer = vtk.vtkSTLWriter() writer.SetFileName(stlfilePath) writer.SetInputConnection(normals.GetOutputPort()) writer.SetFileTypeToBinary() writer.Write() -- View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653p5738659.html Sent from the VTK - Users mailing list archive at Nabble.com. From cory.quammen at kitware.com Tue Jun 14 09:56:36 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Tue, 14 Jun 2016 15:56:36 +0200 Subject: [vtkusers] STLWriter producing pixelated images? In-Reply-To: <1465911959333-5738659.post@n5.nabble.com> References: <1465903826660-5738653.post@n5.nabble.com> <1465911959333-5738659.post@n5.nabble.com> Message-ID: Sorry, I should have been more specific. Add the vtkPolyDataNormals filter after you load the STL file with the vtkSTLReader. Cory On Tue, Jun 14, 2016 at 3:45 PM, Hp07 wrote: > Hi Cory, > > Many thanks for the reply. > > I looked into vtkPolyDataNormals as you mentioned. Can you please see below > the images generated from VTK (right) and wxpython (left) which was > generated using the vtkPolyDataNormals data and saving it in STL. > > Is that wat you were referring too? writing the STL using the > vtkPolyDataNormals? > > norm = vtk.vtkPolyDataNormals() > norm.SetInputConnection(DicomMC.GetOutputPort()) > norm.Update() > > writer = vtk.vtkSTLWriter() > writer.SetFileName(stlfilePath) > writer.SetInputConnection(normals.GetOutputPort()) > writer.SetFileTypeToBinary() > writer.Write() > > > > > > > > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653p5738659.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- Cory Quammen R&D Engineer Kitware, Inc. From hinesh_88 at hotmail.co.uk Tue Jun 14 10:36:21 2016 From: hinesh_88 at hotmail.co.uk (Hp07) Date: Tue, 14 Jun 2016 07:36:21 -0700 (MST) Subject: [vtkusers] STLWriter producing pixelated images? In-Reply-To: References: <1465903826660-5738653.post@n5.nabble.com> <1465911959333-5738659.post@n5.nabble.com> Message-ID: <1465914981266-5738662.post@n5.nabble.com> Hi Cory, Thanks a million, with your help i got the desired output. Thanks again, hp -- View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653p5738662.html Sent from the VTK - Users mailing list archive at Nabble.com. From cory.quammen at kitware.com Tue Jun 14 10:47:37 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Tue, 14 Jun 2016 16:47:37 +0200 Subject: [vtkusers] STLWriter producing pixelated images? In-Reply-To: <1465914981266-5738662.post@n5.nabble.com> References: <1465903826660-5738653.post@n5.nabble.com> <1465911959333-5738659.post@n5.nabble.com> <1465914981266-5738662.post@n5.nabble.com> Message-ID: Great, I'm glad it works, hp. Thanks for letting us know. Cory On Tue, Jun 14, 2016 at 4:36 PM, Hp07 wrote: > Hi Cory, > > Thanks a million, with your help i got the desired output. > > Thanks again, > hp > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653p5738662.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- Cory Quammen R&D Engineer Kitware, Inc. From luis.vieira at vektore.com Tue Jun 14 11:16:52 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Tue, 14 Jun 2016 11:16:52 -0400 Subject: [vtkusers] Contents of vtk-developers Digest, Vol 146, Issue 15 Message-ID: <2e1e01d1c64f$c84360f0$58ca22d0$@vektore.com> Hi David, Also, I have tried, unsuccessfully, as well as following: renderer->ComputeVisiblePropBounds(bounds); vtkCamera* cam = renderer->GetActiveCamera(); cam->SetFocalPoint((bounds[0] + bounds[1]) / 2.0, (bounds[2] + bounds[3]) / 2.0, (bounds[4] + bounds[5]) / 2.0); cam->SetPosition((bounds[0] + bounds[1]) / 2.0, (bounds[2] + bounds[3]) / 2.0, bounds[4] + bounds[5]); cam->SetViewUp(0, 1, 0); Luis Vieira, Toronto - ON Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -----Original Message----- From: David Thompson [mailto:david.thompson at kitware.com] Sent: June 14, 2016 10:37 AM To: Luis Vieira Cc: vtk-developers at vtk.org Subject: Re: [vtk-developers] Rendering Image and Picking Points Hi Luis, > ...I am struggling to rendering an Image and set up the camera focal point to placed that image within the center of the camera. > > 1- I want this because the point is when I am rotating the object and picking point in its surface I got the X, Y and Z world coordinates that doesn't match the real coordinates of the camera; > > 2- When I am trying to use those coordinates once I had picked to calculate the center of mass between them , the results are not accurately rights. And everything that I have to derivate/build also are not, as well as when I make a Plane and the its origin goes away into the camera out of my cylinder(image). ... It looks like you are positioning the camera using image parameters... but you are not mapping the image directly. Instead, you are mapping geometry from a VRML file and texturing it with the image. The pick coordinates will be points on the VRML geometry, not image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. David From luis.vieira at vektore.com Tue Jun 14 11:37:45 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Tue, 14 Jun 2016 11:37:45 -0400 Subject: [vtkusers] Contents of vtk-developers Digest, Vol 146, Issue 15 Message-ID: <423b01d1c652$b33f19d0$19bd4d70$@vektore.com> Hi David, Also, I have tried, unsuccessfully, as well as following: >> It looks like you are positioning the camera using image parameters... but you are not mapping the image directly. Instead, you are mapping geometry from a VRML file and texturing it with the image. >> renderer->ComputeVisiblePropBounds(bounds); vtkCamera* cam = renderer->GetActiveCamera(); cam->SetFocalPoint((bounds[0] + bounds[1]) / 2.0, (bounds[2] + cam->bounds[3]) / 2.0, (bounds[4] + bounds[5]) / 2.0); cam->SetPosition((bounds[0] + bounds[1]) / 2.0, (bounds[2] + bounds[3]) cam->/ 2.0, bounds[4] + bounds[5]); SetViewUp(0, 1, 0); Please, could you be more clear about this? >> The pick coordinates will be points on the VRML geometry, not image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. >>> Tks, Luis Vieira, Toronto - ON Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -----Original Message----- From: David Thompson [mailto:david.thompson at kitware.com] Sent: June 14, 2016 10:37 AM To: Luis Vieira Cc: vtk-developers at vtk.org Subject: Re: [vtk-developers] Rendering Image and Picking Points Hi Luis, > ...I am struggling to rendering an Image and set up the camera focal point to placed that image within the center of the camera. > > 1- I want this because the point is when I am rotating the object and picking point in its surface I got the X, Y and Z world coordinates that doesn't match the real coordinates of the camera; > > 2- When I am trying to use those coordinates once I had picked to calculate the center of mass between them , the results are not accurately rights. And everything that I have to derivate/build also are not, as well as when I make a Plane and the its origin goes away into the camera out of my cylinder(image). ... It looks like you are positioning the camera using image parameters... but you are not mapping the image directly. Instead, you are mapping geometry from a VRML file and texturing it with the image. The pick coordinates will be points on the VRML geometry, not image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. David Hello Guys!! First of all, I have to say that I appreciate any help! I am struggling to rendering an Image and set up the camera focal point to placed that image within the center of the camera. 1- I want this because the point is when I am rotating the object and picking point in its surface I got the X, Y and Z world coordinates that doesn't match the real coordinates of the camera; 2- When I am trying to use those coordinates once I had picked to calculate the center of mass between them , the results are not accurately rights. And everything that I have to derivate/build also are not, as well as when I make a Plane and the its origin goes away into the camera out of my cylinder(image). Following my code and attached picture. Thank you very much!! Luis MainWindow.cpp void MainWindow::ProcessImage(QString _model, QString _image) { double bounds[6] = { +1, -1, +1, -1, +1, -1 }; qvtkWidget->setVisible(true); std::string iname = _model.toStdString();//model is a *.obj Cylinder of Solid rock with h1024xw1024"; std::string imagename = _image.toStdString() ;//is the texture *.bmp file that wraps up the cylinder"; vtkRenderer* renderer = vtkRenderer::New(); vtkRenderWindow* renderWindow = vtkRenderWindow::New(); renderWindow->StereoCapableWindowOn(); // Activate 3DConnexion device only on the left render window. qvtkWidget->SetUseTDx(true); qvtkWidget->SetRenderWindow(renderWindow); //renderWindow->Delete(); const double angleSensitivity = 0.02; const double translationSensitivity = 0.001; QVTKInteractor *iren = qvtkWidget->GetInteractor(); vtkInteractorStyle *s = static_cast(iren->GetInteractorStyle()); vtkTDxInteractorStyleCamera *t = static_cast(s->GetTDxStyle()); t->GetSettings()->SetAngleSensitivity(angleSensitivity); t->GetSettings()->SetTranslationXSensitivity(translationSensitivity); t->GetSettings()->SetTranslationYSensitivity(translationSensitivity); t->GetSettings()->SetTranslationZSensitivity(translationSensitivity); // Read the image which will be the texture QMenu* popup1 = new QMenu(qvtkWidget); popup1->addAction("Draw Line"); popup1->addAction("Draw Plane"); popup1->addAction("Draw Clip"); popup1->addAction("Background White"); popup1->addAction("Background Black"); popup1->addAction("Stereo Rendering"); connect(popup1, SIGNAL(triggered(QAction*)), this, SLOT(ProcessUserViewPortInteraction(QAction*))); std::cout << "Reading image " << imagename << "..." << std::endl; vtkBMPReader* bmpReader = vtkBMPReader::New(); bmpReader->SetFileName(imagename.c_str()); bmpReader->Update(); std::cout << "Done" << std::endl; // Creating the texture std::cout << "Making a texture out of the image... " << std::endl; vtkTexture* texture = vtkTexture::New(); texture->SetInputConnection(bmpReader->GetOutputPort()); std::cout << "Done" << std::endl; // Import geometry from a VRML file vtkSmartPointer imageViewer = vtkSmartPointer::New(); imageViewer->SetInputConnection(bmpReader->GetOutputPort()); //imageViewer->SetupInteractor(renderWindowInteractor); imageViewer->SetSize(600, 600); vtkDataSet *pDataset; // Import geometry from an OBJ file std::cout << "Reading OBJ file " << iname << "..." << std::endl; vtkOBJReader* reader = vtkOBJReader::New(); reader->SetFileName(iname.c_str()); reader->Update(); vtkPolyData *polyData2 = reader->GetOutput(); std::cout << "Obj reader = " << polyData2->GetNumberOfPoints() << std::endl; std::cout << "Obj point data = " << polyData2->GetPointData()->GetNumberOfArrays() << std::endl; std::cout << "Obj point data tuples = " << polyData2->GetPointData()->GetArray(0)->GetNumberOfTuples() << std::endl; std::cout << "Obj point data compon = " << polyData2->GetPointData()->GetArray(0)->GetNumberOfComponents() << std::endl; // //// Renderer vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); mapper->SetInputData(polyData2); vtkActor* texturedQuad = vtkActor::New(); texturedQuad->SetMapper(mapper); texturedQuad->SetTexture(texture); //texturedQuad->SetPosition(0, 0, 0); // Create Normal Vectors to enhance smoothness & illumination vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetInputData(polyData2); normals->SetFeatureAngle(60.0); // Mapper vtkPolyDataMapper *SolidMapper = vtkPolyDataMapper::New(); SolidMapper->SetInputData(normals->GetOutput()); SolidMapper->ScalarVisibilityOff(); // Actor vtkActor *SolidActor = vtkActor::New(); SolidActor->SetMapper(SolidMapper); vtkImageData* image = imageViewer->GetInput(); int dim[3]; image->GetDimensions(dim); double spacing[3]; image->GetSpacing(spacing); double origin[3]; image->GetOrigin(origin); renderer->ComputeVisiblePropBounds(bounds); Renderer->AddActor(SolidActor); Renderer->AddActor(texturedQuad); float Cx = (dim[0] * spacing[0]) / 2. + origin[0]; float Cy = (dim[1] * spacing[1]) / 2. + origin[1]; vtkCamera* m_Camera = vtkCamera::New(); m_Camera->SetPosition(Cx, Cy, 1); m_Camera->SetFocalPoint(Cx, Cy, 0); m_Camera->SetViewUp(0, 1, 0); m_Camera->GetDirectionOfProjection(); m_Camera->ParallelProjectionOn(); Renderer->SetActiveCamera(m_Camera); Renderer->SetBackground(0, 0, 0); // Background color white Renderer->ResetCamera(); qvtkWidget->GetRenderWindow()->AddRenderer(Renderer); qvtkWidget->GetRenderWindow()->Render(); //renderer->ResetCamera(); vtkIPWCallback* myCallback = vtkIPWCallback::New(); myCallback->renderer = Renderer; myCallback->renderWindowInteractor = qvtkWidget->GetRenderWindow()->GetInteractor(); myCallback->readerClip = vtkOBJReader::New(); myCallback->readerClip = reader; this->styleCallback = myCallback; //renderer->ResetCamera(); this->stylePicker->normalsKore = vtkSmartPointer::New(); this->stylePicker->normalsKore = normals; this->stylePicker->renderer = vtkSmartPointer::New(); this->stylePicker->actor = vtkActor::New(); this->stylePicker->mapper = vtkPolyDataMapper::New(); this->stylePicker->points = vtkSmartPointer::New(); this->stylePicker->vertices = vtkSmartPointer::New(); this->stylePicker->renderer = Renderer; this->stylePicker->renderWindowInteractor = qvtkWidget->GetRenderWindow()->GetInteractor(); vtkSmartPointer pointPicker = vtkSmartPointer::New(); qvtkWidget->GetRenderWindow()->GetInteractor()->SetPicker(pointPicker); qvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(this->sty lePicker); Connections = vtkEventQtSlotConnect::New(); Connections->Connect(qvtkWidget->GetRenderWindow()->GetInteractor(), vtkCommand::KeyPressEvent, this, SLOT(popup(vtkObject*, unsigned long, void*, void*, vtkCommand*)), popup1, 1.0); } MainWindow.h //Point PickFunction class MouseInteractorStyle2 : public vtkInteractorStyleTrackballCamera { public: std::vector pointList; std::vector pointListPlane; vtkSmartPointer matrix; vtkSmartPointer normalsKore = vtkSmartPointer::New(); vtkSmartPointer spherePickSource; vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer vertices = vtkSmartPointer::New(); vtkSmartPointer polydata; vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); vtkActor* actor; vtkPolyDataMapper* mapper; static MouseInteractorStyle2* New() { return new MouseInteractorStyle2; } //vtkTypeMacro(MouseInteractorStyle2, vtkInteractorStyleTrackballCamera); virtual void OnRightButtonDown() { int* clickPos = this->renderWindowInteractor->GetEventPosition(); // Pick from this location. vtkPropPicker* picker = vtkPropPicker::New(); picker->Pick(clickPos[0], clickPos[1], 0, this->renderer); picker->Pick(clickPos[0], clickPos[1], 0, this->renderer); double* pos = picker->GetPickPosition(); std::cout << "Pick position (world coordinates) is: " << pos[0] << " " << pos[1] << " " << pos[2] << std::endl; std::cout << "Picked actor: " << picker->GetActor() << std::endl; // Add label array. polydata = vtkSmartPointer::New(); spherePickSource = vtkSmartPointer::New(); spherePickSource->SetRadius(0.030); spherePickSource->SetCenter(pos[0], pos[1], pos[2]); if (pointList.size() < 2) { //pointList.clear(); pointList.push_back(pos); } if (pointListPlane.size() < 30) { pointListPlane.push_back(pos); } //Create a mapper and actor mapper = vtkPolyDataMapper::New(); mapper->SetInputConnection(spherePickSource->GetOutputPort()); actor = vtkActor::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(5); actor->GetProperty()->SetColor(1, 1, 1); this->renderer->AddActor(actor); vtkInteractorStyleTrackballCamera::OnRightButtonDown(); } private: }; Luis Vieira, Toronto - ON Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com From luis.vieira at vektore.com Tue Jun 14 15:20:18 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Tue, 14 Jun 2016 15:20:18 -0400 Subject: [vtkusers] vtkAxesActor within VTK 7.0 and QVTKWidget Message-ID: <5d4a01d1c671$ca203ed0$5e60bc70$@vektore.com> Hello everyone, I had migrated my VTK platform from 6.1 to 7.0. I had noticed some changes, and one of those is giving me a hard work to do that is to render vtkSmartPointer::New() within QVTWidget. Previously, was easily, with VTK 6.1. Now, I am trying that and I got the Cone working/rendering well and its interactions. However, I haven't gotten absolutely nothing on my viewport from my vtkAxesActor even been shown . Following my code (C++), regarding that this works outside QVTWidget viewport. I appreciate any ideas and help. ........ #include "vtkRenderWindow.h" #include "vtkRenderer.h" #include "vtkRenderWindowInteractor.h" #include "vtkEventQtSlotConnect.h" #include "vtkCommand.h" #include "vtkConeSource.h" #include "vtkSphereSource.h" #include "vtkPolyDataMapper.h" #include "vtkActor.h" #include "vtkActorCollection.h" #include "vtkCaptionActor2D.h" #include "vtkTextActor.h" #include "vtkTextProperty.h" #include "vtkActor2D.h" #include "vtkAxesActor.h" #include "vtkOrientationMarkerWidget.h" #include "vtkInteractorStyle.h" #include "vtkTDxInteractorStyleCamera.h" #include "vtkTDxInteractorStyleSettings.h" #include "vtkInteractorStyleRubberBandPick.h" #include "vtkInteractorStyleTrackballCamera.h" #include "vtkInteractorStyleTrackball.h" #include "QVTKInteractorAdapter.h" #include "QVTKInteractor.h" #include "QVTKApplication.h" ... . . . #include VTK_MODULE_INIT(vtkRenderingOpenGL); VTK_MODULE_INIT(vtkInteractionStyle); . . . Mainwindow.cpp Void procedure() { vtkRenderWindow* renwin = vtkRenderWindow::New(); renwin->StereoCapableWindowOn(); // Activate 3DConnexion device only on the left render window. // QVTKWidget mainViewPort->SetUseTDx(true); // QVTKWidget = mainViewPort. mainViewPort->SetRenderWindow(renwin); renwin->Delete(); const double angleSensitivity = 0.02; const double translationSensitivity = 0.001; QVTKInteractor *iren = mainViewPort->GetInteractor(); vtkInteractorStyle *s = static_cast(iren->GetInteractorStyle()); vtkTDxInteractorStyleCamera *t = static_cast(s->GetTDxStyle()); t->GetSettings()->SetAngleSensitivity(angleSensitivity); t->GetSettings()->SetTranslationXSensitivity(translationSensitivity); t->GetSettings()->SetTranslationYSensitivity(translationSensitivity); t->GetSettings()->SetTranslationZSensitivity(translationSensitivity); // add a renderer Ren1 = vtkRenderer::New(); mainViewPort->GetRenderWindow()->AddRenderer(Ren1); vtkConeSource* cone = vtkConeSource::New(); vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); mapper->SetInputConnection(cone->GetOutputPort()); vtkActor* actor = vtkActor::New(); actor->SetMapper(mapper); Ren1->AddViewProp(actor); actor->Delete(); mapper->Delete(); cone->Delete(); mainViewPort->GetRenderWindow()->Render(); viewPortAxActor = vtkSmartPointer::New(); viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()->SetColo r(0, 0, 0); viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05); viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->SetColo r(0, 0, 0); viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05); viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->SetColo r(0, 0, 0); viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05); viewPortOMWidget = vtkSmartPointer::New(); viewPortOMWidget->SetOrientationMarker(viewPortAxActor); viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); . . . ..... } Any ideas? Thank you very much. Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From flaviu2 at yahoo.com Wed Jun 15 02:41:49 2016 From: flaviu2 at yahoo.com (Flaviu2) Date: Wed, 15 Jun 2016 06:41:49 +0000 (UTC) Subject: [vtkusers] Error: vtkDICOMImageReader.cxx, line 333 In-Reply-To: References: <1996010844.2831140.1465910065070.JavaMail.yahoo.ref@mail.yahoo.com> <1996010844.2831140.1465910065070.JavaMail.yahoo@mail.yahoo.com> Message-ID: <43699958.3446292.1465972909564.JavaMail.yahoo@mail.yahoo.com> Thank you Dean, I will try to do that. On Tuesday, June 14, 2016 4:43 PM, Dean Inglis wrote: Hi Flaviu, it seems like you are expecting the reader to look for a series of individual slice files within a directory, but maybe you are just trying to read a single volume in one file.? Try this: if( reader->CanReadFile( "your_file.dcm" ) ) { ? reader->SetFileName( "your_file.dcm" ); ? reader->Update(); ? // do other stuff ... } - Dean On Tue, Jun 14, 2016 at 9:14 AM, Flaviu2 via vtkusers wrote: Hi all of you. I have a very simple code: ?vtkSmartPointer reader = ??vtkSmartPointer::New(); ?reader->SetDirectoryName(_T("D:\\Tempx\\Birtoc\\")); ?reader->Update(); "Birtoc" is a CT series, axial, 125, with 778 images. But the program get me an error: ERROR: In ..\..\..\IO\Image\vtkDICOMImageReader.cxx, line 333 vtkDICOMImageReader (032F3428): There was a problem retrieving data from: D:\Tempx\Birtoc\/001_2300802301961 _BIRTOC MARIA.dcm ERROR: In ..\..\..\Common\ExecutionModel\vtkExecutive.cxx, line 784 vtkCompositeDataPipeline (032F4260): Algorithm vtkDICOMImageReader(032F3428) returned failure for request: vtkInformation (03300D30) ? Debug: Off ? Modified Time: 135 ? Reference Count: 1 ? Registered Events: (none) ? Request: REQUEST_DATA ? FORWARD_DIRECTION: 0 ? ALGORITHM_AFTER_FORWARD: 1 ? FROM_OUTPUT_PORT: 0 My question is: I have done something wrong ? I mention that on other CT series, I have not any error ... can you help me ? I am stuck here ... Flaviu. _______________________________________________ Powered by http://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 Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrea.vitali1 at unibg.it Wed Jun 15 05:56:57 2016 From: andrea.vitali1 at unibg.it (Andrea Vitali) Date: Wed, 15 Jun 2016 11:56:57 +0200 Subject: [vtkusers] VTK 7.0 - Modified meshes is not updated like in the previous versions of VTK Message-ID: Dear All, I developed a virtual tool for emulating sculpting operations on a triangular mesh in VTK (something like http://stephaneginier.com/sculptgl/ ). The tool works fine with VTK 6.3.0, but I migrated to VTK 7.0 a week ago. VTK 7.0 do not update the rendered actor relative to 3D sculpted model, but the relative polydata has been updated in correct way. It seems that modifications on polydata are not updated in the actor as done with previous version of VTK. Any idea to solve this problem? Thank you in advance Andrea -------------- next part -------------- An HTML attachment was scrubbed... URL: From rashnok at cow-underground.de Wed Jun 15 06:17:48 2016 From: rashnok at cow-underground.de (AlphaUniform) Date: Wed, 15 Jun 2016 03:17:48 -0700 (MST) Subject: [vtkusers] How ensure the size of an obj vtkImagereSlice? In-Reply-To: <1445952265444-5734618.post@n5.nabble.com> References: <1445881593217-5734576.post@n5.nabble.com> <1445952265444-5734618.post@n5.nabble.com> Message-ID: <1465985868532-5738673.post@n5.nabble.com> Hi there, could you share your code creating the panoramic view? I was working for month on this and didn't ever received such a good result. Did you used the vtkSplineDrivenImageReslicer? Thank you very much in advance. -- View this message in context: http://vtk.1045678.n5.nabble.com/vtkusers-How-ensure-the-size-of-an-obj-vtkImagereSlice-tp5734576p5738673.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Wed Jun 15 07:35:37 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 15 Jun 2016 13:35:37 +0200 Subject: [vtkusers] Using context views in a QVTKRenderWindowInteractor from Python In-Reply-To: References: Message-ID: 2016-05-23 17:28 GMT+02:00 Elvis Stansvik : > 2016-05-23 16:55 GMT+02:00 Elvis Stansvik : > >> 2016-05-23 16:28 GMT+02:00 Elvis Stansvik : >> >>> I'm trying to use a context view (my goal is to show an XYChart) inside >>> a QVTKRenderWindowInteractor, but I'm struggling to get the initialization >>> of render window / interactor right. >>> >>> The docs for vtkRenderViewBase (base class for vtkContextView) says: >>> >>> "In order to use the view with a QVTKWidget the following code is >>> required to ensure the interactor and render window are initialized >>> properly. >>> >>> QVTKWidget *widget = new QVTKWidget; >>> vtkContextView *view = vtkContextView::New(); >>> view->SetInteractor(widget->GetInteractor()); >>> widget->SetRenderWindow(view->GetRenderWindow());" >>> >>> but this is about QVTKWidget, the C++ widget class, which is quite >>> different from the Python QVTKRenderWindowInteractor class. >>> >>> My failed attempt to recreate this initialization sequence when using >>> QVTKRenderWindowInteractor is this: >>> >>> >>> class TestWidget(QVTKRenderWindowInteractor): >>> >>> def __init__(self, parent=None): >>> >>> # We need a render window and interactor to pass to >>> # QVTKRenderWindowInteractor constructor. >>> self.renderWindow = vtkRenderWindow() >>> self.interactor = vtkGenericRenderWindowInteractor() >>> self.interactor.SetRenderWindow(self.renderWindow) >>> >>> super(TestWidget, self).__init__( >>> parent, rw=self.renderWindow, iren=self.interactor) >>> >>> # Create a context view and set it to use the same >>> # interactor as the QVTKRenderWindowInteractor. >>> self.contextView = vtkContextView() >>> self.contextView.SetInteractor(self.interactor) >>> >>> # Create chart and add it to the scene of the context view. >>> self.chart = vtkChartXY() >>> self.contextView.GetScene().AddItem(self.chart) >>> >>> # Initialize and start. >>> self.Initialize() >>> self.Start() >>> >>> >>> if __name__ == '__main__': >>> >>> app = QApplication(argv) >>> >>> widget = TestWidget() >>> widget.show() >>> >>> exit(app.exec_()) >>> >>> >>> But something goes wrong here, because two windows show up (see attached >>> screenshot). The application also segfaults on exit. Besides, it looks very >>> kludgy to have to do stuff before the call to super() here. Is this really >>> the right way to use the API? >>> >>> If anyone has worked with QVTKRenderWindowInteractor and vtkContextView, >>> I'd much appriciate some advice. >>> >> >> Inspired by an older post on this subject [1], I was able to get it >> partly working with: >> >> class TestWidget(QVTKRenderWindowInteractor): >> >> def __init__(self, parent=None): >> super(TestWidget, self).__init__(parent) >> >> self.contextView = vtkContextView() >> self.chart = vtkChartXY() >> self.contextView.GetScene().AddItem(self.chart) >> >> # Add renderer of context view to the render window of the widget. >> self.GetRenderWindow().AddRenderer(self.contextView.GetRenderer()) >> >> self.Initialize() >> self.Start() >> >> The chart is empty here, but I've verified by adding some items to it >> that it at least shows up correctly, in a single window. >> >> The problem is that interaction of course doesn't work, and if I also add >> >> self.contextView.SetInteractor(self._Iren) >> >> to set the interactor of the context view to the >> vtkGenericRenderWindowInteractor backing the QVTKRenderWindowInteractor, >> I'm back to the problem with two windows showing up. >> >> I need interaction to work, because my goal is to show an opacity >> function editor item in the chart. >> >> Thankful for any and all advice! >> > > To better illustrate, here's the scatter plot Python example from the > wiki, with the code I've added to try to make it work with > QVTKRenderWindowInteractor. > > The result is that when the application is executed, a "Visualization > Toolkit - OpenGL" window first shows up, where interaction works fine. This > is not the Qt window though. The Qt window shows up if I close the first > window, and interaction does not work (try hovering the data points). > > How would this example need to be modified for it to work? (chart shown in > the Qt window, with interaction working). > > Best regards, > Elvis > > # > app = QApplication(sys.argv) > > widget = QVTKRenderWindowInteractor() > widget.Initialize() > widget.Start() > # > > view = vtk.vtkContextView() > view.GetRenderer().SetBackground(1.0, 1.0, 1.0) > view.GetRenderWindow().SetSize(400, 300) > > chart = vtk.vtkChartXY() > view.GetScene().AddItem(chart) > chart.SetShowLegend(True) > > table = vtk.vtkTable() > > arrX = vtk.vtkFloatArray() > arrX.SetName('X Axis') > > arrC = vtk.vtkFloatArray() > arrC.SetName('Cosine') > > arrS = vtk.vtkFloatArray() > arrS.SetName('Sine') > > arrT = vtk.vtkFloatArray() > arrT.SetName('Sine-Cosine') > > table.AddColumn(arrC) > table.AddColumn(arrS) > table.AddColumn(arrX) > table.AddColumn(arrT) > > numPoints = 40 > > inc = 7.5 / (numPoints - 1) > table.SetNumberOfRows(numPoints) > for i in range(numPoints): > table.SetValue(i, 0, i * inc) > table.SetValue(i, 1, math.cos(i * inc)) > table.SetValue(i, 2, math.sin(i * inc)) > table.SetValue(i, 3, math.sin(i * inc) - math.cos(i * inc)) > > points = chart.AddPlot(vtk.vtkChart.POINTS) > points.SetInputData(table, 0, 1) > points.SetColor(0, 0, 0, 255) > points.SetWidth(1.0) > points.SetMarkerStyle(vtk.vtkPlotPoints.CROSS) > > points = chart.AddPlot(vtk.vtkChart.POINTS) > points.SetInputData(table, 0, 2) > points.SetColor(0, 0, 0, 255) > points.SetWidth(1.0) > points.SetMarkerStyle(vtk.vtkPlotPoints.PLUS) > > points = chart.AddPlot(vtk.vtkChart.POINTS) > points.SetInputData(table, 0, 3) > points.SetColor(0, 0, 255, 255) > points.SetWidth(1.0) > points.SetMarkerStyle(vtk.vtkPlotPoints.CIRCLE) > > view.GetRenderWindow().SetMultiSamples(0) > view.GetInteractor().Initialize() > view.GetInteractor().Start() > > # > widget.GetRenderWindow().AddRenderer(view.GetRenderer()) > widget.setWindowTitle('Qt Widget') > widget.show() > > exit(app.exec_()) > # > I still haven't found a solution to the above :( Does anyone have an example of how to use QVTKRenderWindowInteractor and context views? Or know what might be happening in the above example? My end goal is simply to be able to show a vtkChartXY in a Qt widget, for the purpose of setting up color transfer function editors similar to those in VolView/Paraview. Elvis > >> >> Elvis >> >> [1] http://www.vtk.org/pipermail/vtkusers/2011-July/068893.html >> >> >>> >>> Cheers, >>> Elvis >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 15 07:55:52 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 15 Jun 2016 13:55:52 +0200 Subject: [vtkusers] Question about the shape-shifting __getattr__ magic of QVTKRenderWindowInteractor Message-ID: Hi all, I'm trying to create our own customized and simplified QVTKRenderWindowInteractor, since there are features in it that we don't need (stereo stuff, PySide/PyQt4/QWidget compat, ...), I came across the magic it does in its __getattr__ in order to behave like a vtkGenericRenderWindowInteractor: def __getattr__(self, attr): """Makes the object behave like a vtkGenericRenderWindowInteractor""" if attr == '__vtk__': return lambda t=self._Iren: t elif hasattr(self._Iren, attr): return getattr(self._Iren, attr) else: raise AttributeError(self.__class__.__name__ + " has no attribute named " + attr) Forgive my ignorance, but is this behavior something that is essential to keep? Or was this added just as a convenience, so that instances of the class can be passed to VTK methods that expect an interactor? In short, I'd like to know if I can remove this whole thing, and if so, what the consequences would be. If it's just a convenience, I think we'd want to remove it. I think we want to encapsulate as much as possible of the VTK workings inside the widget as possible, and only make the interactor / render window used inside it available through getters (or attributes). My goal is to have something that feels more like a Qt API for this class.. But since I'm new to VTK, and still haven't quite figured out how the class is to be used in certain situations (see my post about using it with context views for instance), I'd appreciate some guidance. Cheers, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 15 08:44:07 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 15 Jun 2016 14:44:07 +0200 Subject: [vtkusers] Question about conversion of winId in QVTKRenderWindowInteractor.__init__ Message-ID: Hi all, I have a question about this chunk of code in QVTKRenderWindowInteractor.__init__: WId = self.winId() # Python2 if type(WId).__name__ == 'PyCObject': from ctypes import pythonapi, c_void_p, py_object pythonapi.PyCObject_AsVoidPtr.restype = c_void_p pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object] WId = pythonapi.PyCObject_AsVoidPtr(WId) # Python3 elif type(WId).__name__ == 'PyCapsule': from ctypes import pythonapi, c_void_p, py_object, c_char_p pythonapi.PyCapsule_GetName.restype = c_char_p pythonapi.PyCapsule_GetName.argtypes = [py_object] name = pythonapi.PyCapsule_GetName(WId) pythonapi.PyCapsule_GetPointer.restype = c_void_p pythonapi.PyCapsule_GetPointer.argtypes = [py_object, c_char_p] WId = pythonapi.PyCapsule_GetPointer(WId, name) self._RenderWindow.SetWindowInfo(str(int(WId))) On which platforms will these two code blocks kick in? (i.e., when is winId() a PyCObject or PyCapsule?). It seems on Linux/X11 they do not, since winId() returns a sip.voidptr which can be used directly in the SetWindowInfo call. Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 15 08:47:09 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 15 Jun 2016 06:47:09 -0600 Subject: [vtkusers] Question about the shape-shifting __getattr__ magic of QVTKRenderWindowInteractor In-Reply-To: References: Message-ID: On Wed, Jun 15, 2016 at 5:55 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > Forgive my ignorance, but is this behavior something that is essential to > keep? Or was this added just as a convenience, so that instances of the > class can be passed to VTK methods that expect an interactor? > The name of the class is "QVTKRenderWindowInteractor" which is a contract with the user that the class can be used where a vtkRenderWindowInteractor can be used. The author of QVTKRenderWindowInteractor must have wanted it to appear as if it was subclass of vtkRenderWindowInteractor, but didn't want to use multiple inheritance. In short, I'd like to know if I can remove this whole thing, and if so, > what the consequences would be. > Removing it would break some people's apps. > My goal is to have something that feels more like a Qt API for this > class.. But since I'm new to VTK, and still haven't quite figured out how > the class is to be used in certain situations (see my post about using it > with context views for instance), I'd appreciate some guidance. > If you're changing the API to have a different feel, then you're writing a new class, so give your new class a new name. Cheers, - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 15 09:10:13 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 15 Jun 2016 15:10:13 +0200 Subject: [vtkusers] Question about the shape-shifting __getattr__ magic of QVTKRenderWindowInteractor In-Reply-To: References: Message-ID: 2016-06-15 14:47 GMT+02:00 David Gobbi : > On Wed, Jun 15, 2016 at 5:55 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> Forgive my ignorance, but is this behavior something that is essential to >> keep? Or was this added just as a convenience, so that instances of the >> class can be passed to VTK methods that expect an interactor? >> > > The name of the class is "QVTKRenderWindowInteractor" which is a contract > with the user that the class can be used where a vtkRenderWindowInteractor > can be used. The author of QVTKRenderWindowInteractor must have wanted it > to appear as if it was subclass of vtkRenderWindowInteractor, but didn't > want to use multiple inheritance. > Alright, that makes sense of course. I think the reason I'm asking these questions at all is I'm a little unsure how the class is meant to be used, and I hadn't seen any examples of where it is used as if it was a vtkRenderWindowInteractor. > > In short, I'd like to know if I can remove this whole thing, and if so, >> what the consequences would be. >> > > Removing it would break some people's apps. > Yes, sorry I was unclear. I wasn't suggesting removing it in VTK proper, but in the class I'm making now (where I'm looking at QVTKRenderWindowInteractor for some inspiration on how to get the basic Qt <-> VTK rendering/input bridging working). > > >> My goal is to have something that feels more like a Qt API for this >> class.. But since I'm new to VTK, and still haven't quite figured out how >> the class is to be used in certain situations (see my post about using it >> with context views for instance), I'd appreciate some guidance. >> > > If you're changing the API to have a different feel, then you're writing a > new class, so give your new class a new name. > Yes, absolutely. At the moment I'm calling it simply VTKWidget in our code tree. Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 15 09:15:41 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 15 Jun 2016 15:15:41 +0200 Subject: [vtkusers] Question about conversion of winId in QVTKRenderWindowInteractor.__init__ In-Reply-To: References: Message-ID: 2016-06-15 14:44 GMT+02:00 Elvis Stansvik : > Hi all, > > I have a question about this chunk of code in > QVTKRenderWindowInteractor.__init__: > > WId = self.winId() > > # Python2 > if type(WId).__name__ == 'PyCObject': > from ctypes import pythonapi, c_void_p, py_object > > pythonapi.PyCObject_AsVoidPtr.restype = c_void_p > pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object] > > WId = pythonapi.PyCObject_AsVoidPtr(WId) > > # Python3 > elif type(WId).__name__ == 'PyCapsule': > from ctypes import pythonapi, c_void_p, py_object, c_char_p > > pythonapi.PyCapsule_GetName.restype = c_char_p > pythonapi.PyCapsule_GetName.argtypes = [py_object] > > name = pythonapi.PyCapsule_GetName(WId) > > pythonapi.PyCapsule_GetPointer.restype = c_void_p > pythonapi.PyCapsule_GetPointer.argtypes = [py_object, c_char_p] > > WId = pythonapi.PyCapsule_GetPointer(WId, name) > > self._RenderWindow.SetWindowInfo(str(int(WId))) > > On which platforms will these two code blocks kick in? (i.e., when is > winId() a PyCObject or PyCapsule?). It seems on Linux/X11 they do not, > since winId() returns a sip.voidptr which can be used directly in the > SetWindowInfo call. > I also have a related question: On the C++ side of things, looking at QVTKWidget2::SetRenderWindow, it seems that QVTKWidget2 doesn't use the SetWindowInfo(...) approach that QVTKRenderWindowInteractor uses. Instead it seems to simply do this->mRenWin->SetMapped(1) and then resize the renderwindow to cover the widget (and keep it covering when the widget geometry changes). Anyone know the reasons for choosing one approach over the other, or at least why this approach was chosen for QVTKWidget2? Elvis > Thanks in advance, > Elvis > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrea.vitali1 at unibg.it Wed Jun 15 09:40:47 2016 From: andrea.vitali1 at unibg.it (PhD Andrea Vitali) Date: Wed, 15 Jun 2016 06:40:47 -0700 (MST) Subject: [vtkusers] VTK 7.0 - Modified mesh is not updated like in the previous versions of VTK In-Reply-To: References: Message-ID: <1465998047129-5738680.post@n5.nabble.com> The problem is relative to the use of OpenGL2 as rendering backend. The method Render() do not update the new topology as usually done in the previous versions. A way to avoid the problem is to recompile VTK with "OpenGL" as value of VTK_RENDERING_BACKEND. -- View this message in context: http://vtk.1045678.n5.nabble.com/VTK-7-0-Modified-mesh-is-not-updated-like-in-the-previous-versions-of-VTK-tp5738672p5738680.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Wed Jun 15 09:51:48 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 15 Jun 2016 15:51:48 +0200 Subject: [vtkusers] Documentation for event callback return values? Message-ID: Hi all, I noticed in QVTKRenderWindowInteractor that it returns 1 in the callback it sets up for DestroyTimerEvent: def DestroyTimer(self, obj, evt): self._Timer.stop() return 1 So I suspect callbacks for this event are expected to return something. But I can't find any info in the docs on which event callbacks are expected to return something (and what), and which are not. Is this info available somewhere? Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From berk.geveci at kitware.com Wed Jun 15 10:34:44 2016 From: berk.geveci at kitware.com (Berk Geveci) Date: Wed, 15 Jun 2016 10:34:44 -0400 Subject: [vtkusers] create a parallel, distributed dataset from scratch In-Reply-To: References: Message-ID: What do you mean by "connectivity information"? There is fairly limited support for inter-process connectivity information in VTK other than ghost cells. For generating ghost cells, see this: http://www.vtk.org/doc/nightly/html/classvtkPUnstructuredGridGhostCellsGenerator.html Best, -berk On Fri, Jun 10, 2016 at 5:41 AM, Sven Kramer wrote: > Hello, > Vtk comes with a few parallel data sources and readers that distribute the > memory usage (and thus later cpu usage of algorithms) between a number of > MPI processes. I am wondering, how I can create such parallel datasets > "from scratch". > > The starting point, from which I'd like to build a parallel Vtk dataset, > is the equivalent of a vtkUnstructuredGrid (namely points and their > connectivity, making cells), which is already decomposed so that each MPI > process carries only a fraction of all available points and cells. Of > cause, I could simply create one vtkUnstructuredGrid per process from the > points an cells local to that process. However, these grids wouldn't have > any information about which points and cell surfaces they share with > neighbouring pieces. But such connectivity information is essential, if > some algorithm has to add additional layers of ghost cells. > > What I have: > > MPI rank #0 > points p00..p0{n0} > cells c00..c0{m0} > connectivity information between boundary cells and pieces on other ranks > > MPI rank #1 > points p1{n0+1}..p1{n1} > cells c1{n0+1}..c1{m1} > connectivity information between boundary cells and pieces on other ranks > > ... > > MPI rank #R > points pR{n{R-1}+1}..pR{nR} > cells cR{n{R-1}+1}..cR{mR} > connectivity information between boundary cells and pieces on other ranks > > What I need: > a parallel vtkUnstructuredGrid, decomposed into the same pieces as the > input data, including ghost cells and connectivity information between the > pieces. > > Is the construction of such a parallel dataset described in some tutorial > or blog? > > Regards, > Sven > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 15 11:26:53 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 15 Jun 2016 17:26:53 +0200 Subject: [vtkusers] 2D chart along a volume in 3D Message-ID: Hi, In an old presentation from 2011 [1], on page 19 ("Overlay on 3D Scene") there's a screenshot of a 2D chart next to a cube in 3D. Anyone know how it was created? I can hardly find any documentation on creating 2D charts and placing them in a 3D scene. I have a cylindrical volume and would like to show a 2D plot along the side of the cylinder, the Y axis sticking out perpendicularly from its surface. The attached rough sketch shows the idea. Is this possible? If so, any pointer on how it could be accomplished would be much appriciated. Also, would it be possible to interact with the plot if it drawn like this? (e.g. inspect its points using the mouse) Thanks in advance, Elvis [1] http://www.na-mic.org/Wiki/images/1/18/NA-MIC-VTK-Charts-2011.pdf -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: plot_along_cylinder.png Type: image/png Size: 38068 bytes Desc: not available URL: From david.gobbi at gmail.com Wed Jun 15 11:27:34 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 15 Jun 2016 09:27:34 -0600 Subject: [vtkusers] Documentation for event callback return values? In-Reply-To: References: Message-ID: On Wed, Jun 15, 2016 at 7:51 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > Hi all, > > I noticed in QVTKRenderWindowInteractor that it returns 1 in the callback > it sets up for DestroyTimerEvent: > > def DestroyTimer(self, obj, evt): > self._Timer.stop() > return 1 > > So I suspect callbacks for this event are expected to return something. > But I can't find any info in the docs on which event callbacks are expected > to return something (and what), and which are not. Is this info available > somewhere? > I checked the code for the Execute command in vtkPythonCommand.cxx, and the return value for callbacks is ignored. So I'm not sure why this callback returns a value. Prabhu might remember (he wrote the function), but that was way back in 2002. It was probably a simple mistake due to cut-and-paste. If anything, a non-negative return value would indicate that the callback had aborted, e.g. that the callback did not complete whatever action it was meant to perform. But obviously that's not the intent for this method. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 15 11:30:02 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 15 Jun 2016 09:30:02 -0600 Subject: [vtkusers] Documentation for event callback return values? In-Reply-To: References: Message-ID: On Wed, Jun 15, 2016 at 9:27 AM, David Gobbi wrote: > On Wed, Jun 15, 2016 at 7:51 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> Hi all, >> >> I noticed in QVTKRenderWindowInteractor that it returns 1 in the callback >> it sets up for DestroyTimerEvent: >> >> def DestroyTimer(self, obj, evt): >> self._Timer.stop() >> return 1 >> >> So I suspect callbacks for this event are expected to return something. >> But I can't find any info in the docs on which event callbacks are expected >> to return something (and what), and which are not. Is this info available >> somewhere? >> > > I checked the code for the Execute command in vtkPythonCommand.cxx, and > the return value for callbacks is ignored. So I'm not sure why this > callback returns a value. Prabhu might remember (he wrote the function), > but that was way back in 2002. It was probably a simple mistake due to > cut-and-paste. > > If anything, a non-negative return value would indicate that the callback > had aborted, e.g. that the callback did not complete whatever action it was > meant to perform. But obviously that's not the intent for this method. > Small typo in the above: I meant non-zero, not non-negative. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 15 11:45:11 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 15 Jun 2016 09:45:11 -0600 Subject: [vtkusers] Documentation for event callback return values? In-Reply-To: References: Message-ID: On Wed, Jun 15, 2016 at 9:30 AM, David Gobbi wrote: > On Wed, Jun 15, 2016 at 9:27 AM, David Gobbi > wrote: > >> On Wed, Jun 15, 2016 at 7:51 AM, Elvis Stansvik < >> elvis.stansvik at orexplore.com> wrote: >> >>> Hi all, >>> >>> I noticed in QVTKRenderWindowInteractor that it returns 1 in the >>> callback it sets up for DestroyTimerEvent: >>> >>> def DestroyTimer(self, obj, evt): >>> self._Timer.stop() >>> return 1 >>> >>> So I suspect callbacks for this event are expected to return something. >>> But I can't find any info in the docs on which event callbacks are expected >>> to return something (and what), and which are not. Is this info available >>> somewhere? >>> >> >> I checked the code for the Execute command in vtkPythonCommand.cxx, and >> the return value for callbacks is ignored. So I'm not sure why this >> callback returns a value. Prabhu might remember (he wrote the function), >> but that was way back in 2002. It was probably a simple mistake due to >> cut-and-paste. >> >> If anything, a non-negative return value would indicate that the callback >> had aborted, e.g. that the callback did not complete whatever action it was >> meant to perform. But obviously that's not the intent for this method. >> > > Small typo in the above: I meant non-zero, not non-negative. > Actually, please completely ignore the second paragraph that I wrote, it just muddies what should be a clear statement: When you use VTK events in python, the callback's return value is ignored. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 02:31:33 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 08:31:33 +0200 Subject: [vtkusers] Documentation for event callback return values? In-Reply-To: References: Message-ID: Den 15 juni 2016 5:45 em skrev "David Gobbi" : > > On Wed, Jun 15, 2016 at 9:30 AM, David Gobbi wrote: >> >> On Wed, Jun 15, 2016 at 9:27 AM, David Gobbi wrote: >>> >>> On Wed, Jun 15, 2016 at 7:51 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: >>>> >>>> Hi all, >>>> >>>> I noticed in QVTKRenderWindowInteractor that it returns 1 in the callback it sets up for DestroyTimerEvent: >>>> >>>> def DestroyTimer(self, obj, evt): >>>> self._Timer.stop() >>>> return 1 >>>> >>>> So I suspect callbacks for this event are expected to return something. But I can't find any info in the docs on which event callbacks are expected to return something (and what), and which are not. Is this info available somewhere? >>> >>> >>> I checked the code for the Execute command in vtkPythonCommand.cxx, and the return value for callbacks is ignored. So I'm not sure why this callback returns a value. Prabhu might remember (he wrote the function), but that was way back in 2002. It was probably a simple mistake due to cut-and-paste. >>> >>> If anything, a non-negative return value would indicate that the callback had aborted, e.g. that the callback did not complete whatever action it was meant to perform. But obviously that's not the intent for this method. >> >> >> Small typo in the above: I meant non-zero, not non-negative. > > > Actually, please completely ignore the second paragraph that I wrote, it just muddies what should be a clear statement: > > When you use VTK events in python, the callback's return value is ignored. Excellent. I had my suspicion it might have been a mistake, thanks for doing the digging. Elvis > > - David > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 03:12:08 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 09:12:08 +0200 Subject: [vtkusers] Question about relationship between interactor/render window and QVTKRenderWindowInteractor Message-ID: Hi, QVTKRenderWindowInteractor.__init__ has the following snippet: try: self._Iren = kw['iren'] except KeyError: self._Iren = vtk.vtkGenericRenderWindowInteractor() self._Iren.SetRenderWindow(self._RenderWindow) That is, the render window is only set on the interactor (with SetRenderWindow) if the interactor is the automatically created one, not if it is supplied by the user of the class (through the iren keyword argument). My question is what the reason for this is? Is it because: 1. It is assumed that the user will do this him/herself, or 2. there are use cases where the user might want to use an interactor that has another render window set (not the one used by the widget), or 3. something else? Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 03:27:20 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 09:27:20 +0200 Subject: [vtkusers] Question about relationship between interactor/render window and QVTKRenderWindowInteractor In-Reply-To: References: Message-ID: 2016-06-16 9:12 GMT+02:00 Elvis Stansvik : > Hi, > > QVTKRenderWindowInteractor.__init__ has the following snippet: > > try: > self._Iren = kw['iren'] > except KeyError: > self._Iren = vtk.vtkGenericRenderWindowInteractor() > self._Iren.SetRenderWindow(self._RenderWindow) > I see now that this snippet was added by Berk back in 2010: https://gitlab.kitware.com/vtk/vtk/commit/2fc9c979ce248e491cff3486edaa729653f81a81 Berk, do you remember the reason for not setting the render window on the interactor when it is user-supplied? Elvis > > That is, the render window is only set on the interactor (with > SetRenderWindow) if the interactor is the automatically created one, not if > it is supplied by the user of the class (through the iren keyword argument). > > My question is what the reason for this is? Is it because: > > 1. It is assumed that the user will do this him/herself, or > 2. there are use cases where the user might want to use an interactor > that has another render window set (not the one used by the widget), or > 3. something else? > > Thanks in advance, > Elvis > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 04:55:44 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 10:55:44 +0200 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent Message-ID: In QVTKRenderWindowInteractor, keyPressEvent and keyReleaseEvent are implemented as follows: def keyPressEvent(self, ev): ctrl, shift = self._GetCtrlShift(ev) if ev.key() < 256: key = str(ev.text()) else: key = chr(0) keySym = _qt_key_to_key_sym(ev.key()) if shift and len(keySym) == 1 and keySym.isalpha(): keySym = keySym.upper() self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY, ctrl, shift, key, 0, keySym) self._Iren.KeyPressEvent() self._Iren.CharEvent() def keyReleaseEvent(self, ev): ctrl, shift = self._GetCtrlShift(ev) if ev.key() < 256: key = chr(ev.key()) else: key = chr(0) self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY, ctrl, shift, key, 0, None) self._Iren.KeyReleaseEvent() Notice how in keyPressEvent, key (the keycode passed to SetEventInformationFlipY) is constructed from str(ev.text()), which I find strange. Why use the .text() of the Qt event and not the keycode (.key())? SetEventInformationFlipY seems to expect a char a keycode. In keyReleaseEvent it is constructed from chr(ev.key()), which I think looks right. Is there some subtility I'm missing here, or is this just a mistake? Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 04:59:20 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 10:59:20 +0200 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent In-Reply-To: References: Message-ID: 2016-06-16 10:55 GMT+02:00 Elvis Stansvik : > In QVTKRenderWindowInteractor, keyPressEvent and keyReleaseEvent are > implemented as follows: > > def keyPressEvent(self, ev): > ctrl, shift = self._GetCtrlShift(ev) > if ev.key() < 256: > key = str(ev.text()) > else: > key = chr(0) > > keySym = _qt_key_to_key_sym(ev.key()) > if shift and len(keySym) == 1 and keySym.isalpha(): > keySym = keySym.upper() > > self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY, > ctrl, shift, key, 0, keySym) > self._Iren.KeyPressEvent() > self._Iren.CharEvent() > Also, why deliver both a KeyPressEvent and CharEvent here? Is that a clue to why str(ev.text()) is used perhaps? Elvis > def keyReleaseEvent(self, ev): > ctrl, shift = self._GetCtrlShift(ev) > if ev.key() < 256: > key = chr(ev.key()) > else: > key = chr(0) > > self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY, > ctrl, shift, key, 0, None) > self._Iren.KeyReleaseEvent() > > Notice how in keyPressEvent, key (the keycode passed to > SetEventInformationFlipY) is constructed from str(ev.text()), which I find > strange. Why use the .text() of the Qt event and not the keycode (.key())? > SetEventInformationFlipY seems to expect a char a keycode. > > In keyReleaseEvent it is constructed from chr(ev.key()), which I think > looks right. > > Is there some subtility I'm missing here, or is this just a mistake? > > Thanks in advance, > Elvis > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pkorir at ebi.ac.uk Thu Jun 16 06:52:41 2016 From: pkorir at ebi.ac.uk (Paul Kibet Korir) Date: Thu, 16 Jun 2016 11:52:41 +0100 Subject: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION Message-ID: <2eab11bb-bfd0-4d5d-be54-8d1ea1bdfccb@ebi.ac.uk> Hi VTK Users, I'm currently using vtkRuledSurfaceFilter to convert a sequence of contours into a surface. The problem is that if two contours happen to be on the same plane the surface filter will join them resulting in artefacts. Any suggestions on how to deal with this? -- With kind regards, *Dr. Paul K Korir, PhD* /Scientific Programmer/ EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: contour_artefacts.tiff Type: image/tiff Size: 89404 bytes Desc: not available URL: From pkorir at ebi.ac.uk Thu Jun 16 06:53:43 2016 From: pkorir at ebi.ac.uk (Paul Kibet Korir) Date: Thu, 16 Jun 2016 11:53:43 +0100 Subject: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION In-Reply-To: <2eab11bb-bfd0-4d5d-be54-8d1ea1bdfccb@ebi.ac.uk> References: <2eab11bb-bfd0-4d5d-be54-8d1ea1bdfccb@ebi.ac.uk> Message-ID: I forgot to mention that there was an attached screenshot. On 16/06/2016 11:52, Paul Kibet Korir wrote: > > Hi VTK Users, > > I'm currently using vtkRuledSurfaceFilter to convert a sequence of > contours into a surface. The problem is that if two contours happen to > be on the same plane the surface filter will join them resulting in > artefacts. > > Any suggestions on how to deal with this? > > -- > With kind regards, > > *Dr. Paul K Korir, PhD* > /Scientific Programmer/ > EMBL-EBI > Main Building, A2-35, > WTGC, Hinxton, Cambridge CB10 1SD > P: +44 1223 49 44 22 > F: +44 1223 49 44 68 -- With kind regards, *Dr. Paul K Korir, PhD* /Scientific Programmer/ EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 07:21:19 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 13:21:19 +0200 Subject: [vtkusers] Adding a renderer vs setting its render window Message-ID: What is the difference between renderer.SetRenderWindow(renderWindow) and renderWindow.addRenderer(renderer) ? Is it just two different ways of doing the same thing? Also, the docs for SetRenderWindow [1] says "This is automatically set when the renderer is created by MakeRenderer. The user probably shouldn't ever need to call this method." But I couldn't find any info in the docs about a MakeRenderer. Digging in the VTK source, it seems there's a vtkParallelRenderManager::MakeRenderer. Is that the one the docs refers to? Could someone clarify this note in the docs? Why shouldn't I need to call SetRenderWindow? Elvis [1] http://www.vtk.org/doc/nightly/html/classvtkRenderer.html#ae3a6088ecdcdec6b7e0b6482974de8c2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Thu Jun 16 08:12:06 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 16 Jun 2016 06:12:06 -0600 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent In-Reply-To: References: Message-ID: Hi Elvis, The commit logs might hold the answers to some of your questions. Here's the history line for when QVTKRenderWindowInteractor.py was created: https://gitlab.kitware.com/vtk/vtk/commits/720b580c/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py The history continues here: https://gitlab.kitware.com/vtk/vtk/commits/3f70e5ff/Wrapping/Python/vtk/qt4/QVTKRenderWindowInteractor.py And finally comes to the present: https://gitlab.kitware.com/vtk/vtk/commits/master/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py Also, here is some pre-history: https://gitlab.kitware.com/vtk/vtk/commits/bae05540/Wrapping/Python/QVTKRenderWidget.py https://gitlab.kitware.com/vtk/vtk/tree/5b48ce33/Wrapping/Python - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 08:32:58 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 14:32:58 +0200 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent In-Reply-To: References: Message-ID: 2016-06-16 14:12 GMT+02:00 David Gobbi : > Hi Elvis, > > The commit logs might hold the answers to some of your questions. > > Here's the history line for when QVTKRenderWindowInteractor.py was created: > > https://gitlab.kitware.com/vtk/vtk/commits/720b580c/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py > > The history continues here: > > https://gitlab.kitware.com/vtk/vtk/commits/3f70e5ff/Wrapping/Python/vtk/qt4/QVTKRenderWindowInteractor.py > > And finally comes to the present: > > https://gitlab.kitware.com/vtk/vtk/commits/master/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py > > Also, here is some pre-history: > > https://gitlab.kitware.com/vtk/vtk/commits/bae05540/Wrapping/Python/QVTKRenderWidget.py > https://gitlab.kitware.com/vtk/vtk/tree/5b48ce33/Wrapping/Python > > Thanks for the pointers, but it seems the code was like that when the Qt 4 variant was initially contributed by Phil Thomson: https://gitlab.kitware.com/vtk/vtk/commit/720b580c32b1ab002572fa59d796e409b5b0c346 But even if we forget about history/origin, doesn't it seem strange to use str(ev.text()) in the keyPressEvent? Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 08:37:24 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 14:37:24 +0200 Subject: [vtkusers] Trackball style ('t') interaction with QVTKRenderWindowInteractor behaves strange Message-ID: Launching QVTKRenderWindowInteractor.py as a script, which brings up the built-in cone example, if I hit 't' to switch to trackball style interaction and then rotate the camera around for a few seconds, when I release the mouse there's a noticable delay before the movement stops. The delay seems related to the time the interaction went on: If I rotate around for a longer period, the period between releasing the mouse and the movement finally stopping is longer. Any idea what might be going on here? Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 08:39:39 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 14:39:39 +0200 Subject: [vtkusers] Trackball style ('t') interaction with QVTKRenderWindowInteractor behaves strange In-Reply-To: References: Message-ID: 2016-06-16 14:37 GMT+02:00 Elvis Stansvik : > Launching QVTKRenderWindowInteractor.py as a script, which brings up the > built-in cone example, if I hit 't' to switch to trackball style > interaction and then rotate the camera around for a few seconds, when I > release the mouse there's a noticable delay before the movement stops. > > The delay seems related to the time the interaction went on: If I rotate > around for a longer period, the period between releasing the mouse and the > movement finally stopping is longer. > > Any idea what might be going on here? > When using the joystick style ('j', the default) the behavior is normal. Movement stops as soon as the mouse button is released. Elvis > Elvis > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Thu Jun 16 08:44:26 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 16 Jun 2016 06:44:26 -0600 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent In-Reply-To: References: Message-ID: On Thu, Jun 16, 2016 at 6:32 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > 2016-06-16 14:12 GMT+02:00 David Gobbi : > >> Hi Elvis, >> >> The commit logs might hold the answers to some of your questions. >> >> Here's the history line for when QVTKRenderWindowInteractor.py was >> created: >> >> https://gitlab.kitware.com/vtk/vtk/commits/720b580c/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py >> >> The history continues here: >> >> https://gitlab.kitware.com/vtk/vtk/commits/3f70e5ff/Wrapping/Python/vtk/qt4/QVTKRenderWindowInteractor.py >> >> And finally comes to the present: >> >> https://gitlab.kitware.com/vtk/vtk/commits/master/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py >> >> Also, here is some pre-history: >> >> https://gitlab.kitware.com/vtk/vtk/commits/bae05540/Wrapping/Python/QVTKRenderWidget.py >> https://gitlab.kitware.com/vtk/vtk/tree/5b48ce33/Wrapping/Python >> >> > Thanks for the pointers, but it seems the code was like that when the Qt 4 > variant was initially contributed by Phil Thomson: > > > https://gitlab.kitware.com/vtk/vtk/commit/720b580c32b1ab002572fa59d796e409b5b0c346 > Wrong. You might need to practice your detective skills some more :) https://gitlab.kitware.com/vtk/vtk/commit/0ab4f15f But even if we forget about history/origin, doesn't it seem strange to use > str(ev.text()) in the keyPressEvent? > Yes, it seems strange, but there might be a reason. You'll have to experiment with Qt to see what str(ev.text()) and chr(ev.key()) return under various situations. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 09:33:48 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 15:33:48 +0200 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent In-Reply-To: References: Message-ID: 2016-06-16 14:44 GMT+02:00 David Gobbi : > On Thu, Jun 16, 2016 at 6:32 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> 2016-06-16 14:12 GMT+02:00 David Gobbi : >> >>> Hi Elvis, >>> >>> The commit logs might hold the answers to some of your questions. >>> >>> Here's the history line for when QVTKRenderWindowInteractor.py was >>> created: >>> >>> https://gitlab.kitware.com/vtk/vtk/commits/720b580c/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py >>> >>> The history continues here: >>> >>> https://gitlab.kitware.com/vtk/vtk/commits/3f70e5ff/Wrapping/Python/vtk/qt4/QVTKRenderWindowInteractor.py >>> >>> And finally comes to the present: >>> >>> https://gitlab.kitware.com/vtk/vtk/commits/master/Wrapping/Python/vtk/qt/QVTKRenderWindowInteractor.py >>> >>> Also, here is some pre-history: >>> >>> https://gitlab.kitware.com/vtk/vtk/commits/bae05540/Wrapping/Python/QVTKRenderWidget.py >>> https://gitlab.kitware.com/vtk/vtk/tree/5b48ce33/Wrapping/Python >>> >>> >> Thanks for the pointers, but it seems the code was like that when the Qt >> 4 variant was initially contributed by Phil Thomson: >> >> >> https://gitlab.kitware.com/vtk/vtk/commit/720b580c32b1ab002572fa59d796e409b5b0c346 >> > > Wrong. You might need to practice your detective skills some more :) > > https://gitlab.kitware.com/vtk/vtk/commit/0ab4f15f > > Bah, indeed :) Sorry for my sloppiness. > But even if we forget about history/origin, doesn't it seem strange to use >> str(ev.text()) in the keyPressEvent? >> > > Yes, it seems strange, but there might be a reason. You'll have to > experiment with Qt to see what str(ev.text()) and chr(ev.key()) return > under various situations. > Okay, that was easy: str(ev.text()): d chr(ev.key()): D str(ev.text()): f chr(ev.key()): F str(ev.text()): g chr(ev.key()): G str(ev.text()): h chr(ev.key()): H str(ev.text()): j chr(ev.key()): J ... So that fix was indeed correct, and from the Qt docs for key(): "Note that this function does not distinguish between capital and non-capital letters, use the text () function (returning the Unicode text the key generated) for this purpose." So I guess keyReleaseEvent should be changed to also use str(ev.text()). But thinking more about how Qt's key() is used in QVTKRenderWindowInteractor, for example: if ev.key() < 256: ... Is it not wrong to make assumptions about the .key() as a number like this? I don't think Qt gives any guarantee that the Qt::Key enum values correspond to ASCII values? (even if they currently do). Shouldn't the code first call .text() and then check that it's a single byte string, instead of making assumptions about the layout of the Qt::Key enum? Elvis > - David > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 09:52:02 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 15:52:02 +0200 Subject: [vtkusers] About MouseEvents.py example Message-ID: The MouseEvents.py example [1] currently does: class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): def __init__(self,parent=None): self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) def middleButtonPressEvent(self,obj,event): print("Middle Button pressed") self.OnMiddleButtonDown() return def middleButtonReleaseEvent(self,obj,event): print("Middle Button released") self.OnMiddleButtonUp() return But I don't understand the reason for calling e.g. self.OnMiddleButtonDown() ? Since this is not an override of a virtual function (which is not possible in Python), but simply adding another observer, I don't think it is needed? (..and I would think it would mean OnMiddleButtonDown is called twice, right?). This leads me to another question: What if I really do want to override the behavior that the parent interactor style provides (or modify it by manipulating the event), what are my options? I saw at http://www.vtk.org/Wiki/VTK/Examples/Python/Interaction/MouseEventsObserver that you can remove all observers of an event from the interactor, but that seems like quite a hack :/ In my case, I'm interested in locking the camera rotation to a certain axis, but perhaps a custom interactor style is not the way to go? Elvis [1] http://www.vtk.org/Wiki/VTK/Examples/Python/Interaction/MouseEvents -------------- next part -------------- An HTML attachment was scrubbed... URL: From sankhesh.jhaveri at kitware.com Thu Jun 16 09:54:17 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Thu, 16 Jun 2016 09:54:17 -0400 Subject: [vtkusers] [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget In-Reply-To: <5d4a01d1c671$ca203ed0$5e60bc70$@vektore.com> References: <5d4a01d1c671$ca203ed0$5e60bc70$@vektore.com> Message-ID: Hi Luis, I don't see anything obvious but I noticed that you are initializing vtkRenderingOpenGL i.e. using the OpenGL backend. Mind trying the OpenGL2 backend to find out whether the issue is specific to the old backend. Sankhesh On Tue, Jun 14, 2016 at 3:20 PM, Luis Vieira wrote: > Hello everyone, > > > > I had migrated my VTK platform from 6.1 to 7.0. I had noticed some > changes, and one of those is giving me a hard work to do that is to render > vtkSmartPointer::New() within QVTWidget. Previously, was > easily, with VTK 6.1. Now, I am trying that and I got the Cone > working/rendering well and its interactions. However, I haven't gotten > absolutely nothing on my viewport from my vtkAxesActor even been shown . > Following my code (C++), regarding that this works outside QVTWidget > viewport. > > > > I appreciate any ideas and help. > > ???????? > > #include "vtkRenderWindow.h" > > #include "vtkRenderer.h" > > #include "vtkRenderWindowInteractor.h" > > #include "vtkEventQtSlotConnect.h" > > #include "vtkCommand.h" > > #include "vtkConeSource.h" > > #include "vtkSphereSource.h" > > #include "vtkPolyDataMapper.h" > > #include "vtkActor.h" > > #include "vtkActorCollection.h" > > #include "vtkCaptionActor2D.h" > > #include "vtkTextActor.h" > > #include "vtkTextProperty.h" > > #include "vtkActor2D.h" > > #include "vtkAxesActor.h" > > #include "vtkOrientationMarkerWidget.h" > > #include "vtkInteractorStyle.h" > > #include "vtkTDxInteractorStyleCamera.h" > > #include "vtkTDxInteractorStyleSettings.h" > > #include "vtkInteractorStyleRubberBandPick.h" > > #include "vtkInteractorStyleTrackballCamera.h" > > #include "vtkInteractorStyleTrackball.h" > > #include "QVTKInteractorAdapter.h" > > #include "QVTKInteractor.h" > > #include "QVTKApplication.h" > > ??. > > . > > . > > . > > #include > > VTK_MODULE_INIT(vtkRenderingOpenGL); > > VTK_MODULE_INIT(vtkInteractionStyle); > > . > > . > > . > > > > Mainwindow.cpp > > > > Void procedure() > > { > > vtkRenderWindow* renwin = vtkRenderWindow::New(); > > renwin->StereoCapableWindowOn(); > > > > // Activate 3DConnexion device only on the left render > window. > > // QVTKWidget > > mainViewPort->SetUseTDx(true); // QVTKWidget = mainViewPort. > > > > mainViewPort->SetRenderWindow(renwin); > > renwin->Delete(); > > > > const double angleSensitivity = 0.02; > > const double translationSensitivity = 0.001; > > > > QVTKInteractor *iren = mainViewPort->GetInteractor(); > > vtkInteractorStyle *s = > > static_cast(iren-> > GetInteractorStyle()); > > vtkTDxInteractorStyleCamera *t = > > static_cast(s-> > GetTDxStyle()); > > > > t->GetSettings()->SetAngleSensitivity(angleSensitivity); > > t->GetSettings()->SetTranslationXSensitivity( > translationSensitivity); > > t->GetSettings()->SetTranslationYSensitivity( > translationSensitivity); > > t->GetSettings()->SetTranslationZSensitivity( > translationSensitivity); > > > > > > > > // add a renderer > > Ren1 = vtkRenderer::New(); > > mainViewPort->GetRenderWindow()->AddRenderer(Ren1); > > > > vtkConeSource* cone = vtkConeSource::New(); > > vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); > > mapper->SetInputConnection(cone->GetOutputPort()); > > vtkActor* actor = vtkActor::New(); > > actor->SetMapper(mapper); > > Ren1->AddViewProp(actor); > > actor->Delete(); > > mapper->Delete(); > > cone->Delete(); > > > > > > > > mainViewPort->GetRenderWindow()->Render(); > > > > viewPortAxActor = vtkSmartPointer::New(); > > viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05); > > viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05); > > viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05); > > > > viewPortOMWidget = vtkSmartPointer::New(); > > viewPortOMWidget->SetOrientationMarker(viewPortAxActor); > > viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); > > viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); > > > > . > > . > > . > > ..... > > } > > > > Any ideas? > > > > Thank you very much. > > > > *Luis Vieira*, Toronto > > Consultant, Software Engineer > > Vektore Exploration Consulting Corporation > > luis.vieira at vektore.com > > www.vektore.com > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Search the list archives at: http://markmail.org/search/?q=vtk-developers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtk-developers > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 10:08:08 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 16:08:08 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-16 15:52 GMT+02:00 Elvis Stansvik : > The MouseEvents.py example [1] currently does: > > class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): > > def __init__(self,parent=None): > > self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) > > self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) > > def middleButtonPressEvent(self,obj,event): > print("Middle Button pressed") > self.OnMiddleButtonDown() > return > > def middleButtonReleaseEvent(self,obj,event): > print("Middle Button released") > self.OnMiddleButtonUp() > return > > But I don't understand the reason for calling e.g. > self.OnMiddleButtonDown() ? Since this is not an override of a virtual > function (which is not possible in Python), but simply adding another > observer, I don't think it is needed? (..and I would think it would mean > OnMiddleButtonDown is called twice, right?). > Sorry, I realize I wasn't really clear here: What I mean is that, if the interactor style above is used, the behavior of vtkInteractorStyleTrackballCamera (the base class) will still be there, even if the call to self.OnMiddleButtonDown() is removed, since the base class will observe the interactor. That's why I don't understand the need for the self.OnMiddleButtonDown() call in the example. This ties in to my other question (another mail), since what I want to do is to actually override the behavior of the base interactor style (similar to how you can in C++, but I need to find some other mechanism to do so, overriding of virtual functions won't work from Python). Elvis > > This leads me to another question: What if I really do want to override > the behavior that the parent interactor style provides (or modify it by > manipulating the event), what are my options? > > I saw at > > > http://www.vtk.org/Wiki/VTK/Examples/Python/Interaction/MouseEventsObserver > > that you can remove all observers of an event from the interactor, but > that seems like quite a hack :/ In my case, I'm interested in locking the > camera rotation to a certain axis, but perhaps a custom interactor style is > not the way to go? > > Elvis > > [1] http://www.vtk.org/Wiki/VTK/Examples/Python/Interaction/MouseEvents > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Thu Jun 16 10:32:06 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 16 Jun 2016 08:32:06 -0600 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent In-Reply-To: References: Message-ID: On Thu, Jun 16, 2016 at 7:33 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > So that fix was indeed correct, and from the Qt docs for key(): > > "Note that this function does not distinguish between capital and > non-capital letters, use the text > () function (returning the > Unicode text the key generated) for this purpose." > > So I guess keyReleaseEvent should be changed to also use str(ev.text()). > But thinking more about how Qt's key() is used in > QVTKRenderWindowInteractor, for example: > > if ev.key() < 256: > ... > > Is it not wrong to make assumptions about the .key() as a number like > this? I don't think Qt gives any guarantee that the Qt::Key enum values > correspond to ASCII values? (even if they currently do). Shouldn't the code > first call .text() and then check that it's a single byte string, instead > of making assumptions about the layout of the Qt::Key enum? > Yes, keyReleaseEvent should match keyPressEvent, the original author of the change must have missed that. If .text() returns a single character with a unicode code point < 256, it should be fine to use that as the VTK key code. Otherwise the VTK key code should be set to zero. VTK's key code is meant to correspond to the text produced by the key press. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 10:48:25 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 16:48:25 +0200 Subject: [vtkusers] Question key conversion in QVTKRenderWindowInteractor.keyPressEvent In-Reply-To: References: Message-ID: 2016-06-16 16:32 GMT+02:00 David Gobbi : > On Thu, Jun 16, 2016 at 7:33 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> So that fix was indeed correct, and from the Qt docs for key(): >> >> "Note that this function does not distinguish between capital and >> non-capital letters, use the text >> () function (returning the >> Unicode text the key generated) for this purpose." >> >> So I guess keyReleaseEvent should be changed to also use str(ev.text()). >> But thinking more about how Qt's key() is used in >> QVTKRenderWindowInteractor, for example: >> >> if ev.key() < 256: >> ... >> >> Is it not wrong to make assumptions about the .key() as a number like >> this? I don't think Qt gives any guarantee that the Qt::Key enum values >> correspond to ASCII values? (even if they currently do). Shouldn't the code >> first call .text() and then check that it's a single byte string, instead >> of making assumptions about the layout of the Qt::Key enum? >> > > Yes, keyReleaseEvent should match keyPressEvent, the original author of > the change must have missed that. > > If .text() returns a single character with a unicode code point < 256, it > should be fine to use that as the VTK key code. Otherwise the VTK key code > should be set to zero. VTK's key code is meant to correspond to the text > produced by the key press. > Alright, yes that makes sense. Elvis > > - David > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 11:08:40 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 17:08:40 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-16 16:08 GMT+02:00 Elvis Stansvik : > 2016-06-16 15:52 GMT+02:00 Elvis Stansvik : > >> The MouseEvents.py example [1] currently does: >> >> class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): >> >> def __init__(self,parent=None): >> >> self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) >> >> self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) >> >> def middleButtonPressEvent(self,obj,event): >> print("Middle Button pressed") >> self.OnMiddleButtonDown() >> return >> >> def middleButtonReleaseEvent(self,obj,event): >> print("Middle Button released") >> self.OnMiddleButtonUp() >> return >> >> But I don't understand the reason for calling e.g. >> self.OnMiddleButtonDown() ? Since this is not an override of a virtual >> function (which is not possible in Python), but simply adding another >> observer, I don't think it is needed? (..and I would think it would mean >> OnMiddleButtonDown is called twice, right?). >> > > Sorry, I realize I wasn't really clear here: What I mean is that, if the > interactor style above is used, the behavior of > vtkInteractorStyleTrackballCamera (the base class) will still be there, > even if the call to self.OnMiddleButtonDown() is removed, since the base > class will observe the interactor. That's why I don't understand the need > for the self.OnMiddleButtonDown() call in the example. > > This ties in to my other question (another mail), since what I want to do > is to actually override the behavior of the base interactor style (similar > to how you can in C++, but I need to find some other mechanism to do so, > overriding of virtual functions won't work from Python). > Sorry, I confused myself with all my mails, it actually was in the original mail in this thread I brought up this question. Perhaps I should tell a little more about my goal. I'm building an application with VTK, and in some cases I expect that I want to make use of VTKs interactor + interactor style machinery, and leverage the built-in interactor styles (such as vtkInteractorStyleTrackballCamera), but at the same time I might want to override behavior, and also be able to decide whether I want to override a particular event or not at runtime, when handling the event. I also suspect that I might want to modify the event information before passing it on. E.g. in C++ I would just override the virtual method, and in my override I'd be able decide whether I want to do something special or call the base class implementation. It seem there's no easy way of doing the equivalent in Python? At least I haven't found any. I've found some mentions in the vtkCommand docs about being able to stop propagation of an event to observers with lower priority. But I haven't found any exampels of this in Python, and it also seems that the docs in vtkCommand about callData are not applicable to Python? And also, with that solution, I'd have to install observers directly on the interactor, like the interactor style does, in order to end up in the same event propagation chain so to speak. I'd love to hear how others have solved the problem of custom interaction behavior in Python, while still being able to leverage (parts of) the functionality provided by the built-in interactor styles. Elvis > Elvis > > >> >> This leads me to another question: What if I really do want to override >> the behavior that the parent interactor style provides (or modify it by >> manipulating the event), what are my options? >> >> I saw at >> >> >> http://www.vtk.org/Wiki/VTK/Examples/Python/Interaction/MouseEventsObserver >> >> that you can remove all observers of an event from the interactor, but >> that seems like quite a hack :/ In my case, I'm interested in locking the >> camera rotation to a certain axis, but perhaps a custom interactor style is >> not the way to go? >> >> Elvis >> >> [1] http://www.vtk.org/Wiki/VTK/Examples/Python/Interaction/MouseEvents >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From luis.vieira at vektore.com Thu Jun 16 11:28:37 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Thu, 16 Jun 2016 11:28:37 -0400 Subject: [vtkusers] Contents of vtk-developers Digest, Vol 146, Issue 17 - RE: [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget Message-ID: <5a2c01d1c7e3$c183d0c0$448b7240$@vektore.com> Hello Sankhesh, That?s the point was working within the old backend. Unfortunately, I CMake doesn?t build automatic TDX(3D Mouse device I have) with OpenGL2 within VTK7.0 and VTK6.1 does. So I had to change to Rendering Backend OpenGL instead of OpenGl2. But is still not justifying why run out of QVTKWidget control. So, once I had built with OpenGL I will try just change the slot VTK_RENDERING_BACKEND to OpenGL2 to compile to found out and let you know. Thank you. Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com From: Sankhesh Jhaveri [mailto:sankhesh.jhaveri at kitware.com] Sent: June 16, 2016 9:54 AM To: Luis Vieira Cc: vtk-developers ; vtkusers at vtk.org Subject: Re: [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget Hi Luis, I don't see anything obvious but I noticed that you are initializing vtkRenderingOpenGL i.e. using the OpenGL backend. Mind trying the OpenGL2 backend to find out whether the issue is specific to the old backend. Sankhesh On Tue, Jun 14, 2016 at 3:20 PM, Luis Vieira > wrote: Hello everyone, I had migrated my VTK platform from 6.1 to 7.0. I had noticed some changes, and one of those is giving me a hard work to do that is to render vtkSmartPointer::New() within QVTWidget. Previously, was easily, with VTK 6.1. Now, I am trying that and I got the Cone working/rendering well and its interactions. However, I haven't gotten absolutely nothing on my viewport from my vtkAxesActor even been shown . Following my code (C++), regarding that this works outside QVTWidget viewport. I appreciate any ideas and help. ???????? #include "vtkRenderWindow.h" #include "vtkRenderer.h" #include "vtkRenderWindowInteractor.h" #include "vtkEventQtSlotConnect.h" #include "vtkCommand.h" #include "vtkConeSource.h" #include "vtkSphereSource.h" #include "vtkPolyDataMapper.h" #include "vtkActor.h" #include "vtkActorCollection.h" #include "vtkCaptionActor2D.h" #include "vtkTextActor.h" #include "vtkTextProperty.h" #include "vtkActor2D.h" #include "vtkAxesActor.h" #include "vtkOrientationMarkerWidget.h" #include "vtkInteractorStyle.h" #include "vtkTDxInteractorStyleCamera.h" #include "vtkTDxInteractorStyleSettings.h" #include "vtkInteractorStyleRubberBandPick.h" #include "vtkInteractorStyleTrackballCamera.h" #include "vtkInteractorStyleTrackball.h" #include "QVTKInteractorAdapter.h" #include "QVTKInteractor.h" #include "QVTKApplication.h" ??. . . . #include VTK_MODULE_INIT(vtkRenderingOpenGL); VTK_MODULE_INIT(vtkInteractionStyle); . . . Mainwindow.cpp Void procedure() { vtkRenderWindow* renwin = vtkRenderWindow::New(); renwin->StereoCapableWindowOn(); // Activate 3DConnexion device only on the left render window. // QVTKWidget mainViewPort->SetUseTDx(true); // QVTKWidget = mainViewPort. mainViewPort->SetRenderWindow(renwin); renwin->Delete(); const double angleSensitivity = 0.02; const double translationSensitivity = 0.001; QVTKInteractor *iren = mainViewPort->GetInteractor(); vtkInteractorStyle *s = static_cast(iren->GetInteractorStyle()); vtkTDxInteractorStyleCamera *t = static_cast(s->GetTDxStyle()); t->GetSettings()->SetAngleSensitivity(angleSensitivity); t->GetSettings()->SetTranslationXSensitivity(translationSensitivity); t->GetSettings()->SetTranslationYSensitivity(translationSensitivity); t->GetSettings()->SetTranslationZSensitivity(translationSensitivity); // add a renderer Ren1 = vtkRenderer::New(); mainViewPort->GetRenderWindow()->AddRenderer(Ren1); vtkConeSource* cone = vtkConeSource::New(); vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); mapper->SetInputConnection(cone->GetOutputPort()); vtkActor* actor = vtkActor::New(); actor->SetMapper(mapper); Ren1->AddViewProp(actor); actor->Delete(); mapper->Delete(); cone->Delete(); mainViewPort->GetRenderWindow()->Render(); viewPortAxActor = vtkSmartPointer::New(); viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(0, 0, 0); viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05); viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(0, 0, 0); viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05); viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(0, 0, 0); viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05); viewPortOMWidget = vtkSmartPointer::New(); viewPortOMWidget->SetOrientationMarker(viewPortAxActor); viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); . . . ..... } Any ideas? Thank you very much. Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Search the list archives at: http://markmail.org/search/?q=vtk-developers Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/vtk-developers -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Thu Jun 16 11:33:47 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 16 Jun 2016 09:33:47 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Thu, Jun 16, 2016 at 9:08 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > 2016-06-16 16:08 GMT+02:00 Elvis Stansvik : > >> 2016-06-16 15:52 GMT+02:00 Elvis Stansvik : >> >>> The MouseEvents.py example [1] currently does: >>> >>> class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): >>> >>> def __init__(self,parent=None): >>> >>> self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) >>> >>> self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) >>> >>> def middleButtonPressEvent(self,obj,event): >>> print("Middle Button pressed") >>> self.OnMiddleButtonDown() >>> return >>> >>> def middleButtonReleaseEvent(self,obj,event): >>> print("Middle Button released") >>> self.OnMiddleButtonUp() >>> return >>> >>> But I don't understand the reason for calling e.g. >>> self.OnMiddleButtonDown() ? Since this is not an override of a virtual >>> function (which is not possible in Python), but simply adding another >>> observer, I don't think it is needed? (..and I would think it would mean >>> OnMiddleButtonDown is called twice, right?). >>> >> >> Sorry, I realize I wasn't really clear here: What I mean is that, if the >> interactor style above is used, the behavior of >> vtkInteractorStyleTrackballCamera (the base class) will still be there, >> even if the call to self.OnMiddleButtonDown() is removed, since the base >> class will observe the interactor. That's why I don't understand the need >> for the self.OnMiddleButtonDown() call in the example. >> >> This ties in to my other question (another mail), since what I want to do >> is to actually override the behavior of the base interactor style (similar >> to how you can in C++, but I need to find some other mechanism to do so, >> overriding of virtual functions won't work from Python). >> > > Sorry, I confused myself with all my mails, it actually was in the > original mail in this thread I brought up this question. > > Perhaps I should tell a little more about my goal. I'm building an > application with VTK, and in some cases I expect that I want to make use of > VTKs interactor + interactor style machinery, and leverage the built-in > interactor styles (such as vtkInteractorStyleTrackballCamera), but at the > same time I might want to override behavior, and also be able to decide > whether I want to override a particular event or not at runtime, when > handling the event. I also suspect that I might want to modify the event > information before passing it on. > > E.g. in C++ I would just override the virtual method, and in my override > I'd be able decide whether I want to do something special or call the base > class implementation. > > It seem there's no easy way of doing the equivalent in Python? At least I > haven't found any. I've found some mentions in the vtkCommand docs about > being able to stop propagation of an event to observers with lower > priority. But I haven't found any exampels of this in Python, and it also > seems that the docs in vtkCommand about callData are not applicable to > Python? And also, with that solution, I'd have to install observers > directly on the interactor, like the interactor style does, in order to end > up in the same event propagation chain so to speak. > > I'd love to hear how others have solved the problem of custom interaction > behavior in Python, while still being able to leverage (parts of) the > functionality provided by the built-in interactor styles. > In C++, a callback can return "true" to stop event propagation: // Description: // This method invokes an event and return whether the event was // aborted or not. If the event was aborted, the return value is 1, // otherwise it is 0. int InvokeEvent(unsigned long event, void *callData); int InvokeEvent(unsigned long event); When this feature was added for C++, it wasn't added to vtkPythonCommand.cxx (an oversight), so vtkPythonCommand.cxx would have to be modified to add this behavior for Python. Regarding calldata, see the following merge request (now merged): https://gitlab.kitware.com/vtk/vtk/merge_requests/1543/commits If Hasting happens to be reading this, please note that commit messages should be a wee bit more descriptive... I can't say much about the rest. The interactors aren't my favorite part of VTK. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 16 13:08:27 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 16 Jun 2016 19:08:27 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-16 17:33 GMT+02:00 David Gobbi : > On Thu, Jun 16, 2016 at 9:08 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> 2016-06-16 16:08 GMT+02:00 Elvis Stansvik : >> >>> 2016-06-16 15:52 GMT+02:00 Elvis Stansvik >>> : >>> >>>> The MouseEvents.py example [1] currently does: >>>> >>>> class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): >>>> >>>> def __init__(self,parent=None): >>>> >>>> self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) >>>> >>>> self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) >>>> >>>> def middleButtonPressEvent(self,obj,event): >>>> print("Middle Button pressed") >>>> self.OnMiddleButtonDown() >>>> return >>>> >>>> def middleButtonReleaseEvent(self,obj,event): >>>> print("Middle Button released") >>>> self.OnMiddleButtonUp() >>>> return >>>> >>>> But I don't understand the reason for calling e.g. >>>> self.OnMiddleButtonDown() ? Since this is not an override of a virtual >>>> function (which is not possible in Python), but simply adding another >>>> observer, I don't think it is needed? (..and I would think it would mean >>>> OnMiddleButtonDown is called twice, right?). >>>> >>> >>> Sorry, I realize I wasn't really clear here: What I mean is that, if the >>> interactor style above is used, the behavior of >>> vtkInteractorStyleTrackballCamera (the base class) will still be there, >>> even if the call to self.OnMiddleButtonDown() is removed, since the base >>> class will observe the interactor. That's why I don't understand the need >>> for the self.OnMiddleButtonDown() call in the example. >>> >>> This ties in to my other question (another mail), since what I want to >>> do is to actually override the behavior of the base interactor style >>> (similar to how you can in C++, but I need to find some other mechanism to >>> do so, overriding of virtual functions won't work from Python). >>> >> >> Sorry, I confused myself with all my mails, it actually was in the >> original mail in this thread I brought up this question. >> >> Perhaps I should tell a little more about my goal. I'm building an >> application with VTK, and in some cases I expect that I want to make use of >> VTKs interactor + interactor style machinery, and leverage the built-in >> interactor styles (such as vtkInteractorStyleTrackballCamera), but at >> the same time I might want to override behavior, and also be able to decide >> whether I want to override a particular event or not at runtime, when >> handling the event. I also suspect that I might want to modify the event >> information before passing it on. >> >> E.g. in C++ I would just override the virtual method, and in my override >> I'd be able decide whether I want to do something special or call the base >> class implementation. >> >> It seem there's no easy way of doing the equivalent in Python? At least I >> haven't found any. I've found some mentions in the vtkCommand docs about >> being able to stop propagation of an event to observers with lower >> priority. But I haven't found any exampels of this in Python, and it also >> seems that the docs in vtkCommand about callData are not applicable to >> Python? And also, with that solution, I'd have to install observers >> directly on the interactor, like the interactor style does, in order to end >> up in the same event propagation chain so to speak. >> >> I'd love to hear how others have solved the problem of custom interaction >> behavior in Python, while still being able to leverage (parts of) the >> functionality provided by the built-in interactor styles. >> > > In C++, a callback can return "true" to stop event propagation: > > // Description: > // This method invokes an event and return whether the event was > // aborted or not. If the event was aborted, the return value is 1, > // otherwise it is 0. > int InvokeEvent(unsigned long event, void *callData); > int InvokeEvent(unsigned long event); > > When this feature was added for C++, it wasn't added to > vtkPythonCommand.cxx (an oversight), so vtkPythonCommand.cxx would have to > be modified to add this behavior for Python. > Ah, I see. > > Regarding calldata, see the following merge request (now merged): > https://gitlab.kitware.com/vtk/vtk/merge_requests/1543/commits > If Hasting happens to be reading this, please note that commit messages > should be a wee bit more descriptive... > Thanks for the pointer, that's good. Though I see now that the only supported types are strings, floats, ints and vtk.vtkObject. In my case I would have been interested in QMouseEvent, since I read that QVTKWidget will use that as callData on the C++ side and was hoping the could have been true in Python (but perhaps it wouldn't have been due to other reasons..?). > I can't say much about the rest. The interactors aren't my favorite part > of VTK. > Thanks a lot for taking the time to answer anyway! I also find the interactors a little wonky. Elvis > > - David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Thu Jun 16 14:35:58 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 16 Jun 2016 12:35:58 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Thu, Jun 16, 2016 at 11:08 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > Thanks for the pointer, that's good. Though I see now that the only > supported types are strings, floats, ints and vtk.vtkObject. In my case I > would have been interested in QMouseEvent, since I read that QVTKWidget > will use that as callData on the C++ side and was hoping the could have > been true in Python (but perhaps it wouldn't have been due to other > reasons..?). > You're the first person who has asked, but yes, it would be possible to modify the Python wrappers to pass a Qt object as the callData. If you're willing to try, or if you know someone who'd be willing, I'd be glad to provide assistance. The modifications would have to be done in vtkWrapPythonMethodDef.c. The wrapper API provides a method called SIPGetPointerFromObject() in vtkPythonUtil.h that is specifically made for getting a "void *" for a Qt object. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From berk.geveci at kitware.com Thu Jun 16 15:04:31 2016 From: berk.geveci at kitware.com (Berk Geveci) Date: Thu, 16 Jun 2016 15:04:31 -0400 Subject: [vtkusers] SC16 Visualization Showcase submission deadline - July 31, 2016 Message-ID: Visualization Showcase ------------------------------ Important Dates: February 16, 2016: *Submissions open* July 31, 2016: *Submissions deadline* September 1, 2016: *Notifications sent* ------------------------------ *A new format for 2016!* SC16?s Visualization and Data Analytics Showcase Program provides a forum for the year?s most instrumental movies in HPC. This year, there will be both a live display throughout the conference so that attendees can experience and enjoy the latest in science and engineering HPC results expressed through state-of-the-art visualization technologies, and a session at SC16 dedicated to the best of the submissions. Selected entries will be displayed live in a museum/art gallery format and six finalists will compete for the Best Visualization Award, with each finalist presenting his or her movie in a 15-minute presentation. Movies are judged based on how their movie illuminates science, by the quality of the movie, and for innovations in the process used for creating the movie. The six finalist submissions will appear as short papers on the SC16 webpage and archive. *Review and selection process:* Submissions need to include a movie (up to 250MB in size) and a short paper (up to 4 pages including references). The short paper should describe the scientific story conveyed by the movie, how the visualization helps scientific discovery, and the ?state-of-the-practice? information ( ieeevis.org)information behind making the movie. Each submission will be peer reviewed by the Visualization and Data Analytics Showcase Committee. Criteria for review include: - How effective is the visual communication of the data? - How relevant to the HPC community is the visualization? - What is the impact of the science story and how well is it told? - What visualization techniques were necessary to create the movie? Finally, submissions should support SC16?s overall theme ?HPC matters.? http://sc16.supercomputing.org/submitters/showcases/scientific-visualization-showcase/ *Web Submissions:* https://submissions.supercomputing.org/ *Email Contact:* vis_showcase at info.supercomputing.org SC16 Visualization Showcase Chair Chris Johnson, University of Utah SC16 Visualization Showcase Vice Chair Kristin Potter, University of Oregon -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhangjiang.dudu at gmail.com Thu Jun 16 15:59:32 2016 From: zhangjiang.dudu at gmail.com (=?utf-8?B?5byg5rGf?=) Date: Thu, 16 Jun 2016 14:59:32 -0500 Subject: [vtkusers] Convert vtkUnstructuredGrid to ExodusII Message-ID: <1BE35CA4-5347-4512-BA1F-931A9F27B655@gmail.com> Hi, Currently I want to convert an unstructured grid data to exodusII format. The input unstructured grid data has a cell type of wedge. But when I execute the following code, the output data contains TETRA cell type. Can anybody explain this? vtkUnstructuredGridReader *reader = vtkUnstructuredGridReader::New(); reader->SetFileName(?input.vtk"); reader->Update(); vtkUnstructuredGrid *grid = reader->GetOutput(); vtkExodusIIWriter *writer = vtkExodusIIWriter::New(); writer->SetInputData(grid); writer->SetFileName(?output.e"); writer->Write(); -------------- next part -------------- An HTML attachment was scrubbed... URL: From luis.vieira at vektore.com Thu Jun 16 16:40:47 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Thu, 16 Jun 2016 16:40:47 -0400 Subject: [vtkusers] Contents of vtk-developers Digest, Vol 146, Issue 17 -RE: [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget Message-ID: <80e701d1c80f$5d75a230$1860e690$@vektore.com> Hi Sankhesh, Got this, was missing those two highlighted yellow lines: viewPortOMWidget = vtkSmartPointer::New(); viewPortOMWidget->SetOrientationMarker(viewPortAxActor); viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); viewPortOMWidget->SetEnabled(1); //missing viewPortOMWidget->InteractiveOn();//missing Thank you, Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation ca.linkedin.com/in/joaoluisvieira luis.vieira at vektore.com www.vektore.com From: Sankhesh Jhaveri [mailto:sankhesh.jhaveri at kitware.com] Sent: June 16, 2016 9:54 AM To: Luis Vieira Cc: vtk-developers ; vtkusers at vtk.org Subject: Re: [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget Hi Luis, I don't see anything obvious but I noticed that you are initializing vtkRenderingOpenGL i.e. using the OpenGL backend. Mind trying the OpenGL2 backend to find out whether the issue is specific to the old backend. Sankhesh On Tue, Jun 14, 2016 at 3:20 PM, Luis Vieira > wrote: Hello everyone, I had migrated my VTK platform from 6.1 to 7.0. I had noticed some changes, and one of those is giving me a hard work to do that is to render vtkSmartPointer::New() within QVTWidget. Previously, was easily, with VTK 6.1. Now, I am trying that and I got the Cone working/rendering well and its interactions. However, I haven't gotten absolutely nothing on my viewport from my vtkAxesActor even been shown . Following my code (C++), regarding that this works outside QVTWidget viewport. I appreciate any ideas and help. ???????? #include "vtkRenderWindow.h" #include "vtkRenderer.h" #include "vtkRenderWindowInteractor.h" #include "vtkEventQtSlotConnect.h" #include "vtkCommand.h" #include "vtkConeSource.h" #include "vtkSphereSource.h" #include "vtkPolyDataMapper.h" #include "vtkActor.h" #include "vtkActorCollection.h" #include "vtkCaptionActor2D.h" #include "vtkTextActor.h" #include "vtkTextProperty.h" #include "vtkActor2D.h" #include "vtkAxesActor.h" #include "vtkOrientationMarkerWidget.h" #include "vtkInteractorStyle.h" #include "vtkTDxInteractorStyleCamera.h" #include "vtkTDxInteractorStyleSettings.h" #include "vtkInteractorStyleRubberBandPick.h" #include "vtkInteractorStyleTrackballCamera.h" #include "vtkInteractorStyleTrackball.h" #include "QVTKInteractorAdapter.h" #include "QVTKInteractor.h" #include "QVTKApplication.h" ??. . . . #include VTK_MODULE_INIT(vtkRenderingOpenGL); VTK_MODULE_INIT(vtkInteractionStyle); . . . Mainwindow.cpp Void procedure() { vtkRenderWindow* renwin = vtkRenderWindow::New(); renwin->StereoCapableWindowOn(); // Activate 3DConnexion device only on the left render window. // QVTKWidget mainViewPort->SetUseTDx(true); // QVTKWidget = mainViewPort. mainViewPort->SetRenderWindow(renwin); renwin->Delete(); const double angleSensitivity = 0.02; const double translationSensitivity = 0.001; QVTKInteractor *iren = mainViewPort->GetInteractor(); vtkInteractorStyle *s = static_cast(iren->GetInteractorStyle()); vtkTDxInteractorStyleCamera *t = static_cast(s->GetTDxStyle()); t->GetSettings()->SetAngleSensitivity(angleSensitivity); t->GetSettings()->SetTranslationXSensitivity(translationSensitivity); t->GetSettings()->SetTranslationYSensitivity(translationSensitivity); t->GetSettings()->SetTranslationZSensitivity(translationSensitivity); // add a renderer Ren1 = vtkRenderer::New(); mainViewPort->GetRenderWindow()->AddRenderer(Ren1); vtkConeSource* cone = vtkConeSource::New(); vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); mapper->SetInputConnection(cone->GetOutputPort()); vtkActor* actor = vtkActor::New(); actor->SetMapper(mapper); Ren1->AddViewProp(actor); actor->Delete(); mapper->Delete(); cone->Delete(); mainViewPort->GetRenderWindow()->Render(); viewPortAxActor = vtkSmartPointer::New(); viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(0, 0, 0); viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05); viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(0, 0, 0); viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05); viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(0, 0, 0); viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05); viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05); viewPortOMWidget = vtkSmartPointer::New(); viewPortOMWidget->SetOrientationMarker(viewPortAxActor); viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); . . . ..... } Any ideas? Thank you very much. Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Search the list archives at: http://markmail.org/search/?q=vtk-developers Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/vtk-developers -------------- next part -------------- An HTML attachment was scrubbed... URL: From luis.vieira at vektore.com Thu Jun 16 17:32:23 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Thu, 16 Jun 2016 17:32:23 -0400 Subject: [vtkusers] Contents of vtk-developers Digest, Vol 146, Issue 15 Message-ID: <8f2d01d1c816$9269ad90$b73d08b0$@vektore.com> Hello, Some body with any ideas to help us? How to fix the Focal Point in case using vtkOBJReader? Thank you very much. Luis Vieira, Toronto. Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -----Original Message----- From: Luis Vieira [mailto:luis.vieira at vektore.com] Sent: June 14, 2016 11:38 AM To: 'vtk-developers at vtk.org' ; 'vtkusers at vtk.org' Cc: 'David Thompson' Subject: Contents of vtk-developers Digest, Vol 146, Issue 15 Hi David, Also, I have tried, unsuccessfully, as well as following: >> It looks like you are positioning the camera using image parameters... but you are not mapping the image directly. Instead, you are mapping geometry from a VRML file and texturing it with the image. >> renderer->ComputeVisiblePropBounds(bounds); vtkCamera* cam = renderer->GetActiveCamera(); cam->SetFocalPoint((bounds[0] + bounds[1]) / 2.0, (bounds[2] + cam->bounds[3]) / 2.0, (bounds[4] + bounds[5]) / 2.0); cam->SetPosition((bounds[0] + bounds[1]) / 2.0, (bounds[2] + bounds[3]) cam->/ 2.0, bounds[4] + bounds[5]); SetViewUp(0, 1, 0); Please, could you be more clear about this? >> The pick coordinates will be points on the VRML geometry, not image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. >>> Tks, Luis Vieira, Toronto - ON Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -----Original Message----- From: David Thompson [mailto:david.thompson at kitware.com] Sent: June 14, 2016 10:37 AM To: Luis Vieira Cc: vtk-developers at vtk.org Subject: Re: [vtk-developers] Rendering Image and Picking Points Hi Luis, > ...I am struggling to rendering an Image and set up the camera focal point to placed that image within the center of the camera. > > 1- I want this because the point is when I am rotating the object and > picking point in its surface I got the X, Y and Z world coordinates > that doesn't match the real coordinates of the camera; > > 2- When I am trying to use those coordinates once I had picked to calculate the center of mass between them , the results are not accurately rights. And everything that I have to derivate/build also are not, as well as when I make a Plane and the its origin goes away into the camera out of my cylinder(image). ... It looks like you are positioning the camera using image parameters... but you are not mapping the image directly. Instead, you are mapping geometry from a VRML file and texturing it with the image. The pick coordinates will be points on the VRML geometry, not image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. David Hello Guys!! First of all, I have to say that I appreciate any help! I am struggling to rendering an Image and set up the camera focal point to placed that image within the center of the camera. 1- I want this because the point is when I am rotating the object and picking point in its surface I got the X, Y and Z world coordinates that doesn't match the real coordinates of the camera; 2- When I am trying to use those coordinates once I had picked to calculate the center of mass between them , the results are not accurately rights. And everything that I have to derivate/build also are not, as well as when I make a Plane and the its origin goes away into the camera out of my cylinder(image). Following my code and attached picture. Thank you very much!! Luis MainWindow.cpp void MainWindow::ProcessImage(QString _model, QString _image) { double bounds[6] = { +1, -1, +1, -1, +1, -1 }; qvtkWidget->setVisible(true); std::string iname = _model.toStdString();//model is a *.obj Cylinder of Solid rock with h1024xw1024"; std::string imagename = _image.toStdString() ;//is the texture *.bmp file that wraps up the cylinder"; vtkRenderer* renderer = vtkRenderer::New(); vtkRenderWindow* renderWindow = vtkRenderWindow::New(); renderWindow->StereoCapableWindowOn(); // Activate 3DConnexion device only on the left render window. qvtkWidget->SetUseTDx(true); qvtkWidget->SetRenderWindow(renderWindow); //renderWindow->Delete(); const double angleSensitivity = 0.02; const double translationSensitivity = 0.001; QVTKInteractor *iren = qvtkWidget->GetInteractor(); vtkInteractorStyle *s = static_cast(iren->GetInteractorStyle()); vtkTDxInteractorStyleCamera *t = static_cast(s->GetTDxStyle()); t->GetSettings()->SetAngleSensitivity(angleSensitivity); t->GetSettings()->SetTranslationXSensitivity(translationSensitivity); t->GetSettings()->SetTranslationYSensitivity(translationSensitivity); t->GetSettings()->SetTranslationZSensitivity(translationSensitivity); // Read the image which will be the texture QMenu* popup1 = new QMenu(qvtkWidget); popup1->addAction("Draw Line"); popup1->addAction("Draw Plane"); popup1->addAction("Draw Clip"); popup1->addAction("Background White"); popup1->addAction("Background Black"); popup1->addAction("Stereo Rendering"); connect(popup1, SIGNAL(triggered(QAction*)), this, SLOT(ProcessUserViewPortInteraction(QAction*))); std::cout << "Reading image " << imagename << "..." << std::endl; vtkBMPReader* bmpReader = vtkBMPReader::New(); bmpReader->SetFileName(imagename.c_str()); bmpReader->Update(); std::cout << "Done" << std::endl; // Creating the texture std::cout << "Making a texture out of the image... " << std::endl; vtkTexture* texture = vtkTexture::New(); texture->SetInputConnection(bmpReader->GetOutputPort()); std::cout << "Done" << std::endl; // Import geometry from a VRML file vtkSmartPointer imageViewer = vtkSmartPointer::New(); imageViewer->SetInputConnection(bmpReader->GetOutputPort()); //imageViewer->SetupInteractor(renderWindowInteractor); imageViewer->SetSize(600, 600); vtkDataSet *pDataset; // Import geometry from an OBJ file std::cout << "Reading OBJ file " << iname << "..." << std::endl; vtkOBJReader* reader = vtkOBJReader::New(); reader->SetFileName(iname.c_str()); reader->Update(); vtkPolyData *polyData2 = reader->GetOutput(); std::cout << "Obj reader = " << polyData2->GetNumberOfPoints() << std::endl; std::cout << "Obj point data = " << polyData2->GetPointData()->GetNumberOfArrays() << std::endl; std::cout << "Obj point data tuples = " << polyData2->GetPointData()->GetArray(0)->GetNumberOfTuples() << std::endl; std::cout << "Obj point data compon = " << polyData2->GetPointData()->GetArray(0)->GetNumberOfComponents() << std::endl; // //// Renderer vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); mapper->SetInputData(polyData2); vtkActor* texturedQuad = vtkActor::New(); texturedQuad->SetMapper(mapper); texturedQuad->SetTexture(texture); //texturedQuad->SetPosition(0, 0, 0); // Create Normal Vectors to enhance smoothness & illumination vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetInputData(polyData2); normals->SetFeatureAngle(60.0); // Mapper vtkPolyDataMapper *SolidMapper = vtkPolyDataMapper::New(); SolidMapper->SetInputData(normals->GetOutput()); SolidMapper->ScalarVisibilityOff(); // Actor vtkActor *SolidActor = vtkActor::New(); SolidActor->SetMapper(SolidMapper); vtkImageData* image = imageViewer->GetInput(); int dim[3]; image->GetDimensions(dim); double spacing[3]; image->GetSpacing(spacing); double origin[3]; image->GetOrigin(origin); renderer->ComputeVisiblePropBounds(bounds); Renderer->AddActor(SolidActor); Renderer->AddActor(texturedQuad); float Cx = (dim[0] * spacing[0]) / 2. + origin[0]; float Cy = (dim[1] * spacing[1]) / 2. + origin[1]; vtkCamera* m_Camera = vtkCamera::New(); m_Camera->SetPosition(Cx, Cy, 1); m_Camera->SetFocalPoint(Cx, Cy, 0); m_Camera->SetViewUp(0, 1, 0); m_Camera->GetDirectionOfProjection(); m_Camera->ParallelProjectionOn(); Renderer->SetActiveCamera(m_Camera); Renderer->SetBackground(0, 0, 0); // Background color white Renderer->ResetCamera(); qvtkWidget->GetRenderWindow()->AddRenderer(Renderer); qvtkWidget->GetRenderWindow()->Render(); //renderer->ResetCamera(); vtkIPWCallback* myCallback = vtkIPWCallback::New(); myCallback->renderer = Renderer; myCallback->renderWindowInteractor = qvtkWidget->GetRenderWindow()->GetInteractor(); myCallback->readerClip = vtkOBJReader::New(); myCallback->readerClip = reader; this->styleCallback = myCallback; //renderer->ResetCamera(); this->stylePicker->normalsKore = vtkSmartPointer::New(); this->stylePicker->normalsKore = normals; this->stylePicker->renderer = vtkSmartPointer::New(); this->stylePicker->actor = vtkActor::New(); this->stylePicker->mapper = vtkPolyDataMapper::New(); this->stylePicker->points = vtkSmartPointer::New(); this->stylePicker->vertices = vtkSmartPointer::New(); this->stylePicker->renderer = Renderer; this->stylePicker->renderWindowInteractor = qvtkWidget->GetRenderWindow()->GetInteractor(); vtkSmartPointer pointPicker = vtkSmartPointer::New(); qvtkWidget->GetRenderWindow()->GetInteractor()->SetPicker(pointPicker); qvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(this->sty lePicker); Connections = vtkEventQtSlotConnect::New(); Connections->Connect(qvtkWidget->GetRenderWindow()->GetInteractor(), vtkCommand::KeyPressEvent, this, SLOT(popup(vtkObject*, unsigned long, void*, void*, vtkCommand*)), popup1, 1.0); } MainWindow.h //Point PickFunction class MouseInteractorStyle2 : public vtkInteractorStyleTrackballCamera { public: std::vector pointList; std::vector pointListPlane; vtkSmartPointer matrix; vtkSmartPointer normalsKore = vtkSmartPointer::New(); vtkSmartPointer spherePickSource; vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer vertices = vtkSmartPointer::New(); vtkSmartPointer polydata; vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); vtkActor* actor; vtkPolyDataMapper* mapper; static MouseInteractorStyle2* New() { return new MouseInteractorStyle2; } //vtkTypeMacro(MouseInteractorStyle2, vtkInteractorStyleTrackballCamera); virtual void OnRightButtonDown() { int* clickPos = this->renderWindowInteractor->GetEventPosition(); // Pick from this location. vtkPropPicker* picker = vtkPropPicker::New(); picker->Pick(clickPos[0], clickPos[1], 0, this->renderer); picker->Pick(clickPos[0], clickPos[1], 0, this->renderer); double* pos = picker->GetPickPosition(); std::cout << "Pick position (world coordinates) is: " << pos[0] << " " << pos[1] << " " << pos[2] << std::endl; std::cout << "Picked actor: " << picker->GetActor() << std::endl; // Add label array. polydata = vtkSmartPointer::New(); spherePickSource = vtkSmartPointer::New(); spherePickSource->SetRadius(0.030); spherePickSource->SetCenter(pos[0], pos[1], pos[2]); if (pointList.size() < 2) { //pointList.clear(); pointList.push_back(pos); } if (pointListPlane.size() < 30) { pointListPlane.push_back(pos); } //Create a mapper and actor mapper = vtkPolyDataMapper::New(); mapper->SetInputConnection(spherePickSource->GetOutputPort()); actor = vtkActor::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(5); actor->GetProperty()->SetColor(1, 1, 1); this->renderer->AddActor(actor); vtkInteractorStyleTrackballCamera::OnRightButtonDown(); } private: }; Luis Vieira, Toronto - ON Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com From fluidandsolidearth at gmx.de Thu Jun 16 18:07:07 2016 From: fluidandsolidearth at gmx.de (Sean Con) Date: Fri, 17 Jun 2016 00:07:07 +0200 Subject: [vtkusers] VTKTetra opacity gradient [kind of emergency] In-Reply-To: <1BE35CA4-5347-4512-BA1F-931A9F27B655@gmail.com> References: <1BE35CA4-5347-4512-BA1F-931A9F27B655@gmail.com> Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Sean Con.vcf Type: text/x-vcard Size: 448 bytes Desc: not available URL: From david.gobbi at gmail.com Thu Jun 16 18:34:42 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 16 Jun 2016 16:34:42 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Thu, Jun 16, 2016 at 12:35 PM, David Gobbi wrote: > On Thu, Jun 16, 2016 at 11:08 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> Thanks for the pointer, that's good. Though I see now that the only >> supported types are strings, floats, ints and vtk.vtkObject. In my case I >> would have been interested in QMouseEvent, since I read that QVTKWidget >> will use that as callData on the C++ side and was hoping the could have >> been true in Python (but perhaps it wouldn't have been due to other >> reasons..?). >> > > You're the first person who has asked, but yes, it would be possible to > modify the Python wrappers to pass a Qt object as the callData. If you're > willing to try, or if you know someone who'd be willing, I'd be glad to > provide assistance. The modifications would have to be done in > vtkWrapPythonMethodDef.c. The wrapper API provides a method > called SIPGetPointerFromObject() in vtkPythonUtil.h that is specifically > made for getting a "void *" for a Qt object. > Out of curiosity I looked into this a bit deeper, and it would be harder than I thought. It cannot be done without re-enabling at least some of the VTK SIP wrapper functionality that has been bit-rotting for the past few years. Of course, this is all very doable if someone is willing to do it. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Thu Jun 16 18:58:16 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Fri, 17 Jun 2016 00:58:16 +0200 Subject: [vtkusers] VTKTetra opacity gradient [kind of emergency] In-Reply-To: References: <1BE35CA4-5347-4512-BA1F-931A9F27B655@gmail.com> Message-ID: Hi Sean, I think you are getting mixed up two definitions of the overloaded term "gradient." It sounds like you want an opacity gradient. The gradient referred to by volumeProperty.SetGradientOpacity refers to setting opacity values according to the gradient of a scalar field in the data set. In fact, what you want to do is define a scalar opacity function that is transparent at one end and opaque at the other, then assign data values to the points of your tetrahedron so that one end's value(s) map to the transparent opacities in the scalar opacity function while the other end's value(s) map to the opaque end of the scalar opacity function. HTH, Cory On Fri, Jun 17, 2016 at 12:07 AM, Sean Con wrote: > Hi all > > Consider this : > > # tetraheder #1 > unstructuredGrid = vtk.vtkUnstructuredGrid() > unstructuredGrid.SetPoints(pointsLocal) # pointsLocal already > defined > > tetra= vtk.vtkTetra() > tetra.GetPointIds().SetId(0,0) > tetra.GetPointIds().SetId(1,1) > tetra.GetPointIds().SetId(2,3) > tetra.GetPointIds().SetId(3,4) > > cellArray = vtk.vtkCellArray() > cellArray.InsertNextCell(tetra) > unstructuredGrid.SetCells(vtk.VTK_TETRA, cellArray) > > unstructuredGrids.append(unstructuredGrid) > > mapper = vtk.vtkDataSetMapper() > mapper.SetInputData(unstructuredGrid) > actor = vtk.vtkActor() > actor.SetMapper(mapper) > actors.append(actor) > > > > So I have my tetrahedra > > Now, I want to color the tetrahedra using opacity gradient. The top vetrx > will have the solid color, the bottom triangluar plane will have complete > transparency. I know I can use volumeProperty.SetGradientOpacity - but that > only works with volumeProperty, not with vtktetra / dataset mapper. > > Please help. > Thank you > > > > Sayandeep Khan > > Student, M.Sc. Meteorologie > Meteorologiesches Institut der > Rheinische Friedrich-Wilhelms-Universit?t Bonn > > Wissenschaftlicher Beirat > Forschungsgemeinschaft Alternative Raumfahrt > > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -- Cory Quammen R&D Engineer Kitware, Inc. From sankhesh.jhaveri at kitware.com Thu Jun 16 23:47:52 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Thu, 16 Jun 2016 23:47:52 -0400 Subject: [vtkusers] Contents of vtk-developers Digest, Vol 146, Issue 17 -RE: [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget In-Reply-To: <80e701d1c80f$5d75a230$1860e690$@vektore.com> References: <80e701d1c80f$5d75a230$1860e690$@vektore.com> Message-ID: Nice! Glad you found it. Sankhesh On Thu, Jun 16, 2016 at 4:40 PM, Luis Vieira wrote: > Hi Sankhesh, > > > > Got this, was missing those two highlighted yellow lines: > > > > viewPortOMWidget = vtkSmartPointer::New(); > > viewPortOMWidget->SetOrientationMarker(viewPortAxActor); > > viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); > > viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); > > * viewPortOMWidget**->**SetEnabled**(1);* //missing > > *viewPortOMWidget**->**InteractiveOn**();**//*missing > > > > Thank you, > > > > *Luis Vieira*, Toronto > > Consultant, Software Engineer > > Vektore Exploration Consulting Corporation > > ca.linkedin.com/in/joaoluisvieira > > luis.vieira at vektore.com > > www.vektore.com > > > > *From:* Sankhesh Jhaveri [mailto:sankhesh.jhaveri at kitware.com] > *Sent:* June 16, 2016 9:54 AM > *To:* Luis Vieira > *Cc:* vtk-developers ; vtkusers at vtk.org > *Subject:* Re: [vtk-developers] vtkAxesActor within VTK 7.0 and QVTKWidget > > > > Hi Luis, > > > > I don't see anything obvious but I noticed that you are initializing > vtkRenderingOpenGL i.e. using the OpenGL backend. Mind trying the OpenGL2 > backend to find out whether the issue is specific to the old backend. > > > > Sankhesh > > > > > > > On Tue, Jun 14, 2016 at 3:20 PM, Luis Vieira > wrote: > > Hello everyone, > > > > I had migrated my VTK platform from 6.1 to 7.0. I had noticed some > changes, and one of those is giving me a hard work to do that is to render > vtkSmartPointer::New() within QVTWidget. Previously, was > easily, with VTK 6.1. Now, I am trying that and I got the Cone > working/rendering well and its interactions. However, I haven't gotten > absolutely nothing on my viewport from my vtkAxesActor even been shown . > Following my code (C++), regarding that this works outside QVTWidget > viewport. > > > > I appreciate any ideas and help. > > ???????? > > #include "vtkRenderWindow.h" > > #include "vtkRenderer.h" > > #include "vtkRenderWindowInteractor.h" > > #include "vtkEventQtSlotConnect.h" > > #include "vtkCommand.h" > > #include "vtkConeSource.h" > > #include "vtkSphereSource.h" > > #include "vtkPolyDataMapper.h" > > #include "vtkActor.h" > > #include "vtkActorCollection.h" > > #include "vtkCaptionActor2D.h" > > #include "vtkTextActor.h" > > #include "vtkTextProperty.h" > > #include "vtkActor2D.h" > > #include "vtkAxesActor.h" > > #include "vtkOrientationMarkerWidget.h" > > #include "vtkInteractorStyle.h" > > #include "vtkTDxInteractorStyleCamera.h" > > #include "vtkTDxInteractorStyleSettings.h" > > #include "vtkInteractorStyleRubberBandPick.h" > > #include "vtkInteractorStyleTrackballCamera.h" > > #include "vtkInteractorStyleTrackball.h" > > #include "QVTKInteractorAdapter.h" > > #include "QVTKInteractor.h" > > #include "QVTKApplication.h" > > ??. > > . > > . > > . > > #include > > VTK_MODULE_INIT(vtkRenderingOpenGL); > > VTK_MODULE_INIT(vtkInteractionStyle); > > . > > . > > . > > > > Mainwindow.cpp > > > > Void procedure() > > { > > vtkRenderWindow* renwin = vtkRenderWindow::New(); > > renwin->StereoCapableWindowOn(); > > > > // Activate 3DConnexion device only on the left render > window. > > // QVTKWidget > > mainViewPort->SetUseTDx(true); // QVTKWidget = mainViewPort. > > > > mainViewPort->SetRenderWindow(renwin); > > renwin->Delete(); > > > > const double angleSensitivity = 0.02; > > const double translationSensitivity = 0.001; > > > > QVTKInteractor *iren = mainViewPort->GetInteractor(); > > vtkInteractorStyle *s = > > static_cast(iren-> > GetInteractorStyle()); > > vtkTDxInteractorStyleCamera *t = > > static_cast(s-> > GetTDxStyle()); > > > > t->GetSettings()->SetAngleSensitivity(angleSensitivity); > > t->GetSettings()->SetTranslationXSensitivity( > translationSensitivity); > > t->GetSettings()->SetTranslationYSensitivity( > translationSensitivity); > > t->GetSettings()->SetTranslationZSensitivity( > translationSensitivity); > > > > > > > > // add a renderer > > Ren1 = vtkRenderer::New(); > > mainViewPort->GetRenderWindow()->AddRenderer(Ren1); > > > > vtkConeSource* cone = vtkConeSource::New(); > > vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); > > mapper->SetInputConnection(cone->GetOutputPort()); > > vtkActor* actor = vtkActor::New(); > > actor->SetMapper(mapper); > > Ren1->AddViewProp(actor); > > actor->Delete(); > > mapper->Delete(); > > cone->Delete(); > > > > > > > > mainViewPort->GetRenderWindow()->Render(); > > > > viewPortAxActor = vtkSmartPointer::New(); > > viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05); > > viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05); > > viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05); > > > > viewPortOMWidget = vtkSmartPointer::New(); > > viewPortOMWidget->SetOrientationMarker(viewPortAxActor); > > viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); > > viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); > > > > . > > . > > . > > ..... > > } > > > > Any ideas? > > > > Thank you very much. > > > > *Luis Vieira*, Toronto > > Consultant, Software Engineer > > Vektore Exploration Consulting Corporation > > luis.vieira at vektore.com > > www.vektore.com > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Search the list archives at: http://markmail.org/search/?q=vtk-developers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtk-developers > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 02:39:29 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 08:39:29 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: Den 17 juni 2016 12:35 fm skrev "David Gobbi" : > > On Thu, Jun 16, 2016 at 12:35 PM, David Gobbi wrote: >> >> On Thu, Jun 16, 2016 at 11:08 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: >>> >>> >>> Thanks for the pointer, that's good. Though I see now that the only supported types are strings, floats, ints and vtk.vtkObject. In my case I would have been interested in QMouseEvent, since I read that QVTKWidget will use that as callData on the C++ side and was hoping the could have been true in Python (but perhaps it wouldn't have been due to other reasons..?). >> >> >> You're the first person who has asked, but yes, it would be possible to modify the Python wrappers to pass a Qt object as the callData. If you're willing to try, or if you know someone who'd be willing, I'd be glad to provide assistance. The modifications would have to be done in vtkWrapPythonMethodDef.c. The wrapper API provides a method called SIPGetPointerFromObject() in vtkPythonUtil.h that is specifically made for getting a "void *" for a Qt object. > > > Out of curiosity I looked into this a bit deeper, and it would be harder than I thought. It cannot be done without re-enabling at least some of the VTK SIP wrapper functionality that has been bit-rotting for the past few years. Of course, this is all very doable if someone is willing to do it. Alright, thanks for having a look anyway. In my case I have to rely on a currently released version of VTK. I'm sure that what I want to do (restrict camera rotation to a single axis) can be done in some other, probably better, way. I'm curious about the limitations in the Python wrappers that overriding C++ virtuals won't work though. Is that something that would work if SIP wrappers were revived? Because I know that in PyQt it works. Elvis > > - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Fri Jun 17 03:32:04 2016 From: lasso at queensu.ca (Andras Lasso) Date: Fri, 17 Jun 2016 07:32:04 +0000 Subject: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION In-Reply-To: <2eab11bb-bfd0-4d5d-be54-8d1ea1bdfccb@ebi.ac.uk> References: <2eab11bb-bfd0-4d5d-be54-8d1ea1bdfccb@ebi.ac.uk> Message-ID: Some heuristics is needed to decide which contour to connect/terminate/branch. You might give a try to the DICOM-RT importer in 3D Slicer?s SlicerRT extension (www.slicerrt.org). It manages branching, smooth end-capping, etc. If it works for you then you can either use it as is or just have a look at the source code and use it in your own software (the planar contour to closed surface converter only requires VTK). Andras From: Paul Kibet Korir Sent: June 16, 2016 12:53 To: VTK Users Subject: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION Hi VTK Users, I'm currently using vtkRuledSurfaceFilter to convert a sequence of contours into a surface. The problem is that if two contours happen to be on the same plane the surface filter will join them resulting in artefacts. Any suggestions on how to deal with this? -- With kind regards, Dr. Paul K Korir, PhD Scientific Programmer EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 03:37:57 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 09:37:57 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-16 17:33 GMT+02:00 David Gobbi : > On Thu, Jun 16, 2016 at 9:08 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> 2016-06-16 16:08 GMT+02:00 Elvis Stansvik : >> >>> 2016-06-16 15:52 GMT+02:00 Elvis Stansvik >>> : >>> >>>> The MouseEvents.py example [1] currently does: >>>> >>>> class MyInteractorStyle(vtk.vtkInteractorStyleTrackballCamera): >>>> >>>> def __init__(self,parent=None): >>>> >>>> self.AddObserver("MiddleButtonPressEvent",self.middleButtonPressEvent) >>>> >>>> self.AddObserver("MiddleButtonReleaseEvent",self.middleButtonReleaseEvent) >>>> >>>> def middleButtonPressEvent(self,obj,event): >>>> print("Middle Button pressed") >>>> self.OnMiddleButtonDown() >>>> return >>>> >>>> def middleButtonReleaseEvent(self,obj,event): >>>> print("Middle Button released") >>>> self.OnMiddleButtonUp() >>>> return >>>> >>>> But I don't understand the reason for calling e.g. >>>> self.OnMiddleButtonDown() ? Since this is not an override of a virtual >>>> function (which is not possible in Python), but simply adding another >>>> observer, I don't think it is needed? (..and I would think it would mean >>>> OnMiddleButtonDown is called twice, right?). >>>> >>> >>> Sorry, I realize I wasn't really clear here: What I mean is that, if the >>> interactor style above is used, the behavior of >>> vtkInteractorStyleTrackballCamera (the base class) will still be there, >>> even if the call to self.OnMiddleButtonDown() is removed, since the base >>> class will observe the interactor. That's why I don't understand the need >>> for the self.OnMiddleButtonDown() call in the example. >>> >>> This ties in to my other question (another mail), since what I want to >>> do is to actually override the behavior of the base interactor style >>> (similar to how you can in C++, but I need to find some other mechanism to >>> do so, overriding of virtual functions won't work from Python). >>> >> >> Sorry, I confused myself with all my mails, it actually was in the >> original mail in this thread I brought up this question. >> >> Perhaps I should tell a little more about my goal. I'm building an >> application with VTK, and in some cases I expect that I want to make use of >> VTKs interactor + interactor style machinery, and leverage the built-in >> interactor styles (such as vtkInteractorStyleTrackballCamera), but at >> the same time I might want to override behavior, and also be able to decide >> whether I want to override a particular event or not at runtime, when >> handling the event. I also suspect that I might want to modify the event >> information before passing it on. >> >> E.g. in C++ I would just override the virtual method, and in my override >> I'd be able decide whether I want to do something special or call the base >> class implementation. >> >> It seem there's no easy way of doing the equivalent in Python? At least I >> haven't found any. I've found some mentions in the vtkCommand docs about >> being able to stop propagation of an event to observers with lower >> priority. But I haven't found any exampels of this in Python, and it also >> seems that the docs in vtkCommand about callData are not applicable to >> Python? And also, with that solution, I'd have to install observers >> directly on the interactor, like the interactor style does, in order to end >> up in the same event propagation chain so to speak. >> >> I'd love to hear how others have solved the problem of custom interaction >> behavior in Python, while still being able to leverage (parts of) the >> functionality provided by the built-in interactor styles. >> > > In C++, a callback can return "true" to stop event propagation: > > // Description: > // This method invokes an event and return whether the event was > // aborted or not. If the event was aborted, the return value is 1, > // otherwise it is 0. > int InvokeEvent(unsigned long event, void *callData); > int InvokeEvent(unsigned long event); > > When this feature was added for C++, it wasn't added to > vtkPythonCommand.cxx (an oversight), so vtkPythonCommand.cxx would have to > be modified to add this behavior for Python. > > Regarding calldata, see the following merge request (now merged): > https://gitlab.kitware.com/vtk/vtk/merge_requests/1543/commits > If Hasting happens to be reading this, please note that commit messages > should be a wee bit more descriptive... > > I can't say much about the rest. The interactors aren't my favorite part > of VTK. > I'm also curious, if you don't mind me asking: Have you used a lot of PyQt+VTK? If so, did you use the interactor style system or did you forego using it completely? Elvis > - David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.reshetnyak at gmail.com Fri Jun 17 04:23:29 2016 From: m.reshetnyak at gmail.com (Maxim Reshetnyak) Date: Fri, 17 Jun 2016 01:23:29 -0700 (MST) Subject: [vtkusers] Invisible filledMapper Message-ID: <1466151809708-5738743.post@n5.nabble.com> Hello! I see the Color Bar, but I can not see the colormapping plot itself. Please, help me. Maxim. == int main(int argc, char **argv) { int i; static float x[47]={ -1.22396, -1.17188, -1.11979, -1.06771, -1.01562, -0.963542, -0.911458, -0.859375, -0.807292, -0.755208, -0.703125, -0.651042, -0.598958, -0.546875, -0.494792, -0.442708, -0.390625, -0.338542, -0.286458, -0.234375, -0.182292, -0.130209, -0.078125, -0.026042, 0.0260415, 0.078125, 0.130208, 0.182291, 0.234375, 0.286458, 0.338542, 0.390625, 0.442708, 0.494792, 0.546875, 0.598958, 0.651042, 0.703125, 0.755208, 0.807292, 0.859375, 0.911458, 0.963542, 1.01562, 1.06771, 1.11979, 1.17188}; static float y[33]={-1.25, -1.17188, -1.09375, -1.01562, -0.9375, -0.859375, -0.78125, -0.703125, -0.625, -0.546875, -0.46875, -0.390625, -0.3125, -0.234375, -0.15625, -0.078125, 0, 0.078125, 0.15625, 0.234375, 0.3125, 0.390625, 0.46875, 0.546875, 0.625, 0.703125, 0.78125, 0.859375, 0.9375, 1.01562, 1.09375, 1.17188, 1.25}; static float z[44]={0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.75, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.75, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.75, 3.8, 3.9}; vtkFloatArray *xCoords = vtkFloatArray::New(); for (i=0; i<47; i++) xCoords->InsertNextValue(x[i]); vtkFloatArray *yCoords = vtkFloatArray::New(); for (i=0; i<33; i++) yCoords->InsertNextValue(y[i]); vtkFloatArray *zCoords = vtkFloatArray::New(); for (i=0; i<44; i++) zCoords->InsertNextValue(z[i]); vtkFloatArray *field_data = vtkFloatArray::New(); for (int i=0; i<47; i++) for (int j=0; j<33; j++) for (int l=0; l<44; l++) field_data->InsertNextValue(x[i]*x[i]+y[j]*y[j]+z[l]*z[l]); vtkRectilinearGrid *rgrid = vtkRectilinearGrid::New(); rgrid->SetDimensions(47,33,44); rgrid->SetXCoordinates(xCoords); rgrid->SetYCoordinates(yCoords); rgrid->SetZCoordinates(zCoords); rgrid->GetPointData()->SetScalars(field_data); double ra[2]; rgrid->GetPointData()->GetScalars()->GetRange(ra); vtkRectilinearGridGeometryFilter *plane= vtkRectilinearGridGeometryFilter::New(); plane->SetInputData(rgrid); plane->SetExtent(0,47, 0,33, 10,10); // make section at z[10] vtkLookupTable *lut = vtkLookupTable::New(); lut->SetNumberOfColors(256); lut->SetRange(ra); lut->SetHueRange(0.66667, 0.0); lut->Build(); vtkDataSetMapper *filledMapper = vtkDataSetMapper::New(); filledMapper->SetInputData(plane->GetOutput()); filledMapper->SetLookupTable(lut); filledMapper->ScalarVisibilityOn(); filledMapper->SetScalarRange(ra); vtkActor *filledActor = vtkActor::New(); filledActor->SetMapper(filledMapper); vtkRenderer *renderer = vtkRenderer::New(); vtkRenderWindow *renWin = vtkRenderWindow::New(); renWin->AddRenderer(renderer); vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); iren->SetRenderWindow(renWin); vtkScalarBarActor *barActor = vtkScalarBarActor::New(); barActor->SetLookupTable(lut); barActor->SetTitle("Bumps"); renderer->AddActor(barActor); renderer->AddActor(filledActor); renderer->SetBackground(1,1,1); renderer->ResetCamera(); // renderer->GetActiveCamera()->Elevation(60.0); // renderer->GetActiveCamera()->Azimuth(30.0); // renderer->GetActiveCamera()->Zoom(1.0); renWin->SetSize(300,300); // interact with data renWin->Render(); iren->Start(); } -- View this message in context: http://vtk.1045678.n5.nabble.com/Invisible-filledMapper-tp5738743.html Sent from the VTK - Users mailing list archive at Nabble.com. From fluidandsolidearth at gmx.de Fri Jun 17 05:56:28 2016 From: fluidandsolidearth at gmx.de (Sean Con) Date: Fri, 17 Jun 2016 11:56:28 +0200 Subject: [vtkusers] VTKTetra opacity gradient [kind of emergency] In-Reply-To: References: <1BE35CA4-5347-4512-BA1F-931A9F27B655@gmail.com> , Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Sean Con.vcf Type: text/x-vcard Size: 448 bytes Desc: not available URL: From cory.quammen at kitware.com Fri Jun 17 06:14:08 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Fri, 17 Jun 2016 12:14:08 +0200 Subject: [vtkusers] VTKTetra opacity gradient [kind of emergency] In-Reply-To: References: <1BE35CA4-5347-4512-BA1F-931A9F27B655@gmail.com> Message-ID: Sayandeep, This example will show you how to set up a transfer function with opacity: http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Rendering/Core/Testing/Python/TestOpacityVectors.py and this example will show you how to assign point scalars to a cube, but you can modify it to a tetrahedron: http://www.vtk.org/Wiki/VTK/Examples/Python/DataManipulation/Cube.py Hope that gets you going, Cory On Fri, Jun 17, 2016 at 11:56 AM, Sean Con wrote: > Hi > Thank you for the reply. > > How do I proceed with a scalergradient and a Tetra? > Thank you > > Sayandeep Khan > > Student, M.Sc. Meteorologie > Meteorologiesches Institut der > Rheinische Friedrich-Wilhelms-Universit?t Bonn > > Wissenschaftlicher Beirat > Forschungsgemeinschaft Alternative Raumfahrt > > > Gesendet: Freitag, 17. Juni 2016 um 00:58 Uhr > Von: "Cory Quammen" > An: "Sean Con" > Cc: "vtkusers at vtk.org" > Betreff: Re: [vtkusers] VTKTetra opacity gradient [kind of emergency] > Hi Sean, > > I think you are getting mixed up two definitions of the overloaded > term "gradient." It sounds like you want an opacity gradient. The > gradient referred to by volumeProperty.SetGradientOpacity refers to > setting opacity values according to the gradient of a scalar field in > the data set. > > In fact, what you want to do is define a scalar opacity function that > is transparent at one end and opaque at the other, then assign data > values to the points of your tetrahedron so that one end's value(s) > map to the transparent opacities in the scalar opacity function while > the other end's value(s) map to the opaque end of the scalar opacity > function. > > HTH, > Cory > > On Fri, Jun 17, 2016 at 12:07 AM, Sean Con > wrote: >> Hi all >> >> Consider this : >> >> # tetraheder #1 >> unstructuredGrid = vtk.vtkUnstructuredGrid() >> unstructuredGrid.SetPoints(pointsLocal) # pointsLocal already >> defined >> >> tetra= vtk.vtkTetra() >> tetra.GetPointIds().SetId(0,0) >> tetra.GetPointIds().SetId(1,1) >> tetra.GetPointIds().SetId(2,3) >> tetra.GetPointIds().SetId(3,4) >> >> cellArray = vtk.vtkCellArray() >> cellArray.InsertNextCell(tetra) >> unstructuredGrid.SetCells(vtk.VTK_TETRA, cellArray) >> >> unstructuredGrids.append(unstructuredGrid) >> >> mapper = vtk.vtkDataSetMapper() >> mapper.SetInputData(unstructuredGrid) >> actor = vtk.vtkActor() >> actor.SetMapper(mapper) >> actors.append(actor) >> >> >> >> So I have my tetrahedra >> >> Now, I want to color the tetrahedra using opacity gradient. The top vetrx >> will have the solid color, the bottom triangluar plane will have complete >> transparency. I know I can use volumeProperty.SetGradientOpacity - but >> that >> only works with volumeProperty, not with vtktetra / dataset mapper. >> >> Please help. >> Thank you >> >> >> >> Sayandeep Khan >> >> Student, M.Sc. Meteorologie >> Meteorologiesches Institut der >> Rheinische Friedrich-Wilhelms-Universit?t Bonn >> >> Wissenschaftlicher Beirat >> Forschungsgemeinschaft Alternative Raumfahrt >> >> >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> > > > > -- > Cory Quammen > R&D Engineer > Kitware, Inc. -- Cory Quammen R&D Engineer Kitware, Inc. From elvis.stansvik at orexplore.com Fri Jun 17 06:43:19 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 12:43:19 +0200 Subject: [vtkusers] Mouse wheel events not working with vtkInteractorStyleUser Message-ID: Hi all, >From what I've read, vtkInteractorStyleUser is still the canonical way to do completely custom interaction behavior from Python, by observing the events of the interactor. But running this minimal test case: from vtk import vtkRenderWindow from vtk import vtkRenderWindowInteractor from vtk import vtkInteractorStyleUser from vtk import vtkCommand def onLeftButtonPressEvent(sender, event): print('left button press') def onMouseWheelForwardEvent(sender, event): print('wheel forward') interactorStyle = vtkInteractorStyleUser() interactorStyle.AddObserver( vtkCommand.LeftButtonPressEvent, onLeftButtonPressEvent) interactorStyle.AddObserver( vtkCommand.MouseWheelForwardEvent, onMouseWheelForwardEvent) renderWindow = vtkRenderWindow() interactor = vtkRenderWindowInteractor() interactor.SetRenderWindow(renderWindow) interactor.SetInteractorStyle(interactorStyle) interactor.Start() It seems that wheel events are not supported by vtkInteractorStyleUser? Scrolling the wheel forwards prints nothing, while pressing the left mouse button prints "left button press" as expected. What should I do if I want to provide completely custom interaction from Python, and still be able to handle wheel events? Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 06:47:50 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 12:47:50 +0200 Subject: [vtkusers] Mouse wheel events not working with vtkInteractorStyleUser In-Reply-To: References: Message-ID: 2016-06-17 12:43 GMT+02:00 Elvis Stansvik : > Hi all, > > From what I've read, vtkInteractorStyleUser is still the canonical way to > do completely custom interaction behavior from Python, by observing the > events of the interactor. > > But running this minimal test case: > > from vtk import vtkRenderWindow > from vtk import vtkRenderWindowInteractor > from vtk import vtkInteractorStyleUser > from vtk import vtkCommand > > def onLeftButtonPressEvent(sender, event): > print('left button press') > > def onMouseWheelForwardEvent(sender, event): > print('wheel forward') > > interactorStyle = vtkInteractorStyleUser() > > interactorStyle.AddObserver( > vtkCommand.LeftButtonPressEvent, > onLeftButtonPressEvent) > > interactorStyle.AddObserver( > vtkCommand.MouseWheelForwardEvent, > onMouseWheelForwardEvent) > > renderWindow = vtkRenderWindow() > > interactor = vtkRenderWindowInteractor() > Observing the events directly on the interactor works of course. E.g. if I add here interactor.AddObserver( vtkCommand.MouseWheelForwardEvent, onMouseWheelForwardEvent) then it works. So it's just the vtkInteractorStyleUser which seems to lack support for wheel events. But observing the interactor directly like this completely spoils the point of using interactor styles in the first place (being able to easily switch between styles). Elvis interactor.SetRenderWindow(renderWindow) > interactor.SetInteractorStyle(interactorStyle) > interactor.Start() > > It seems that wheel events are not supported by vtkInteractorStyleUser? > Scrolling the wheel forwards prints nothing, while pressing the left mouse > button prints "left button press" as expected. > > What should I do if I want to provide completely custom interaction from > Python, and still be able to handle wheel events? > > Thanks in advance, > Elvis > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aborsic at ne-scientific.com Fri Jun 17 07:16:23 2016 From: aborsic at ne-scientific.com (Andrea Borsic) Date: Fri, 17 Jun 2016 13:16:23 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: In C++, a callback can return "true" to stop event propagation: // Description: // This method invokes an event and return whether the event was // aborted or not. If the event was aborted, the return value is 1, // otherwise it is 0. int InvokeEvent(unsigned long event, void *callData); int InvokeEvent(unsigned long event); When this feature was added for C++, it wasn't added to vtkPythonCommand.cxx (an oversight), so vtkPythonCommand.cxx would have to be modified to add this behavior for Python. Regarding calldata, see the following merge request (now merged): https://gitlab.kitware.com/vtk/vtk/merge_requests/1543/commits If Hasting happens to be reading this, please note that commit messages should be a wee bit more descriptive... I can't say much about the rest. The interactors aren't my favorite part of VTK. > > I'm also curious, if you don't mind me asking: Have you used a lot of > PyQt+VTK? If so, did you use the interactor style system or did you > forego using it completely? > > Elvis > > > - David > > > Hi Elvis, I am not entirely sure this answer is relevant. One can customize the response to particular events in this way: 1) by registering a call back command with a higher priority w.r.t. to default observers, with a statement like: cmd_id = interactor.AddObserver("LeftButtonPressEvent", self.MouseButtonCallback, 0.5) # use a priority of 0.5 which should be higher than default observers (0.0) 2) by inspecting / acting on the event within the call back command, and if further processing of the event by other observers (for example the default interactor) needs to be prevented, by using something like: command = interactor.GetCommand(cmd_id) command.SetAbortFlag(1) the above should stop any further handling of the event. This is therefore a possible way of overriding the default behavior of the interactor associated with render window. I am not entirely sure though whether this was the behavior your were looking for. Best, Andrea -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Fri Jun 17 08:07:47 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Fri, 17 Jun 2016 06:07:47 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Fri, Jun 17, 2016 at 12:39 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > I'm curious about the limitations in the Python wrappers that overriding > C++ virtuals won't work though. Is that something that would work if SIP > wrappers were revived? Because I know that in PyQt it works. > No, reviving the SIP wrappers won't make that work for VTK classes that are wrapped in Python. Getting that working in VTK is doable, but it has never been high priority. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 08:09:37 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 14:09:37 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-17 13:16 GMT+02:00 Andrea Borsic : > > In C++, a callback can return "true" to stop event propagation: > > // Description: > // This method invokes an event and return whether the event was > // aborted or not. If the event was aborted, the return value is 1, > // otherwise it is 0. > int InvokeEvent(unsigned long event, void *callData); > int InvokeEvent(unsigned long event); > > When this feature was added for C++, it wasn't added to > vtkPythonCommand.cxx (an oversight), so vtkPythonCommand.cxx would have to > be modified to add this behavior for Python. > > Regarding calldata, see the following merge request (now merged): > https://gitlab.kitware.com/vtk/vtk/merge_requests/1543/commits > If Hasting happens to be reading this, please note that commit messages > should be a wee bit more descriptive... > > I can't say much about the rest. The interactors aren't my favorite part > of VTK. > > > I'm also curious, if you don't mind me asking: Have you used a lot of > PyQt+VTK? If so, did you use the interactor style system or did you forego > using it completely? > > Elvis > > >> - David >> > > > > > Hi Elvis, > > I am not entirely sure this answer is relevant. One can customize the > response to particular events in this way: > > 1) by registering a call back command with a higher priority w.r.t. to > default observers, with a statement like: > > cmd_id = interactor.AddObserver("LeftButtonPressEvent", > self.MouseButtonCallback, 0.5) # use a priority of 0.5 which should be > higher than default observers (0.0) > > 2) by inspecting / acting on the event within the call back command, and > if further processing of the event by other observers (for example the > default interactor) needs to be prevented, by using something like: > > command = interactor.GetCommand(cmd_id) > command.SetAbortFlag(1) > > the above should stop any further handling of the event. > > This is therefore a possible way of overriding the default behavior of the > interactor associated with render window. > > I am not entirely sure though whether this was the behavior your were > looking for. > Thanks a lot. I think in a way this is as close as I'm going to get to what I wanted, but for one thing: I wanted to be able to modify the event (say the x/y of a mouse event) before "passing it on" for further processing, which I don't think is possible. But I think I've realized now that this is probably a bad way of anchieving my goal, and I'm not working on a completely custom interactor style instead (using vtkInteractorStyleUser). Elvis > > Best, > > Andrea > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 08:10:27 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 14:10:27 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-17 14:07 GMT+02:00 David Gobbi : > On Fri, Jun 17, 2016 at 12:39 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: >> >> I'm curious about the limitations in the Python wrappers that overriding >> C++ virtuals won't work though. Is that something that would work if SIP >> wrappers were revived? Because I know that in PyQt it works. >> > No, reviving the SIP wrappers won't make that work for VTK classes that > are wrapped in Python. Getting that working in VTK is doable, but it has > never been high priority. > Alright, thanks for the info. Elvis > > - David > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Fri Jun 17 08:12:35 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Fri, 17 Jun 2016 06:12:35 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Fri, Jun 17, 2016 at 1:37 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > I'm also curious, if you don't mind me asking: Have you used a lot of > PyQt+VTK? If so, did you use the interactor style system or did you forego > using it completely? > I used PyQt with VTK extensively from 2002 until 2007, and occasionally since then. I hardly ever use the VTK interactors, only when writing quick-and-dirty test applications. I prefer an "event" to be an object. Since I don't use vtkInteractorStyle (which is the main place where a person would want to override a virtual method) you can probably guess why the lack of virtual overrides in the Python wrappers doesn't bother me much. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 08:23:32 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 14:23:32 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-17 14:12 GMT+02:00 David Gobbi : > On Fri, Jun 17, 2016 at 1:37 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> I'm also curious, if you don't mind me asking: Have you used a lot of >> PyQt+VTK? If so, did you use the interactor style system or did you forego >> using it completely? >> > > I used PyQt with VTK extensively from 2002 until 2007, and occasionally > since then. I hardly ever use the VTK interactors, only when writing > quick-and-dirty test applications. I prefer an "event" to be an object. > > Since I don't use vtkInteractorStyle (which is the main place where a > person would want to override a virtual method) you can probably guess why > the lack of virtual overrides in the Python wrappers doesn't bother me much. > Alright, I see. Would you mind sharing how you handle custom interactions with a VTK rendering, if you don't use the interactor styles? Do you directly observe events on the interactor instead? Or do you simply handle the Qt events directly and then perform the appropriate manipulation of VTK objects in response to those? I'm very interested in if you use some event forwarding code similar to that in QVTKRenderWindowInteractor, or if you are simply not bothering with feeding input events from Qt to VTK, and handling all input on the Qt side of the fence so to speak. Elvis > > - David > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 08:27:08 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 14:27:08 +0200 Subject: [vtkusers] Grabbing focus from custom interactor style in Python Message-ID: Hi, Looking at how e.g. vtkInteractorStyleTrackballCamera, one of the built-in interactor styles, handles left mouse button presses, it does this->GrabFocus(this->EventCallbackCommand); in order to grab focus for the duration of the interaction. That is, it calls vtkInteractorObserver::GrabFocus, passing in vtkInteractorObserver::EventCallbackCommand, which is a protected variable. I'm basing my custom interactor style on vtkInteractorStyleUser, and I would like to do the same (grab focus during an interaction), but I'm working from Python and can't access the vtkInteractorObserver::EventCallbackCommand variable in my vtkInteractorStyleUser subclass. Any ideas on how to do this is much appreciated! Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 08:39:42 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 14:39:42 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-17 14:12 GMT+02:00 David Gobbi : > On Fri, Jun 17, 2016 at 1:37 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> I'm also curious, if you don't mind me asking: Have you used a lot of >> PyQt+VTK? If so, did you use the interactor style system or did you forego >> using it completely? >> > > I used PyQt with VTK extensively from 2002 until 2007, and occasionally > since then. I hardly ever use the VTK interactors, only when writing > quick-and-dirty test applications. I prefer an "event" to be an object. > And just so I get you right: With "an object" you mean as in, an object with event information as attributes, e.g. like in Qt's event system, instead of as in VTK where it's just an enum value, and you have to call various functions to get the event information? If so I agree. Elvis > > Since I don't use vtkInteractorStyle (which is the main place where a > person would want to override a virtual method) you can probably guess why > the lack of virtual overrides in the Python wrappers doesn't bother me much. > > - David > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 08:44:18 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 14:44:18 +0200 Subject: [vtkusers] Mouse wheel events not working with vtkInteractorStyleUser In-Reply-To: References: Message-ID: 2016-06-17 12:43 GMT+02:00 Elvis Stansvik : > Hi all, > > From what I've read, vtkInteractorStyleUser is still the canonical way to > do completely custom interaction behavior from Python, by observing the > events of the interactor. > > But running this minimal test case: > > from vtk import vtkRenderWindow > from vtk import vtkRenderWindowInteractor > from vtk import vtkInteractorStyleUser > from vtk import vtkCommand > > def onLeftButtonPressEvent(sender, event): > print('left button press') > > def onMouseWheelForwardEvent(sender, event): > print('wheel forward') > > interactorStyle = vtkInteractorStyleUser() > > interactorStyle.AddObserver( > vtkCommand.LeftButtonPressEvent, > onLeftButtonPressEvent) > > interactorStyle.AddObserver( > vtkCommand.MouseWheelForwardEvent, > onMouseWheelForwardEvent) > > renderWindow = vtkRenderWindow() > > interactor = vtkRenderWindowInteractor() > interactor.SetRenderWindow(renderWindow) > interactor.SetInteractorStyle(interactorStyle) > interactor.Start() > > It seems that wheel events are not supported by vtkInteractorStyleUser? > Scrolling the wheel forwards prints nothing, while pressing the left mouse > button prints "left button press" as expected. > I'm starting to think that this is simply an accidental omission in vtkInteractorStyleUser. Would you accept a patch to add support for MouseWheelForwardEvent and MouseWheelBackwardEvent? Elvis > What should I do if I want to provide completely custom interaction from > Python, and still be able to handle wheel events? > > Thanks in advance, > Elvis > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Fri Jun 17 08:58:47 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Fri, 17 Jun 2016 06:58:47 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Fri, Jun 17, 2016 at 6:23 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > Alright, I see. Would you mind sharing how you handle custom interactions > with a VTK rendering, if you don't use the interactor styles? > > Do you directly observe events on the interactor instead? Or do you simply > handle the Qt events directly and then perform the appropriate manipulation > of VTK objects in response to those? > > I'm very interested in if you use some event forwarding code similar to > that in QVTKRenderWindowInteractor, or if you are simply not bothering with > feeding input events from Qt to VTK, and handling all input on the Qt side > of the fence so to speak. > I have a subclass of QWidget that receives the Qt events and converts them to my own events (which are similar to Qt events but also carry useful VTK information). Those events are dispatched to my interaction bindings. I've always done interaction in VTK this way. Neither the vtkRenderWindowInteractor or QVTKWidget play any role. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 09:15:41 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 15:15:41 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-17 14:58 GMT+02:00 David Gobbi : > On Fri, Jun 17, 2016 at 6:23 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> Alright, I see. Would you mind sharing how you handle custom interactions >> with a VTK rendering, if you don't use the interactor styles? >> >> Do you directly observe events on the interactor instead? Or do you >> simply handle the Qt events directly and then perform the appropriate >> manipulation of VTK objects in response to those? >> >> I'm very interested in if you use some event forwarding code similar to >> that in QVTKRenderWindowInteractor, or if you are simply not bothering with >> feeding input events from Qt to VTK, and handling all input on the Qt side >> of the fence so to speak. >> > > I have a subclass of QWidget that receives the Qt events and converts them > to my own events (which are similar to Qt events but also carry useful VTK > information). Those events are dispatched to my interaction bindings. > I've always done interaction in VTK this way. Neither the > vtkRenderWindowInteractor or QVTKWidget play any role. > That's very interesting, since I've got a feeling that's the direction I'm going as well. Thanks for sharing. When you say "interaction bindings", do you mean like a pluggable event handler that you can set on your QWidget subclass, to handle your custom events? The thing is, I've cut down VTKRenderWindowInteractor to the bare minimum I thought I'd need, and cleaned it up a little, but I'm realizing now that I might not even want to do the event forwarding thing it does, but rather something like the system you describe (where you completely forego the interactor system of VTK). Elvis > - David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Fri Jun 17 09:31:29 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Fri, 17 Jun 2016 07:31:29 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Fri, Jun 17, 2016 at 7:15 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > When you say "interaction bindings", do you mean like a pluggable event > handler that you can set on your QWidget subclass, to handle your custom > events? > widget.bind(eventDescriptor, observerMethod, modifierFlags) where "eventDescriptor" describes the characteristics of the event to be captured, "observerMethod" is the method that will receive the event, and "modifierFlags" is for other details, e.g. whether to dispatch during the capture phase or the bubble phase, whether this binding should override existing bindings, etc. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Fri Jun 17 09:44:35 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 15:44:35 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-17 15:31 GMT+02:00 David Gobbi : > On Fri, Jun 17, 2016 at 7:15 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: >> >> When you say "interaction bindings", do you mean like a pluggable event >> handler that you can set on your QWidget subclass, to handle your custom >> events? >> > > widget.bind(eventDescriptor, observerMethod, modifierFlags) > > where "eventDescriptor" describes the characteristics of the event to be > captured, "observerMethod" is the method that will receive the event, and > "modifierFlags" is for other details, e.g. whether to dispatch during the > capture phase or the bubble phase, whether this binding should override > existing bindings, etc. > Ah, I see. Thanks for taking the time to describe. I think I'll do some experimentation. Elvis > > - David > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Fri Jun 17 09:51:37 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Fri, 17 Jun 2016 15:51:37 +0200 Subject: [vtkusers] Mouse wheel events not working with vtkInteractorStyleUser In-Reply-To: References: Message-ID: Elvis, It would be great if you could create a merge request on gitlab! And once you do, don't be afraid to bug us to take a look. Contributing guidelines are here: https://gitlab.kitware.com/vtk/vtk/blob/master/CONTRIBUTING.md Cory On Fri, Jun 17, 2016 at 2:44 PM, Elvis Stansvik wrote: > 2016-06-17 12:43 GMT+02:00 Elvis Stansvik : >> >> Hi all, >> >> From what I've read, vtkInteractorStyleUser is still the canonical way to >> do completely custom interaction behavior from Python, by observing the >> events of the interactor. >> >> But running this minimal test case: >> >> from vtk import vtkRenderWindow >> from vtk import vtkRenderWindowInteractor >> from vtk import vtkInteractorStyleUser >> from vtk import vtkCommand >> >> def onLeftButtonPressEvent(sender, event): >> print('left button press') >> >> def onMouseWheelForwardEvent(sender, event): >> print('wheel forward') >> >> interactorStyle = vtkInteractorStyleUser() >> >> interactorStyle.AddObserver( >> vtkCommand.LeftButtonPressEvent, >> onLeftButtonPressEvent) >> >> interactorStyle.AddObserver( >> vtkCommand.MouseWheelForwardEvent, >> onMouseWheelForwardEvent) >> >> renderWindow = vtkRenderWindow() >> >> interactor = vtkRenderWindowInteractor() >> interactor.SetRenderWindow(renderWindow) >> interactor.SetInteractorStyle(interactorStyle) >> interactor.Start() >> >> It seems that wheel events are not supported by vtkInteractorStyleUser? >> Scrolling the wheel forwards prints nothing, while pressing the left mouse >> button prints "left button press" as expected. > > > I'm starting to think that this is simply an accidental omission in > vtkInteractorStyleUser. Would you accept a patch to add support for > MouseWheelForwardEvent and MouseWheelBackwardEvent? > > Elvis > >> >> What should I do if I want to provide completely custom interaction from >> Python, and still be able to handle wheel events? >> >> Thanks in advance, >> Elvis >> > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -- Cory Quammen R&D Engineer Kitware, Inc. From elvis.stansvik at orexplore.com Fri Jun 17 10:28:54 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Fri, 17 Jun 2016 16:28:54 +0200 Subject: [vtkusers] Mouse wheel events not working with vtkInteractorStyleUser In-Reply-To: References: Message-ID: 2016-06-17 15:51 GMT+02:00 Cory Quammen : > Elvis, > > It would be great if you could create a merge request on gitlab! And > once you do, don't be afraid to bug us to take a look. > Thanks Cory, the merge request is here: https://gitlab.kitware.com/vtk/vtk/merge_requests/1577 Have a nice weekend, Elvis > Contributing guidelines are here: > > https://gitlab.kitware.com/vtk/vtk/blob/master/CONTRIBUTING.md > > Cory > > On Fri, Jun 17, 2016 at 2:44 PM, Elvis Stansvik > wrote: > > 2016-06-17 12:43 GMT+02:00 Elvis Stansvik >: > >> > >> Hi all, > >> > >> From what I've read, vtkInteractorStyleUser is still the canonical way > to > >> do completely custom interaction behavior from Python, by observing the > >> events of the interactor. > >> > >> But running this minimal test case: > >> > >> from vtk import vtkRenderWindow > >> from vtk import vtkRenderWindowInteractor > >> from vtk import vtkInteractorStyleUser > >> from vtk import vtkCommand > >> > >> def onLeftButtonPressEvent(sender, event): > >> print('left button press') > >> > >> def onMouseWheelForwardEvent(sender, event): > >> print('wheel forward') > >> > >> interactorStyle = vtkInteractorStyleUser() > >> > >> interactorStyle.AddObserver( > >> vtkCommand.LeftButtonPressEvent, > >> onLeftButtonPressEvent) > >> > >> interactorStyle.AddObserver( > >> vtkCommand.MouseWheelForwardEvent, > >> onMouseWheelForwardEvent) > >> > >> renderWindow = vtkRenderWindow() > >> > >> interactor = vtkRenderWindowInteractor() > >> interactor.SetRenderWindow(renderWindow) > >> interactor.SetInteractorStyle(interactorStyle) > >> interactor.Start() > >> > >> It seems that wheel events are not supported by vtkInteractorStyleUser? > >> Scrolling the wheel forwards prints nothing, while pressing the left > mouse > >> button prints "left button press" as expected. > > > > > > I'm starting to think that this is simply an accidental omission in > > vtkInteractorStyleUser. Would you accept a patch to add support for > > MouseWheelForwardEvent and MouseWheelBackwardEvent? > > > > Elvis > > > >> > >> What should I do if I want to provide completely custom interaction from > >> Python, and still be able to handle wheel events? > >> > >> Thanks in advance, > >> Elvis > >> > > > > > > _______________________________________________ > > 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 > > > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > > > Follow this link to subscribe/unsubscribe: > > http://public.kitware.com/mailman/listinfo/vtkusers > > > > > > -- > Cory Quammen > R&D Engineer > Kitware, Inc. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From coyarzunlaura at googlemail.com Fri Jun 17 11:32:16 2016 From: coyarzunlaura at googlemail.com (Cristina Oyarzun) Date: Fri, 17 Jun 2016 17:32:16 +0200 Subject: [vtkusers] MICCAI CLIP 2016: DEADLINE EXTENDED! Message-ID: CALL FOR PAPERS MICCAI 2016 Workshop on Clinical Image-based Procedures: Translational Research in Medical Imaging October 17, 2016 Athens, Greece Website:http://miccai-clip.org/ ============================== ========================================== SCOPE The outstanding proliferation of medical image applications has created a need for greater study and scrutiny of the clinical application and validation of such methods. New strategies are essential to ensure a smooth and effective translation of computational image-based techniques into the clinic. For these reasons CLIP 2015?s major focus is on translational research filling the gaps between basic science and clinical applications. A highlight of the workshop is the subject of strategies for personalized medicine to enhance diagnosis, treatment and interventions. Authors are encouraged to submit work centered on specific clinical applications, including techniques and procedures based on comprehensive clinical image data. Submissions related to applications already in use and evaluated by clinical users are particularly encouraged. The event will bring together world-class specialists to present ways to strengthen links between computer scientists and engineers, and clinicians. TOPICS *Strategies for patient-specific and anatomical modeling to support planning and interventions *Clinical studies employing advanced image-guided methods *Clinical translation and validation of image-guided systems *Current challenges and emerging techniques in image-based procedures *Identification of parameters and error analysis in image-based procedures *Multimodal image integration for modeling, planning and guidance *Clinical applications in open and minimally invasive procedures PAPER SUBMISSION Papers will be limited to eight pages following the MICCAI submission guidelines. Prospective authors should refer to the Paper Submission section on the workshop website for details on how to submit papers to be presented at the workshop. All submissions will be peer-reviewed by at least 2 members of the program committee. The selection of the papers will be based on the significance of results, novelty, technical merit, relevance and clarity of presentation. Papers will be presented in a day long single track workshop starting with plenary sessions. Accepted papers will be published as a proceedings volume in the Springer Lecture Notes in Computer Science (LNCS) series after the workshop. WORKSHOP FORMAT Accepted papers will be presented in a day long single track workshop. The final program will consist of invited speakers and original papers with time allocated for discussions. Electronic proceedings will be arranged for all of the papers presented at the workshop. IMPORTANT DATES * June 24, 2016: Paper submission due date * July 10, 2016: Notification of acceptance * July 17, 2016: Final camera-ready paper submission deadline CONTACT Inquires about the workshop should be sent to the Information Desk ( info at miccai-clip.org). ORGANIZERS (in alphabetical order) Klaus Drechsler (Fraunhofer IGD, Germany) Marius Erdt (Fraunhofer IDM at NTU, Singapore) Miguel Gonz?lez Ballester (ICREA - Universitat Pompeu Fabra, Spain) Marius George Linguraru (Children's National Medical Center, USA) Cristina Oyarzun Laura (Fraunhofer IGD, Germany) Yoshinobu Sato (Nara Institute of Science and Technology, Japan) Raj Shekhar (Children's National Medical Center, USA) Stefan Wesarg (Fraunhofer IGD, Germany) ======================================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From patriciop at gmail.com Fri Jun 17 16:36:32 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Fri, 17 Jun 2016 16:36:32 -0400 Subject: [vtkusers] How to enable gl2ps in VTK 7 with OpenGL2 Message-ID: Dear Expert I'm trying to enable gl2ps in VTK7 with OpenGL2 using diff file took from a VTK gitlab commit ( https://gitlab.kitware.com/vtk/vtk/commit/ea116f03386eb7570c70c16fc8d0669047520925 ) the commit is called " Merge topic 'opengl2-gl2ps' ?" ? The thing is that after applying diff file to the official VTK 7 source tree I'm having probles to build VTK. Specifically it complains about issues in Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx My question are: Am I missing any additional patch? Is there any other way to do this better? Thanks! -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From fboli94 at gmail.com Mon Jun 20 04:56:00 2016 From: fboli94 at gmail.com (fblupi) Date: Mon, 20 Jun 2016 01:56:00 -0700 (MST) Subject: [vtkusers] vtkDICOMImageReader check if I can read a directory Message-ID: <1466412960970-5738773.post@n5.nabble.com> I'm trying to check if I can read a directory with multiple DICOM images inside before reading it like in this example: http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries I know that I can check an individual image with the CanReadFile method of vtkDICOMImageReader but, is there a way to do the same with a full directory? -- View this message in context: http://vtk.1045678.n5.nabble.com/vtkDICOMImageReader-check-if-I-can-read-a-directory-tp5738773.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Mon Jun 20 05:12:01 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 20 Jun 2016 11:12:01 +0200 Subject: [vtkusers] Trackball style ('t') interaction with QVTKRenderWindowInteractor behaves strange In-Reply-To: References: Message-ID: 2016-06-16 14:39 GMT+02:00 Elvis Stansvik : > 2016-06-16 14:37 GMT+02:00 Elvis Stansvik : > >> Launching QVTKRenderWindowInteractor.py as a script, which brings up the >> built-in cone example, if I hit 't' to switch to trackball style >> interaction and then rotate the camera around for a few seconds, when I >> release the mouse there's a noticable delay before the movement stops. >> >> The delay seems related to the time the interaction went on: If I rotate >> around for a longer period, the period between releasing the mouse and the >> movement finally stopping is longer. >> >> Any idea what might be going on here? >> > This is now becoming a real problem, since I see the same behavior in a custom interactor style I'm working on. Here's the relevant part of the code: class InteractorStyle(vtkInteractorStyleUser): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # To ensure GetCurrentRenderer() returns the relevant renderer in the handlers # below, set the current renderer to the one found poked by the interactor when # the mouse moves or a mouse button is pressed. for event in [ vtkCommand.MouseMoveEvent, vtkCommand.LeftButtonPressEvent, vtkCommand.RightButtonPressEvent, vtkCommand.MiddleButtonPressEvent]: self.AddObserver(event, lambda *_: self.SetCurrentRenderer( self.GetInteractor().FindPokedRenderer( self.x(), self.y()))) # Hook up event callbacks. for event, callback in [ (vtkCommand.MouseMoveEvent, self.onMouseMoveEvent), (vtkCommand.LeftButtonPressEvent, self.onLeftButtonPressEvent), (vtkCommand.LeftButtonReleaseEvent, self.onLeftButtonReleaseEvent), (vtkCommand.RightButtonPressEvent, self.onRightButtonPressEvent), (vtkCommand.RightButtonReleaseEvent, self.onRightButtonReleaseEvent), (vtkCommand.MiddleButtonPressEvent, self.onMiddleButtonPressEvent), (vtkCommand.MiddleButtonReleaseEvent, self.onMiddleButtonReleaseEvent), (vtkCommand.KeyPressEvent, self.onKeyPressEvent), (vtkCommand.KeyReleaseEvent, self.onKeyReleaseEvent), (vtkCommand.CharEvent, self.onCharEvent), (vtkCommand.ExposeEvent, self.onExposeEvent), (vtkCommand.EnterEvent, self.onEnterEvent), (vtkCommand.LeaveEvent, self.onLeaveEvent), (vtkCommand.ConfigureEvent, self.onConfigureEvent), (vtkCommand.TimerEvent, self.onTimerEvent), (vtkCommand.UserEvent, self.onUserEvent)]: self.AddObserver(event, callback) def onMouseMoveEvent(self, sender, event): pass def onLeftButtonPressEvent(self, sender, event): pass def onLeftButtonReleaseEvent(self, sender, event): pass def onRightButtonPressEvent(self, sender, event): pass def onRightButtonReleaseEvent(self, sender, event): pass def onMiddleButtonPressEvent(self, sender, event): pass def onMiddleButtonReleaseEvent(self, sender, event): pass def onKeyPressEvent(self, sender, event): pass def onKeyReleaseEvent(self, sender, event): pass def onCharEvent(self, sender, event): pass def onExposeEvent(self, sender, event): pass def onEnterEvent(self, sender, event): pass def onLeaveEvent(self, sender, event): pass def onConfigureEvent(self, sender, event): pass def onTimerEvent(self, sender, event): pass def onUserEvent(self, sender, event): pass def x(self): """Current event X position""" return self.GetInteractor().GetEventPosition()[0] def y(self): """Current event Y position""" return self.GetInteractor().GetEventPosition()[1] def lastX(self): """Last event X position""" return self.GetInteractor().GetLastEventPosition()[0] def lastY(self): """Last event Y position""" return self.GetInteractor().GetLastEventPosition()[1] def control(self): """Control modifier?""" return self.GetInteractor().GetControlKey() def shift(self): """Shift modifier?""" return self.GetInteractor().GetShiftKey() class CloseUpInteractorStyle(InteractorStyle): # States Idle = 0 Panning = 1 Rotating = 2 Tumbling = 3 Zooming = 4 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.state = self.Idle def onLeftButtonPressEvent(self, sender, event): if self.GetCurrentRenderer() is None: return self.state = self.Rotating def onLeftButtonReleaseEvent(self, sender, event): self.state = self.Idle def onMouseMoveEvent(self, sender, event): if self.GetCurrentRenderer() is None: return if self.state == self.Rotating: self._rotate() def _rotate(self): if self.GetCurrentRenderer() is None: return dx = self.x() - self.lastX() renderer = self.GetCurrentRenderer() interactor = self.GetInteractor() (windowWidth, _) = renderer.GetRenderWindow().GetSize() azimuth = -200.0 * dx / windowWidth print('azimuth: {}'.format(azimuth)) camera = renderer.GetActiveCamera() camera.Azimuth(azimuth) camera.OrthogonalizeViewUp() interactor.Render() The InteractorStyle class is just a helper base class I use for custom interactor styles, it observes all events on itself and calls corresponding methods (to be overridden). The CloseUpInteractorStyle is my basic interactor style embryo. All it does is handle click + horizontal movement of the mouse by setting the azimuth of the camera. The same strange "lagging" behavior can be observed when click-moving the mouse somewhat rapidly for a few seconds. I'm attaching the full code, which also includes VTKWidget, a somewhat simplified / cut down version of QVTKRenderWindowInteractor I'm using (by note that I'm seeing the same problem with an unmodified QVTKRenderWindowInteractor). Is the rendering not keeping up with the rate of the mouse events? Do I need to perform some kind of event compression manually? Any advice is much appriciated! Elvis > When using the joystick style ('j', the default) the behavior is normal. > Movement stops as soon as the mouse button is released. > > Elvis > > >> Elvis >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: vtk_widget.py Type: application/x-download Size: 15837 bytes Desc: not available URL: From elvis.stansvik at orexplore.com Mon Jun 20 07:08:57 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 20 Jun 2016 13:08:57 +0200 Subject: [vtkusers] Trackball style ('t') interaction with QVTKRenderWindowInteractor behaves strange In-Reply-To: References: Message-ID: 2016-06-16 14:37 GMT+02:00 Elvis Stansvik : > Launching QVTKRenderWindowInteractor.py as a script, which brings up the > built-in cone example, if I hit 't' to switch to trackball style > interaction and then rotate the camera around for a few seconds, when I > release the mouse there's a noticable delay before the movement stops. > > The delay seems related to the time the interaction went on: If I rotate > around for a longer period, the period between releasing the mouse and the > movement finally stopping is longer. > > Any idea what might be going on here? > I've now found older reports of this on this list, and turns out it was a Qt 5 bug: https://codereview.qt-project.org/#/c/126136/ It's fixed in 5.6, but we're basing our product on Kubuntu 16.04. Is there nothing that can be done on the VTK or application side to work around this on the buggy Qt versions? Is anyone else in the same boat? Elvis > > Elvis > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 20 07:22:10 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 20 Jun 2016 13:22:10 +0200 Subject: [vtkusers] Trackball style ('t') interaction with QVTKRenderWindowInteractor behaves strange In-Reply-To: References: Message-ID: 2016-06-20 13:08 GMT+02:00 Elvis Stansvik : > 2016-06-16 14:37 GMT+02:00 Elvis Stansvik : > >> Launching QVTKRenderWindowInteractor.py as a script, which brings up the >> built-in cone example, if I hit 't' to switch to trackball style >> interaction and then rotate the camera around for a few seconds, when I >> release the mouse there's a noticable delay before the movement stops. >> >> The delay seems related to the time the interaction went on: If I rotate >> around for a longer period, the period between releasing the mouse and the >> movement finally stopping is longer. >> >> Any idea what might be going on here? >> > > I've now found older reports of this on this list, and turns out it was a > Qt 5 bug: > > https://codereview.qt-project.org/#/c/126136/ > > It's fixed in 5.6, but we're basing our product on Kubuntu 16.04. Is there > nothing that can be done on the VTK or application side to work around this > on the buggy Qt versions? > > Is anyone else in the same boat? > Seems I can work around the issue application-side with if self.timer.elapsed() > 16: interactor.Render() self.timer.start() instead of a blind call to Render(), where self.timer is a QElapsedTimer(). Still a bit of an inconvenience though :( Elvis > Elvis > > >> >> Elvis >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 20 07:32:41 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 20 Jun 2016 13:32:41 +0200 Subject: [vtkusers] Grabbing focus from custom interactor style in Python In-Reply-To: References: Message-ID: 2016-06-17 14:27 GMT+02:00 Elvis Stansvik : > Hi, > > Looking at how e.g. vtkInteractorStyleTrackballCamera, one of the built-in > interactor styles, handles left mouse button presses, it does > > this->GrabFocus(this->EventCallbackCommand); > > in order to grab focus for the duration of the interaction. That is, it > calls vtkInteractorObserver::GrabFocus, passing in > vtkInteractorObserver::EventCallbackCommand, which is a protected variable. > > I'm basing my custom interactor style on vtkInteractorStyleUser, and I > would like to do the same (grab focus during an interaction), but I'm > working from Python and can't access the > vtkInteractorObserver::EventCallbackCommand variable in my > vtkInteractorStyleUser subclass. > > Any ideas on how to do this is much appreciated! > This is less of an issue since it seems somehow Qt magically takes care of this for me, e.g. if I begin a click-drag operation inside the widget, my interactor style keeps getting mouse move events even if I drag outside the window. So I'm happy for now. It would still have been nice if there were protected getters for some of the protected variables in vtkInteractorObserver such as EventCallbackCommand, to make them accessible from Python subclasses. Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Mon Jun 20 07:45:06 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Mon, 20 Jun 2016 05:45:06 -0600 Subject: [vtkusers] Grabbing focus from custom interactor style in Python In-Reply-To: References: Message-ID: On Mon, Jun 20, 2016 at 5:32 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > It would still have been nice if there were protected getters for some of > the protected variables in vtkInteractorObserver such as > EventCallbackCommand, to make them accessible from Python subclasses. > It wouldn't help. Python subclasses can only access the public methods of their VTK superclasses. Python does not rigorously support the idea of "protected" access. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 20 08:05:39 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 20 Jun 2016 14:05:39 +0200 Subject: [vtkusers] Grabbing focus from custom interactor style in Python In-Reply-To: References: Message-ID: 2016-06-20 13:45 GMT+02:00 David Gobbi : > On Mon, Jun 20, 2016 at 5:32 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> It would still have been nice if there were protected getters for some of >> the protected variables in vtkInteractorObserver such as >> EventCallbackCommand, to make them accessible from Python subclasses. >> > > It wouldn't help. Python subclasses can only access the public methods of > their VTK superclasses. Python does not rigorously support the idea of > "protected" access. > Aha. Yes, then it's futile. Elvis > > - David > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Mon Jun 20 08:23:58 2016 From: david.lonie at kitware.com (David Lonie) Date: Mon, 20 Jun 2016 08:23:58 -0400 Subject: [vtkusers] How to enable gl2ps in VTK 7 with OpenGL2 In-Reply-To: References: Message-ID: Hi Patricio, You'll have better luck just checking out the development version of VTK, rather than trying to patch a release. There are instructions for checking out the current development version (the 'master' branch) of VTK here: https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/download.md HTH, Dave On Fri, Jun 17, 2016 at 4:36 PM, Patricio Palma C. wrote: > Dear Expert > > I'm trying to enable gl2ps in VTK7 with OpenGL2 using diff file took from > a VTK gitlab commit ( > https://gitlab.kitware.com/vtk/vtk/commit/ea116f03386eb7570c70c16fc8d0669047520925 > ) the commit is called " > Merge topic 'opengl2-gl2ps' > ?" ? > The thing is that after applying diff file to the official VTK 7 source > tree I'm having probles to build VTK. Specifically it complains about > issues in Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx > > My question are: Am I missing any additional patch? Is there any other way > to do this better? > > Thanks! > -- > Patricio Palma Contreras > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 20 09:02:10 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 20 Jun 2016 15:02:10 +0200 Subject: [vtkusers] How to be notified when an interaction style is set (from Python)? Message-ID: Hi all, In my custom interaction style (derived from vtkInteractionStyleUser), I have a need to be notified when the interaction style is set on an interactor. The reason I need this is that the purpose of my interaction style is to lock the camera position to a cylinder around my subject: The user should be able to zoom in/out, rotate around the subject on a circle, change the azimuth, and pan up/down along the subject (which has the shape of standing cylinder), but not perform other camera movements. The focal point should always be on the axis through the middle of my subject which is parallel to the Y ("vertical") axis. I therefore would like to do some initialization of the camera when the interactor is first set on the interactor style (and, I guess equivalently, when the interaction style is set on the interactor). In C++ I think I could override SetInteractor on the interactor style, but in Python that won't work. Is there some event I could listen for which fires when the interaction style gets a new interactor? Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From patriciop at gmail.com Mon Jun 20 09:10:09 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Mon, 20 Jun 2016 09:10:09 -0400 Subject: [vtkusers] How to enable gl2ps in VTK 7 with OpenGL2 In-Reply-To: References: Message-ID: Thanks! One last question. Is the GL2PS2OpenGL2 feature scheduled for 7.1? Regards Patricio ? On Mon, Jun 20, 2016 at 8:23 AM, David Lonie wrote: > Hi Patricio, > > You'll have better luck just checking out the development version of VTK, > rather than trying to patch a release. There are instructions for checking > out the current development version (the 'master' branch) of VTK here: > https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/download.md > > HTH, > Dave > > On Fri, Jun 17, 2016 at 4:36 PM, Patricio Palma C. > wrote: > >> Dear Expert >> >> I'm trying to enable gl2ps in VTK7 with OpenGL2 using diff file took from >> a VTK gitlab commit ( >> https://gitlab.kitware.com/vtk/vtk/commit/ea116f03386eb7570c70c16fc8d0669047520925 >> ) the commit is called " >> Merge topic 'opengl2-gl2ps' >> ?" ? >> The thing is that after applying diff file to the official VTK 7 source >> tree I'm having probles to build VTK. Specifically it complains about >> issues in Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx >> >> My question are: Am I missing any additional patch? Is there any other >> way to do this better? >> >> Thanks! >> -- >> Patricio Palma Contreras >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From sankhesh.jhaveri at kitware.com Mon Jun 20 09:33:52 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Mon, 20 Jun 2016 09:33:52 -0400 Subject: [vtkusers] vtkDICOMImageReader check if I can read a directory In-Reply-To: <1466412960970-5738773.post@n5.nabble.com> References: <1466412960970-5738773.post@n5.nabble.com> Message-ID: ?Unfortunately no. Under the covers, vtkDICOMImageReader also loops over all files in the directory and tests each file using CanReadFile().? *Sankhesh Jhaveri* *Sr. Research & Development Engineer* ? | ? Kitware ? ?| (518) 881 ?-? 4417 On Mon, Jun 20, 2016 at 4:56 AM, fblupi wrote: > I'm trying to check if I can read a directory with multiple DICOM images > inside before reading it like in this example: > http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOMSeries > > > I know that I can check an individual image with the CanReadFile method of > vtkDICOMImageReader but, is there a way to do the same with a full > directory? > > > > > > -- > View this message in context: > http://vtk.1045678.n5.nabble.com/vtkDICOMImageReader-check-if-I-can-read-a-directory-tp5738773.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Mon Jun 20 10:12:33 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Mon, 20 Jun 2016 08:12:33 -0600 Subject: [vtkusers] How to be notified when an interaction style is set (from Python)? In-Reply-To: References: Message-ID: On Mon, Jun 20, 2016 at 7:02 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > Hi all, > > In my custom interaction style (derived from vtkInteractionStyleUser), I > have a need to be notified when the interaction style is set on an > interactor. > > The reason I need this is that the purpose of my interaction style is to > lock the camera position to a cylinder around my subject: The user should > be able to zoom in/out, rotate around the subject on a circle, change the > azimuth, and pan up/down along the subject (which has the shape of standing > cylinder), but not perform other camera movements. The focal point should > always be on the axis through the middle of my subject which is parallel to > the Y ("vertical") axis. I therefore would like to do some initialization > of the camera when the interactor is first set on the interactor style > (and, I guess equivalently, when the interaction style is set on the > interactor). > > In C++ I think I could override SetInteractor on the interactor style, but > in Python that won't work. Is there some event I could listen for which > fires when the interaction style gets a new interactor? > Only the ModifiedEvent, but it fires a lot and therefore observing it is inefficient. If you have your own interactor class (and if you use it throughout your application), then you can override its SetInteractorStyle() method since that method is called from the Python side. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From luis.vieira at vektore.com Mon Jun 20 10:15:59 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Mon, 20 Jun 2016 10:15:59 -0400 Subject: [vtkusers] Context vtk-developers Digest, Vol 146, Issue 15 Message-ID: <03ab01d1cafe$45a80c00$d0f82400$@vektore.com> Hi David, Do you meant this transformation? vtkSmartPointer projectedTexture = vtkSmartPointer::New(); David >> The pick coordinates will be points on the VRML geometry, not >> image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. >>> Thank you, Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -----Original Message----- From: Luis Vieira [mailto:luis.vieira at vektore.com] Sent: June 14, 2016 11:38 AM To: 'vtk-developers at vtk.org' ; 'vtkusers at vtk.org' Cc: 'David Thompson' Subject: Contents of vtk-developers Digest, Vol 146, Issue 15 Hi David, Also, I have tried, unsuccessfully, as well as following: >> It looks like you are positioning the camera using image parameters... but you are not mapping the image directly. Instead, you are mapping geometry from a VRML file and texturing it with the image. >> renderer->ComputeVisiblePropBounds(bounds); vtkCamera* cam = renderer->GetActiveCamera(); cam->SetFocalPoint((bounds[0] + bounds[1]) / 2.0, (bounds[2] + cam->bounds[3]) / 2.0, (bounds[4] + bounds[5]) / 2.0); cam->SetPosition((bounds[0] + bounds[1]) / 2.0, (bounds[2] + bounds[3]) cam->/ 2.0, bounds[4] + bounds[5]); SetViewUp(0, 1, 0); Please, could you be more clear about this? >> The pick coordinates will be points on the VRML geometry, not >> image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. >>> Tks, Luis Vieira, Toronto - ON Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -----Original Message----- From: David Thompson [mailto:david.thompson at kitware.com] Sent: June 14, 2016 10:37 AM To: Luis Vieira Cc: vtk-developers at vtk.org Subject: Re: [vtk-developers] Rendering Image and Picking Points Hi Luis, > ...I am struggling to rendering an Image and set up the camera focal > point to placed that image within the center of the camera. > > 1- I want this because the point is when I am rotating the object and > picking point in its surface I got the X, Y and Z world coordinates > that doesn't match the real coordinates of the camera; > > 2- When I am trying to use those coordinates once I had picked to calculate the center of mass between them , the results are not accurately rights. And everything that I have to derivate/build also are not, as well as when I make a Plane and the its origin goes away into the camera out of my cylinder(image). ... It looks like you are positioning the camera using image parameters... but you are not mapping the image directly. Instead, you are mapping geometry from a VRML file and texturing it with the image. The pick coordinates will be points on the VRML geometry, not image-space coordinates. There is an additional transform from texture coordinates to image coordinates that is being ignored. David Hello Guys!! First of all, I have to say that I appreciate any help! I am struggling to rendering an Image and set up the camera focal point to placed that image within the center of the camera. 1- I want this because the point is when I am rotating the object and picking point in its surface I got the X, Y and Z world coordinates that doesn't match the real coordinates of the camera; 2- When I am trying to use those coordinates once I had picked to calculate the center of mass between them , the results are not accurately rights. And everything that I have to derivate/build also are not, as well as when I make a Plane and the its origin goes away into the camera out of my cylinder(image). Following my code and attached picture. Thank you very much!! Luis MainWindow.cpp void MainWindow::ProcessImage(QString _model, QString _image) { double bounds[6] = { +1, -1, +1, -1, +1, -1 }; qvtkWidget->setVisible(true); std::string iname = _model.toStdString();//model is a *.obj Cylinder of Solid rock with h1024xw1024"; std::string imagename = _image.toStdString() ;//is the texture *.bmp file that wraps up the cylinder"; vtkRenderer* renderer = vtkRenderer::New(); vtkRenderWindow* renderWindow = vtkRenderWindow::New(); renderWindow->StereoCapableWindowOn(); // Activate 3DConnexion device only on the left render window. qvtkWidget->SetUseTDx(true); qvtkWidget->SetRenderWindow(renderWindow); //renderWindow->Delete(); const double angleSensitivity = 0.02; const double translationSensitivity = 0.001; QVTKInteractor *iren = qvtkWidget->GetInteractor(); vtkInteractorStyle *s = static_cast(iren->GetInteractorStyle()); vtkTDxInteractorStyleCamera *t = static_cast(s->GetTDxStyle()); t->GetSettings()->SetAngleSensitivity(angleSensitivity); t->GetSettings()->SetTranslationXSensitivity(translationSensitivity); t->GetSettings()->SetTranslationYSensitivity(translationSensitivity); t->GetSettings()->SetTranslationZSensitivity(translationSensitivity); // Read the image which will be the texture QMenu* popup1 = new QMenu(qvtkWidget); popup1->addAction("Draw Line"); popup1->addAction("Draw Plane"); popup1->addAction("Draw Clip"); popup1->addAction("Background White"); popup1->addAction("Background Black"); popup1->addAction("Stereo Rendering"); connect(popup1, SIGNAL(triggered(QAction*)), this, SLOT(ProcessUserViewPortInteraction(QAction*))); std::cout << "Reading image " << imagename << "..." << std::endl; vtkBMPReader* bmpReader = vtkBMPReader::New(); bmpReader->SetFileName(imagename.c_str()); bmpReader->Update(); std::cout << "Done" << std::endl; // Creating the texture std::cout << "Making a texture out of the image... " << std::endl; vtkTexture* texture = vtkTexture::New(); texture->SetInputConnection(bmpReader->GetOutputPort()); std::cout << "Done" << std::endl; // Import geometry from a VRML file vtkSmartPointer imageViewer = vtkSmartPointer::New(); imageViewer->SetInputConnection(bmpReader->GetOutputPort()); //imageViewer->SetupInteractor(renderWindowInteractor); imageViewer->SetSize(600, 600); vtkDataSet *pDataset; // Import geometry from an OBJ file std::cout << "Reading OBJ file " << iname << "..." << std::endl; vtkOBJReader* reader = vtkOBJReader::New(); reader->SetFileName(iname.c_str()); reader->Update(); vtkPolyData *polyData2 = reader->GetOutput(); std::cout << "Obj reader = " << polyData2->GetNumberOfPoints() << std::endl; std::cout << "Obj point data = " << polyData2->GetPointData()->GetNumberOfArrays() << std::endl; std::cout << "Obj point data tuples = " << polyData2->GetPointData()->GetArray(0)->GetNumberOfTuples() << polyData2->std::endl; std::cout << "Obj point data compon = " << polyData2->GetPointData()->GetArray(0)->GetNumberOfComponents() << std::endl; // //// Renderer vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); mapper->SetInputData(polyData2); vtkActor* texturedQuad = vtkActor::New(); texturedQuad->SetMapper(mapper); texturedQuad->SetTexture(texture); //texturedQuad->SetPosition(0, 0, 0); // Create Normal Vectors to enhance smoothness & illumination vtkSmartPointer normals = vtkSmartPointer::New(); normals->SetInputData(polyData2); normals->SetFeatureAngle(60.0); // Mapper vtkPolyDataMapper *SolidMapper = vtkPolyDataMapper::New(); SolidMapper->SetInputData(normals->GetOutput()); SolidMapper->ScalarVisibilityOff(); // Actor vtkActor *SolidActor = vtkActor::New(); SolidActor->SetMapper(SolidMapper); vtkImageData* image = imageViewer->GetInput(); int dim[3]; image->GetDimensions(dim); double spacing[3]; image->GetSpacing(spacing); double origin[3]; image->GetOrigin(origin); renderer->ComputeVisiblePropBounds(bounds); Renderer->AddActor(SolidActor); Renderer->AddActor(texturedQuad); float Cx = (dim[0] * spacing[0]) / 2. + origin[0]; float Cy = (dim[1] * spacing[1]) / 2. + origin[1]; vtkCamera* m_Camera = vtkCamera::New(); m_Camera->SetPosition(Cx, Cy, 1); m_Camera->SetFocalPoint(Cx, Cy, 0); m_Camera->SetViewUp(0, 1, 0); m_Camera->GetDirectionOfProjection(); m_Camera->ParallelProjectionOn(); Renderer->SetActiveCamera(m_Camera); Renderer->SetBackground(0, 0, 0); // Background color white Renderer->ResetCamera(); qvtkWidget->GetRenderWindow()->AddRenderer(Renderer); qvtkWidget->GetRenderWindow()->Render(); //renderer->ResetCamera(); vtkIPWCallback* myCallback = vtkIPWCallback::New(); myCallback->renderer = Renderer; myCallback->renderWindowInteractor = qvtkWidget->GetRenderWindow()->GetInteractor(); myCallback->readerClip = vtkOBJReader::New(); myCallback->readerClip = reader; this->styleCallback = myCallback; //renderer->ResetCamera(); this->stylePicker->normalsKore = vtkSmartPointer::New(); this->stylePicker->normalsKore = normals; this->stylePicker->renderer = vtkSmartPointer::New(); this->stylePicker->actor = vtkActor::New(); this->stylePicker->mapper = vtkPolyDataMapper::New(); this->stylePicker->points = vtkSmartPointer::New(); this->stylePicker->vertices = vtkSmartPointer::New(); this->stylePicker->renderer = Renderer; this->stylePicker->renderWindowInteractor = qvtkWidget->GetRenderWindow()->GetInteractor(); vtkSmartPointer pointPicker = vtkSmartPointer::New(); qvtkWidget->GetRenderWindow()->GetInteractor()->SetPicker(pointPicker); qvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(this- qvtkWidget->>sty lePicker); Connections = vtkEventQtSlotConnect::New(); Connections->Connect(qvtkWidget->GetRenderWindow()->GetInteractor(), vtkCommand::KeyPressEvent, this, SLOT(popup(vtkObject*, unsigned long, void*, void*, vtkCommand*)), popup1, 1.0); } MainWindow.h //Point PickFunction class MouseInteractorStyle2 : public vtkInteractorStyleTrackballCamera { public: std::vector pointList; std::vector pointListPlane; vtkSmartPointer matrix; vtkSmartPointer normalsKore = vtkSmartPointer::New(); vtkSmartPointer spherePickSource; vtkSmartPointer points = vtkSmartPointer::New(); vtkSmartPointer vertices = vtkSmartPointer::New(); vtkSmartPointer polydata; vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); vtkActor* actor; vtkPolyDataMapper* mapper; static MouseInteractorStyle2* New() { return new MouseInteractorStyle2; } //vtkTypeMacro(MouseInteractorStyle2, vtkInteractorStyleTrackballCamera); virtual void OnRightButtonDown() { int* clickPos = this->renderWindowInteractor->GetEventPosition(); // Pick from this location. vtkPropPicker* picker = vtkPropPicker::New(); picker->Pick(clickPos[0], clickPos[1], 0, this->renderer); picker->Pick(clickPos[0], clickPos[1], 0, this->renderer); double* pos = picker->GetPickPosition(); std::cout << "Pick position (world coordinates) is: " << pos[0] << " " << pos[1] << " " << pos[2] << std::endl; std::cout << "Picked actor: " << picker->GetActor() << std::endl; // Add label array. polydata = vtkSmartPointer::New(); spherePickSource = vtkSmartPointer::New(); spherePickSource->SetRadius(0.030); spherePickSource->SetCenter(pos[0], pos[1], pos[2]); if (pointList.size() < 2) { //pointList.clear(); pointList.push_back(pos); } if (pointListPlane.size() < 30) { pointListPlane.push_back(pos); } //Create a mapper and actor mapper = vtkPolyDataMapper::New(); mapper->SetInputConnection(spherePickSource->GetOutputPort()); actor = vtkActor::New(); actor->SetMapper(mapper); actor->GetProperty()->SetPointSize(5); actor->GetProperty()->SetColor(1, 1, 1); this->renderer->AddActor(actor); vtkInteractorStyleTrackballCamera::OnRightButtonDown(); } private: }; Luis Vieira, Toronto - ON Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com ------------------------------ Message: 2 Date: Thu, 16 Jun 2016 16:06:08 -0600 From: David Gobbi To: VTK Developers , David Lonie Subject: [vtk-developers] Wrapping the new arrays Message-ID: Content-Type: text/plain; charset="utf-8" Hi David, Was it intended to have the new VTK data arrays wrapped in Python? They're all wrappable except for the vtkGenericDataArray (it's a special case). In order to wrap vtkSOADataArrayTemplate and the templated array types, Python would just have to be fooled into thinking that their superclass is vtkDataArray, similar to what is already done for the old array classes. That way, Python wouldn't have to deal with the problematic vtkGenericDataArray template. The Python wrappers can be told to instantiate the templates over the usual set of data types. This part is easy, it has already done for vtkArrayIteratorTemplate, vtkDenseArray, and vtkSparseArray. So I'm just wondering if wrapping these classes was part of the plan. I get an itch whenever C++ stuff is added to VTK that can't be used from Python :) - David -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 3 Date: Thu, 16 Jun 2016 23:47:52 -0400 From: Sankhesh Jhaveri To: Luis Vieira Cc: vtk-developers , vtkusers at vtk.org Subject: Re: [vtk-developers] Contents of vtk-developers Digest, Vol 146, Issue 17 -RE: vtkAxesActor within VTK 7.0 and QVTKWidget Message-ID: Content-Type: text/plain; charset="utf-8" Nice! Glad you found it. Sankhesh On Thu, Jun 16, 2016 at 4:40 PM, Luis Vieira wrote: > Hi Sankhesh, > > > > Got this, was missing those two highlighted yellow lines: > > > > viewPortOMWidget = vtkSmartPointer::New(); > > viewPortOMWidget->SetOrientationMarker(viewPortAxActor); > > viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); > > viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); > > * viewPortOMWidget**->**SetEnabled**(1);* //missing > > *viewPortOMWidget**->**InteractiveOn**();**//*missing > > > > Thank you, > > > > *Luis Vieira*, Toronto > > Consultant, Software Engineer > > Vektore Exploration Consulting Corporation > > ca.linkedin.com/in/joaoluisvieira > > luis.vieira at vektore.com > > www.vektore.com > > > > *From:* Sankhesh Jhaveri [mailto:sankhesh.jhaveri at kitware.com] > *Sent:* June 16, 2016 9:54 AM > *To:* Luis Vieira > *Cc:* vtk-developers ; vtkusers at vtk.org > *Subject:* Re: [vtk-developers] vtkAxesActor within VTK 7.0 and > QVTKWidget > > > > Hi Luis, > > > > I don't see anything obvious but I noticed that you are initializing > vtkRenderingOpenGL i.e. using the OpenGL backend. Mind trying the > OpenGL2 backend to find out whether the issue is specific to the old backend. > > > > Sankhesh > > > > > > > On Tue, Jun 14, 2016 at 3:20 PM, Luis Vieira > wrote: > > Hello everyone, > > > > I had migrated my VTK platform from 6.1 to 7.0. I had noticed some > changes, and one of those is giving me a hard work to do that is to > render > vtkSmartPointer::New() within QVTWidget. Previously, was > easily, with VTK 6.1. Now, I am trying that and I got the Cone > working/rendering well and its interactions. However, I haven't gotten > absolutely nothing on my viewport from my vtkAxesActor even been shown . > Following my code (C++), regarding that this works outside QVTWidget > viewport. > > > > I appreciate any ideas and help. > > ???????? > > #include "vtkRenderWindow.h" > > #include "vtkRenderer.h" > > #include "vtkRenderWindowInteractor.h" > > #include "vtkEventQtSlotConnect.h" > > #include "vtkCommand.h" > > #include "vtkConeSource.h" > > #include "vtkSphereSource.h" > > #include "vtkPolyDataMapper.h" > > #include "vtkActor.h" > > #include "vtkActorCollection.h" > > #include "vtkCaptionActor2D.h" > > #include "vtkTextActor.h" > > #include "vtkTextProperty.h" > > #include "vtkActor2D.h" > > #include "vtkAxesActor.h" > > #include "vtkOrientationMarkerWidget.h" > > #include "vtkInteractorStyle.h" > > #include "vtkTDxInteractorStyleCamera.h" > > #include "vtkTDxInteractorStyleSettings.h" > > #include "vtkInteractorStyleRubberBandPick.h" > > #include "vtkInteractorStyleTrackballCamera.h" > > #include "vtkInteractorStyleTrackball.h" > > #include "QVTKInteractorAdapter.h" > > #include "QVTKInteractor.h" > > #include "QVTKApplication.h" > > ??. > > . > > . > > . > > #include > > VTK_MODULE_INIT(vtkRenderingOpenGL); > > VTK_MODULE_INIT(vtkInteractionStyle); > > . > > . > > . > > > > Mainwindow.cpp > > > > Void procedure() > > { > > vtkRenderWindow* renwin = vtkRenderWindow::New(); > > renwin->StereoCapableWindowOn(); > > > > // Activate 3DConnexion device only on the left render > window. > > // QVTKWidget > > mainViewPort->SetUseTDx(true); // QVTKWidget = mainViewPort. > > > > mainViewPort->SetRenderWindow(renwin); > > renwin->Delete(); > > > > const double angleSensitivity = 0.02; > > const double translationSensitivity = 0.001; > > > > QVTKInteractor *iren = mainViewPort->GetInteractor(); > > vtkInteractorStyle *s = > > static_cast(iren-> > GetInteractorStyle()); > > vtkTDxInteractorStyleCamera *t = > > static_cast(s-> > GetTDxStyle()); > > > > t->GetSettings()->SetAngleSensitivity(angleSensitivity); > > t->GetSettings()->SetTranslationXSensitivity( > translationSensitivity); > > t->GetSettings()->SetTranslationYSensitivity( > translationSensitivity); > > t->GetSettings()->SetTranslationZSensitivity( > translationSensitivity); > > > > > > > > // add a renderer > > Ren1 = vtkRenderer::New(); > > mainViewPort->GetRenderWindow()->AddRenderer(Ren1); > > > > vtkConeSource* cone = vtkConeSource::New(); > > vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); > > mapper->SetInputConnection(cone->GetOutputPort()); > > vtkActor* actor = vtkActor::New(); > > actor->SetMapper(mapper); > > Ren1->AddViewProp(actor); > > actor->Delete(); > > mapper->Delete(); > > cone->Delete(); > > > > > > > > mainViewPort->GetRenderWindow()->Render(); > > > > viewPortAxActor = vtkSmartPointer::New(); > > viewPortAxActor->GetXAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetXAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetXAxisCaptionActor2D()->SetHeight(0.05); > > viewPortAxActor->GetYAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetYAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetYAxisCaptionActor2D()->SetHeight(0.05); > > viewPortAxActor->GetZAxisCaptionActor2D()->GetCaptionTextProperty()-> > SetColor(0, 0, 0); > > viewPortAxActor->GetZAxisCaptionActor2D()->SetWidth(0.05); > > viewPortAxActor->GetZAxisCaptionActor2D()->SetHeight(0.05); > > > > viewPortOMWidget = vtkSmartPointer::New(); > > viewPortOMWidget->SetOrientationMarker(viewPortAxActor); > > viewPortOMWidget->SetViewport(0.7, 0.0, 1.00, 0.3); > > viewPortOMWidget->SetInteractor(mainViewPort->GetInteractor()); > > > > . > > . > > . > > ..... > > } > > > > Any ideas? > > > > Thank you very much. > > > > *Luis Vieira*, Toronto > > Consultant, Software Engineer > > Vektore Exploration Consulting Corporation > > luis.vieira at vektore.com > > www.vektore.com > > > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Search the list archives at: > http://markmail.org/search/?q=vtk-developers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtk-developers > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Subject: Digest Footer _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Search the list archives at: http://markmail.org/search/?q=vtk-developers Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/vtk-developers ------------------------------ End of vtk-developers Digest, Vol 146, Issue 22 *********************************************** From ken.martin at kitware.com Mon Jun 20 10:30:49 2016 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 20 Jun 2016 10:30:49 -0400 Subject: [vtkusers] VTK 7.0 - Modified meshes is not updated like in the previous versions of VTK In-Reply-To: References: Message-ID: Make sure you call Modified() on what you change in the polydata. If you changed the points then do a polydata.GetPoints().Modified(); if you changed the cells then do something like polydata.GetPolys().Modified(); most often that is the problem. Folks directly change some part of the polydata but only call modified at the top. Thanks Ken On Wed, Jun 15, 2016 at 5:56 AM, Andrea Vitali wrote: > Dear All, > > I developed a virtual tool for emulating sculpting operations on a > triangular mesh in VTK (something like http://stephaneginier.com/sculptgl/ > ). > > The tool works fine with VTK 6.3.0, but I migrated to VTK 7.0 a week ago. > VTK 7.0 do not update the rendered actor relative to 3D sculpted model, but > the relative polydata has been updated in correct way. > > It seems that modifications on polydata are not updated in the actor as > done with previous version of VTK. > > Any idea to solve this problem? > > Thank you in advance > > Andrea > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Mon Jun 20 10:34:23 2016 From: david.lonie at kitware.com (David Lonie) Date: Mon, 20 Jun 2016 10:34:23 -0400 Subject: [vtkusers] How to enable gl2ps in VTK 7 with OpenGL2 In-Reply-To: References: Message-ID: On Mon, Jun 20, 2016 at 9:10 AM, Patricio Palma C. wrote: > Thanks! One last question. Is the GL2PS2OpenGL2 feature scheduled for 7.1? > Yes, it will be available in the next release. Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 20 11:54:39 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 20 Jun 2016 17:54:39 +0200 Subject: [vtkusers] How to be notified when an interaction style is set (from Python)? In-Reply-To: References: Message-ID: Den 20 juni 2016 4:12 em skrev "David Gobbi" : > > On Mon, Jun 20, 2016 at 7:02 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: >> >> Hi all, >> >> In my custom interaction style (derived from vtkInteractionStyleUser), I have a need to be notified when the interaction style is set on an interactor. >> >> The reason I need this is that the purpose of my interaction style is to lock the camera position to a cylinder around my subject: The user should be able to zoom in/out, rotate around the subject on a circle, change the azimuth, and pan up/down along the subject (which has the shape of standing cylinder), but not perform other camera movements. The focal point should always be on the axis through the middle of my subject which is parallel to the Y ("vertical") axis. I therefore would like to do some initialization of the camera when the interactor is first set on the interactor style (and, I guess equivalently, when the interaction style is set on the interactor). >> >> In C++ I think I could override SetInteractor on the interactor style, but in Python that won't work. Is there some event I could listen for which fires when the interaction style gets a new interactor? > > > Only the ModifiedEvent, but it fires a lot and therefore observing it is inefficient. If you have your own interactor class (and if you use it throughout your application), then you can override its SetInteractorStyle() method since that method is called from the Python side. Ah, that's true. I have control over the interactor used, so I could subclass it for just this purpose. Thanks! Elvis > > - David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrea.vitali1 at unibg.it Mon Jun 20 12:31:56 2016 From: andrea.vitali1 at unibg.it (PhD Andrea Vitali) Date: Mon, 20 Jun 2016 09:31:56 -0700 (MST) Subject: [vtkusers] VTK 7.0 - Modified meshes is not updated like in the previous versions of VTK In-Reply-To: References: Message-ID: <1466440316553-5738795.post@n5.nabble.com> It works!!! Great!!! Thanks, Andrea -- View this message in context: http://vtk.1045678.n5.nabble.com/VTK-7-0-Modified-mesh-is-not-updated-like-in-the-previous-versions-of-VTK-tp5738672p5738795.html Sent from the VTK - Users mailing list archive at Nabble.com. From ken.martin at kitware.com Mon Jun 20 15:30:54 2016 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 20 Jun 2016 15:30:54 -0400 Subject: [vtkusers] Adding a renderer vs setting its render window In-Reply-To: References: Message-ID: I think that comment is super old. Way back before we had proper object factories we would create renderers using a MakeRenderer function. The standard way to do it now is to create a renderer like any other VTK object and add it to the renderwindow. That will, as a convenience, set the renderwindow on the renderer as well. So that part of the comment is still true. You should generally not need to call SetRenderWindow as AddRenderer has already done it for you. Thanks Ken On Thu, Jun 16, 2016 at 7:21 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > What is the difference between > > renderer.SetRenderWindow(renderWindow) > > and > > renderWindow.addRenderer(renderer) > > ? Is it just two different ways of doing the same thing? > > Also, the docs for SetRenderWindow [1] says > > "This is automatically set when the renderer is created by MakeRenderer. > The user probably shouldn't ever need to call this method." > > But I couldn't find any info in the docs about a MakeRenderer. Digging in > the VTK source, it seems there's a vtkParallelRenderManager::MakeRenderer. > Is that the one the docs refers to? Could someone clarify this note in the > docs? Why shouldn't I need to call SetRenderWindow? > > Elvis > > [1] > http://www.vtk.org/doc/nightly/html/classvtkRenderer.html#ae3a6088ecdcdec6b7e0b6482974de8c2 > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From berk.geveci at kitware.com Mon Jun 20 16:31:05 2016 From: berk.geveci at kitware.com (Berk Geveci) Date: Mon, 20 Jun 2016 16:31:05 -0400 Subject: [vtkusers] VTK bug hackathon Message-ID: Hi folks, We are planning a VTK bug hackathon on July 6. Going forward, we would like this to be a monthly event during which the community comes together to address bugs reported to the tracker. It will be an all day event that we will host physically at Kitware Headquarters in Clifton Park, NY as well as online via Google Hangout. All are welcome to attend as long as they know the code base enough to fix bugs. Any questions? Comments? Any potential issue with the date? Best, -berk -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.boeckel at kitware.com Mon Jun 20 17:36:06 2016 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Mon, 20 Jun 2016 17:36:06 -0400 Subject: [vtkusers] VTK bug hackathon In-Reply-To: References: Message-ID: <20160620213606.GA1266@megas.kitware.com> On Mon, Jun 20, 2016 at 16:31:05 -0400, Berk Geveci wrote: > We are planning a VTK bug hackathon on July 6. Going forward, we would like > this to be a monthly event during which the community comes together to > address bugs reported to the tracker. It will be an all day event that we > will host physically at Kitware Headquarters in Clifton Park, NY as well as > online via Google Hangout. All are welcome to attend as long as they know > the code base enough to fix bugs. > > Any questions? Comments? Any potential issue with the date? We've converted from Mantis over to GitLab for CMake already. Do we want to do this before the first bug hackathon? Issue numbers can (and are likely to) be preserved. Pros: - it isn't Mantis; - issues can be properly labeled as they are looked at; this would help with future bug hackathons. Example labels based on the scheme CMake is using (more can be added during the hackathon): - area:build - area:doc - area:examples - area:parallel - area:rendering - driver:ati - driver:intel - driver:nvidia - os:linux - os:macos - os:windows - triage:ack - triage:easy - triage:feature - triage:needinfo - triage:regression - our current migration leaves comments and such behind (it links to the old issue for continuity), so any discussion done at the first hackathon will not be behind a link; - easier way to get others in on an issue (@mention with tab completion); - did I mention it isn't Mantis? Cons: - a shorter deadline for me to complete the migration. - ? It is possible to preserve authorship and assignment of issues if you'd like[1] . If you don't want this, assignment will be lost and kwrobot will be the "opener" of the issue. Closed issues will all be opened and closed by kwrobot without assignment (to help minimize the email storm). --Ben [1]If you'd like to be assigned your issues and automatically subscribed to those issues, *privately* email me your display username on Mantis and GitLab. As an example, here the display name of the reporter is "edice" and the assignee is "Haocheng Liu": http://www.paraview.org/Bug/view.php?id=16140 If you have multiple Mantis users, they can both be mapped to a single user. From david.gobbi at gmail.com Mon Jun 20 18:15:50 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Mon, 20 Jun 2016 16:15:50 -0600 Subject: [vtkusers] VTK bug hackathon In-Reply-To: <20160620213606.GA1266@megas.kitware.com> References: <20160620213606.GA1266@megas.kitware.com> Message-ID: On Mon, Jun 20, 2016 at 3:36 PM, Ben Boeckel wrote: > > > We've converted from Mantis over to GitLab for CMake already. Do we want > to do this before the first bug hackathon? Issue numbers can (and are > likely to) be preserved. > I have a strong preference to keep the bugs in Mantis until after the hackathon. Let's clear as many bugs as possible out of the old system before switching over to the new. One thing that mantis has on gitlab is speed. I don't know whether it's my laptop of the fact that I'm on the other side of the continent, but gitlab is painfully slow, while mantis (though ugly) is snappy. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 01:33:17 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 07:33:17 +0200 Subject: [vtkusers] Adding a renderer vs setting its render window In-Reply-To: References: Message-ID: 2016-06-20 21:30 GMT+02:00 Ken Martin : > I think that comment is super old. Way back before we had proper object > factories we would create renderers using a MakeRenderer function. The > standard way to do it now is to create a renderer like any other VTK object > and add it to the renderwindow. That will, as a convenience, set the > renderwindow on the renderer as well. So that part of the comment is still > true. You should generally not need to call SetRenderWindow as AddRenderer > has already done it for you. > Alright, thanks for the clarifications (and history lesson :)) Ben. Elvis > Thanks > Ken > > > On Thu, Jun 16, 2016 at 7:21 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> What is the difference between >> >> renderer.SetRenderWindow(renderWindow) >> >> and >> >> renderWindow.addRenderer(renderer) >> >> ? Is it just two different ways of doing the same thing? >> >> Also, the docs for SetRenderWindow [1] says >> >> "This is automatically set when the renderer is created by MakeRenderer. >> The user probably shouldn't ever need to call this method." >> >> But I couldn't find any info in the docs about a MakeRenderer. Digging in >> the VTK source, it seems there's a vtkParallelRenderManager::MakeRenderer. >> Is that the one the docs refers to? Could someone clarify this note in the >> docs? Why shouldn't I need to call SetRenderWindow? >> >> Elvis >> >> [1] >> http://www.vtk.org/doc/nightly/html/classvtkRenderer.html#ae3a6088ecdcdec6b7e0b6482974de8c2 >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and > legally privileged information, and it is intended only for the use of the > addressee. Access to this email by anyone else is unauthorized. If you are > not the intended recipient, any disclosure, copying, distribution or any > action taken in reliance on it is prohibited and may be unlawful. If you > received this communication in error please notify us immediately and > destroy the original message. Thank you. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spir.robert at gmail.com Tue Jun 21 02:36:25 2016 From: spir.robert at gmail.com (RobertS) Date: Mon, 20 Jun 2016 23:36:25 -0700 (MST) Subject: [vtkusers] memory leak in vtkStructuredPoints or am I doing something wrong? Message-ID: <1466490985798-5738805.post@n5.nabble.com> Hello all, I'm doing visualization of series of 3D volumes stored in VTK files. First I load all vtk files to vector of vtkStructuredPoints using this simple code inside cycle vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(filename); reader->Update(); ptsCopy = vtkSmartPointer::New(); ptsCopy->DeepCopy(reader->GetOutput()); loadedPoints.push_back(ptsCopy); reader->CloseVTKFile(); then when I want to change the dataset I just call loadedPoints.clear() and start loading other vtk files. Now on windows, everything goes as expected, by calling .clear() memory get freed. This is not the case in linux, here the memory is stil occupied and since I'm working with very large datasets (>12GB) this is a serious problem. Now another interesting thing is, that with some datasets the memory gets cleared even in linux, but with some others it doesn't... I'm using VTK 7.0 compiled from source, vs2015 in windows, gcc6.1 in linux I made a small project that only loads the vtk files to vector and then clears it, displaying amount of used memory in between. I can reproduce the memory leak with this code in linux, in windows it clears the memory. http://tesla.math.sk/vtkbug.7z Here you can download two datasets, zebra is causing the leak, phallusia is not http://tesla.math.sk/zebra.7z http://tesla.math.sk/phallusia.7z Thanks for any help Robert Spir PhD Department of Mathematics Slovak University of Technology Radlinskeho 11 813 68 Bratislava Slovakia -- View this message in context: http://vtk.1045678.n5.nabble.com/memory-leak-in-vtkStructuredPoints-or-am-I-doing-something-wrong-tp5738805.html Sent from the VTK - Users mailing list archive at Nabble.com. From jmalsoaz at yahoo.fr Tue Jun 21 02:34:07 2016 From: jmalsoaz at yahoo.fr (Malsoaz James) Date: Tue, 21 Jun 2016 06:34:07 +0000 (UTC) Subject: [vtkusers] Licensing question References: <1354821623.11170983.1466490847292.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <1354821623.11170983.1466490847292.JavaMail.yahoo@mail.yahoo.com> Hi, I would like to use VTK in a commercial application but I have some questions about the BSD license.?Should I include somewhere the VTK copyright in my application? In source code? In related documents? Currently I'm using version 6.3. I made minor modifications in source file of VTK to fit my needs. Should I publish these changes? Thank you for your answer.Best regards, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.demarle at kitware.com Tue Jun 21 05:18:17 2016 From: dave.demarle at kitware.com (David E DeMarle) Date: Tue, 21 Jun 2016 11:18:17 +0200 Subject: [vtkusers] Licensing question In-Reply-To: <1354821623.11170983.1466490847292.JavaMail.yahoo@mail.yahoo.com> References: <1354821623.11170983.1466490847292.JavaMail.yahoo.ref@mail.yahoo.com> <1354821623.11170983.1466490847292.JavaMail.yahoo@mail.yahoo.com> Message-ID: On Tue, Jun 21, 2016 at 8:34 AM, Malsoaz James via vtkusers < vtkusers at vtk.org> wrote: > Hi, > > I would like to use VTK in a commercial application but I have some > questions about the BSD license. > Should I include somewhere the VTK copyright in my application? In source > code? In related documents? > > Related documents is fine. Perhaps in a readme that you distribute with your application say something to the effect of, this application uses VTK, the license of which can be found ... > Currently I'm using version 6.3. I made minor modifications in source file > of VTK to fit my needs. Should I publish these changes? > > You don't have to publish the changes. But if they improve VTK and you don't mind sharing, it would be great if you could submit a merge request so that everyone benefits by them. Also, by upstreaming, maintaining the patch over time is less trouble. > Thank you for your answer. > Best regards, > > James > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.hirsch at st.ovgu.de Tue Jun 21 06:51:43 2016 From: jan.hirsch at st.ovgu.de (jhirsch) Date: Tue, 21 Jun 2016 03:51:43 -0700 (MST) Subject: [vtkusers] PrintAsCSV method from vtkXYPlotActor crashed Message-ID: <1466506303125-5738809.post@n5.nabble.com> Hello guys, I've taken the plot example and wanted to print out the histogram data as CSV file. It crashed because of a null pointer at this row: in the file "vtkXYPlotActor.cxx (VTK 6.3). My source code looks like this: I do this right before creating the renderer, so there is some data to print. Any ideas why it's not working? -- View this message in context: http://vtk.1045678.n5.nabble.com/PrintAsCSV-method-from-vtkXYPlotActor-crashed-tp5738809.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Tue Jun 21 07:06:41 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 13:06:41 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() Message-ID: Hi all, I have a setup where the camera always moves on a cylinder of radius 3.0 around my subject (just testing with a stack of cones at the moment). The focal point is always positioned along the Y axis, and the camera may be moved up and down independent of the focus point, but the camera is always at a distance of 3 from the Y axis. As soon as the user moves the camera, I reset the camera clipping range with ResetCameraClippingRange(). Despite this, when the camera and the focal point are far away from eachother, the actors (my stack of cones) get clipped by the near plane for some reason. See the attached screenshot which shows the clipping. What I'm doing to my camera (in response to Shift+mouse drag in my custom interactor) to end up in this situation is just: camera = renderer.GetActiveCamera() (x, y, z) = camera.GetPosition() camera.SetPosition(x, y - self.PanningFactor * dy, z) renderer.ResetCameraClippingRange() and I've verified that the camera is always at a distance of 3.0 from the Y axis. The cones I'm using in this test were created with: for i in range(-10, 20): coneSource = vtkConeSource() coneSource.SetDirection(0, 1, 0) coneSource.SetResolution(8) coneSource.SetCenter(0, i, 0) coneMapper = vtkPolyDataMapper() coneMapper.SetInputConnection(coneSource.GetOutputPort()) coneActor = vtkActor() coneActor.SetMapper(coneMapper) widget.renderer.AddActor(coneActor) I don't understand why I see clipping occur here, since I'm using ResetCameraClippingRange, and nothing is behind the camera. The radius of these cones is the default (0.5). It's probably something stupid, but any advice is much appreciated. Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: clipping.png Type: image/png Size: 10542 bytes Desc: not available URL: From elvis.stansvik at orexplore.com Tue Jun 21 07:20:10 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 13:20:10 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: I'm attaching the full code for brevity, but the relevant parts are how I'm treating the camera in my CylindricalInteractionStyle class and the if __name__ == '__main__' block. Elvis 2016-06-21 13:06 GMT+02:00 Elvis Stansvik : > Hi all, > > I have a setup where the camera always moves on a cylinder of radius 3.0 > around my subject (just testing with a stack of cones at the moment). The > focal point is always positioned along the Y axis, and the camera may be > moved up and down independent of the focus point, but the camera is always > at a distance of 3 from the Y axis. > > As soon as the user moves the camera, I reset the camera clipping range > with ResetCameraClippingRange(). Despite this, when the camera and the > focal point are far away from eachother, the actors (my stack of cones) get > clipped by the near plane for some reason. > > See the attached screenshot which shows the clipping. > > What I'm doing to my camera (in response to Shift+mouse drag in my custom > interactor) to end up in this situation is just: > > camera = renderer.GetActiveCamera() > (x, y, z) = camera.GetPosition() > camera.SetPosition(x, y - self.PanningFactor * dy, z) > renderer.ResetCameraClippingRange() > > and I've verified that the camera is always at a distance of 3.0 from the > Y axis. > > The cones I'm using in this test were created with: > > for i in range(-10, 20): > coneSource = vtkConeSource() > coneSource.SetDirection(0, 1, 0) > coneSource.SetResolution(8) > coneSource.SetCenter(0, i, 0) > > coneMapper = vtkPolyDataMapper() > coneMapper.SetInputConnection(coneSource.GetOutputPort()) > > coneActor = vtkActor() > coneActor.SetMapper(coneMapper) > > widget.renderer.AddActor(coneActor) > > I don't understand why I see clipping occur here, since I'm using > ResetCameraClippingRange, and nothing is behind the camera. The radius of > these cones is the default (0.5). > > It's probably something stupid, but any advice is much appreciated. > > Elvis > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: vtk_widget.py Type: application/x-download Size: 17995 bytes Desc: not available URL: From elvis.stansvik at orexplore.com Tue Jun 21 07:27:22 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 13:27:22 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: I just found this very old bug: http://www.vtk.org/Bug/view.php?id=7823 I forgot to mention that I'm using parallell projection for the camera. Could this be the issue I'm seeing? It seems the suggested patch there was never incorporated due to test failures (?). Anyone know of some way of working around this? Elvis 2016-06-21 13:06 GMT+02:00 Elvis Stansvik : > Hi all, > > I have a setup where the camera always moves on a cylinder of radius 3.0 > around my subject (just testing with a stack of cones at the moment). The > focal point is always positioned along the Y axis, and the camera may be > moved up and down independent of the focus point, but the camera is always > at a distance of 3 from the Y axis. > > As soon as the user moves the camera, I reset the camera clipping range > with ResetCameraClippingRange(). Despite this, when the camera and the > focal point are far away from eachother, the actors (my stack of cones) get > clipped by the near plane for some reason. > > See the attached screenshot which shows the clipping. > > What I'm doing to my camera (in response to Shift+mouse drag in my custom > interactor) to end up in this situation is just: > > camera = renderer.GetActiveCamera() > (x, y, z) = camera.GetPosition() > camera.SetPosition(x, y - self.PanningFactor * dy, z) > renderer.ResetCameraClippingRange() > > and I've verified that the camera is always at a distance of 3.0 from the > Y axis. > > The cones I'm using in this test were created with: > > for i in range(-10, 20): > coneSource = vtkConeSource() > coneSource.SetDirection(0, 1, 0) > coneSource.SetResolution(8) > coneSource.SetCenter(0, i, 0) > > coneMapper = vtkPolyDataMapper() > coneMapper.SetInputConnection(coneSource.GetOutputPort()) > > coneActor = vtkActor() > coneActor.SetMapper(coneMapper) > > widget.renderer.AddActor(coneActor) > > I don't understand why I see clipping occur here, since I'm using > ResetCameraClippingRange, and nothing is behind the camera. The radius of > these cones is the default (0.5). > > It's probably something stupid, but any advice is much appreciated. > > Elvis > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 07:35:26 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 13:35:26 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: 2016-06-21 13:20 GMT+02:00 Elvis Stansvik : > I'm attaching the full code for brevity, but the relevant parts are how > I'm treating the camera in my CylindricalInteractionStyle class and the if > __name__ == '__main__' block. > To clarify: To see the problem, run the program and use Shift+mouse drag to move the camera up or down. If you go far enough the cones start to get clipped at the near plane. Elvis > Elvis > > > 2016-06-21 13:06 GMT+02:00 Elvis Stansvik : > >> Hi all, >> >> I have a setup where the camera always moves on a cylinder of radius 3.0 >> around my subject (just testing with a stack of cones at the moment). The >> focal point is always positioned along the Y axis, and the camera may be >> moved up and down independent of the focus point, but the camera is always >> at a distance of 3 from the Y axis. >> >> As soon as the user moves the camera, I reset the camera clipping range >> with ResetCameraClippingRange(). Despite this, when the camera and the >> focal point are far away from eachother, the actors (my stack of cones) get >> clipped by the near plane for some reason. >> >> See the attached screenshot which shows the clipping. >> >> What I'm doing to my camera (in response to Shift+mouse drag in my custom >> interactor) to end up in this situation is just: >> >> camera = renderer.GetActiveCamera() >> (x, y, z) = camera.GetPosition() >> camera.SetPosition(x, y - self.PanningFactor * dy, z) >> renderer.ResetCameraClippingRange() >> >> and I've verified that the camera is always at a distance of 3.0 from the >> Y axis. >> >> The cones I'm using in this test were created with: >> >> for i in range(-10, 20): >> coneSource = vtkConeSource() >> coneSource.SetDirection(0, 1, 0) >> coneSource.SetResolution(8) >> coneSource.SetCenter(0, i, 0) >> >> coneMapper = vtkPolyDataMapper() >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >> >> coneActor = vtkActor() >> coneActor.SetMapper(coneMapper) >> >> widget.renderer.AddActor(coneActor) >> >> I don't understand why I see clipping occur here, since I'm using >> ResetCameraClippingRange, and nothing is behind the camera. The radius of >> these cones is the default (0.5). >> >> It's probably something stupid, but any advice is much appreciated. >> >> Elvis >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 07:37:00 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 13:37:00 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: 2016-06-21 13:35 GMT+02:00 Elvis Stansvik : > 2016-06-21 13:20 GMT+02:00 Elvis Stansvik : > >> I'm attaching the full code for brevity, but the relevant parts are how >> I'm treating the camera in my CylindricalInteractionStyle class and the if >> __name__ == '__main__' block. >> > > To clarify: To see the problem, run the program and use Shift+mouse drag > to move the camera up or down. If you go far enough the cones start to get > clipped at the near plane. > Sorry: You may have to zoom out a bit with Ctrl+mouse drag to see the problem (controls the parallel projection scale). Elvis > > Elvis > > >> Elvis >> >> >> 2016-06-21 13:06 GMT+02:00 Elvis Stansvik : >> >>> Hi all, >>> >>> I have a setup where the camera always moves on a cylinder of radius 3.0 >>> around my subject (just testing with a stack of cones at the moment). The >>> focal point is always positioned along the Y axis, and the camera may be >>> moved up and down independent of the focus point, but the camera is always >>> at a distance of 3 from the Y axis. >>> >>> As soon as the user moves the camera, I reset the camera clipping range >>> with ResetCameraClippingRange(). Despite this, when the camera and the >>> focal point are far away from eachother, the actors (my stack of cones) get >>> clipped by the near plane for some reason. >>> >>> See the attached screenshot which shows the clipping. >>> >>> What I'm doing to my camera (in response to Shift+mouse drag in my >>> custom interactor) to end up in this situation is just: >>> >>> camera = renderer.GetActiveCamera() >>> (x, y, z) = camera.GetPosition() >>> camera.SetPosition(x, y - self.PanningFactor * dy, z) >>> renderer.ResetCameraClippingRange() >>> >>> and I've verified that the camera is always at a distance of 3.0 from >>> the Y axis. >>> >>> The cones I'm using in this test were created with: >>> >>> for i in range(-10, 20): >>> coneSource = vtkConeSource() >>> coneSource.SetDirection(0, 1, 0) >>> coneSource.SetResolution(8) >>> coneSource.SetCenter(0, i, 0) >>> >>> coneMapper = vtkPolyDataMapper() >>> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>> >>> coneActor = vtkActor() >>> coneActor.SetMapper(coneMapper) >>> >>> widget.renderer.AddActor(coneActor) >>> >>> I don't understand why I see clipping occur here, since I'm using >>> ResetCameraClippingRange, and nothing is behind the camera. The radius of >>> these cones is the default (0.5). >>> >>> It's probably something stupid, but any advice is much appreciated. >>> >>> Elvis >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 07:40:52 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 13:40:52 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: 2016-06-21 13:27 GMT+02:00 Elvis Stansvik : > I just found this very old bug: > > http://www.vtk.org/Bug/view.php?id=7823 > > I forgot to mention that I'm using parallell projection for the camera. > Could this be the issue I'm seeing? It seems the suggested patch there was > never incorporated due to test failures (?). Anyone know of some way of > working around this? > It seems someone else also reported the same problem in 2009: http://public.kitware.com/pipermail/vtkusers/2009-April/051510.html Anyone know if this is the same old problem, or if it's something that may have resurfaced? I'm using VTK 7.0.0. Elvis > > Elvis > > 2016-06-21 13:06 GMT+02:00 Elvis Stansvik : > >> Hi all, >> >> I have a setup where the camera always moves on a cylinder of radius 3.0 >> around my subject (just testing with a stack of cones at the moment). The >> focal point is always positioned along the Y axis, and the camera may be >> moved up and down independent of the focus point, but the camera is always >> at a distance of 3 from the Y axis. >> >> As soon as the user moves the camera, I reset the camera clipping range >> with ResetCameraClippingRange(). Despite this, when the camera and the >> focal point are far away from eachother, the actors (my stack of cones) get >> clipped by the near plane for some reason. >> >> See the attached screenshot which shows the clipping. >> >> What I'm doing to my camera (in response to Shift+mouse drag in my custom >> interactor) to end up in this situation is just: >> >> camera = renderer.GetActiveCamera() >> (x, y, z) = camera.GetPosition() >> camera.SetPosition(x, y - self.PanningFactor * dy, z) >> renderer.ResetCameraClippingRange() >> >> and I've verified that the camera is always at a distance of 3.0 from the >> Y axis. >> >> The cones I'm using in this test were created with: >> >> for i in range(-10, 20): >> coneSource = vtkConeSource() >> coneSource.SetDirection(0, 1, 0) >> coneSource.SetResolution(8) >> coneSource.SetCenter(0, i, 0) >> >> coneMapper = vtkPolyDataMapper() >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >> >> coneActor = vtkActor() >> coneActor.SetMapper(coneMapper) >> >> widget.renderer.AddActor(coneActor) >> >> I don't understand why I see clipping occur here, since I'm using >> ResetCameraClippingRange, and nothing is behind the camera. The radius of >> these cones is the default (0.5). >> >> It's probably something stupid, but any advice is much appreciated. >> >> Elvis >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.hirsch at st.ovgu.de Tue Jun 21 07:48:47 2016 From: jan.hirsch at st.ovgu.de (jhirsch) Date: Tue, 21 Jun 2016 04:48:47 -0700 (MST) Subject: [vtkusers] Setting the center of rotation In-Reply-To: References: <4E6E119F.5060400@4raccoons.com> <1316795470.10172.YahooMailNeo@web45710.mail.sp1.yahoo.com> Message-ID: <1466509727622-5738816.post@n5.nabble.com> Great, that worked like a charm! Thanks! :) -- View this message in context: http://vtk.1045678.n5.nabble.com/Setting-the-center-of-rotation-tp4794325p5738816.html Sent from the VTK - Users mailing list archive at Nabble.com. From ben.boeckel at kitware.com Tue Jun 21 09:13:07 2016 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Tue, 21 Jun 2016 09:13:07 -0400 Subject: [vtkusers] VTK bug hackathon In-Reply-To: References: <20160620213606.GA1266@megas.kitware.com> Message-ID: <20160621131307.GA16121@megas.kitware.com> On Mon, Jun 20, 2016 at 16:15:50 -0600, David Gobbi wrote: > I have a strong preference to keep the bugs in Mantis until after the > hackathon. Let's clear as many bugs as possible out of the old system > before switching over to the new. To be clear, the issues are being ported, so any issues we close will still have a presence in GitLab (they'll just be closed right after they're opened). > One thing that mantis has on gitlab is speed. I don't know whether it's my > laptop of the fact that I'm on the other side of the continent, but gitlab > is painfully slow, while mantis (though ugly) is snappy. Yeah, GitLab does have speed issues :( . I don't know where its performance bottlenecks lie, but I think a lot of it comes from rendering files with syntax highlighting and diffs which issues don't have nearly as much of. Could you try playing around on the CMake issue page to see how its performance feels? https://gitlab.kitware.com/cmake/cmake/issues --Ben From david.lonie at kitware.com Tue Jun 21 09:14:06 2016 From: david.lonie at kitware.com (David Lonie) Date: Tue, 21 Jun 2016 09:14:06 -0400 Subject: [vtkusers] memory leak in vtkStructuredPoints or am I doing something wrong? In-Reply-To: <1466490985798-5738805.post@n5.nabble.com> References: <1466490985798-5738805.post@n5.nabble.com> Message-ID: Hi Robert, I took a look at your test case (thanks, btw -- these help a lot!) and while I can reproduce the results, it appears that linux is just caching the memory for the process, not leaking it. I modified your script to do 50 cycles of load/clears, with this result: ./vtkbug Press 1 for zebra, 2 for phallucia 1 Data loaded: 352 MB in use. Data cleared: 248 MB in use. Data loaded: 378 MB in use. Data cleared: 378 MB in use. Data loaded: 352 MB in use. Data cleared: 352 MB in use. Data loaded: 352 MB in use. Data cleared: 352 MB in use. [snipped 45 load/clears] Data loaded: 378 MB in use. Data cleared: 378 MB in use. While the memory is still marked as reserved by the process, it doesn't grow, and the 'leaked' memory is reused by later allocations. I also verified that the dataset destructors are being called at the appropriate times, and valgrind confirms that no memory is leaking at exit. I did a quick google search for clearing linux memory caches, and it appears that it may be possible to instruct linux to drop the cache if this is causing problems, but I suspect the operating system will reclaim cached memory when it starts running out. Unless you start seeing memory allocations fail or excessive swapping, this can likely be ignored. HTH, Dave On Tue, Jun 21, 2016 at 2:36 AM, RobertS wrote: > Hello all, > I'm doing visualization of series of 3D volumes stored in VTK files. First > I > load all vtk files to vector of vtkStructuredPoints using this simple code > inside cycle > > vtkSmartPointer reader = > vtkSmartPointer::New(); > reader->SetFileName(filename); > reader->Update(); > ptsCopy = vtkSmartPointer::New(); > ptsCopy->DeepCopy(reader->GetOutput()); > loadedPoints.push_back(ptsCopy); > reader->CloseVTKFile(); > > then when I want to change the dataset I just call loadedPoints.clear() and > start loading other vtk files. > Now on windows, everything goes as expected, by calling .clear() memory get > freed. This is not the case in linux, here the memory is stil occupied and > since I'm working with very large datasets (>12GB) this is a serious > problem. > Now another interesting thing is, that with some datasets the memory gets > cleared even in linux, but with some others it doesn't... > I'm using VTK 7.0 compiled from source, vs2015 in windows, gcc6.1 in linux > > I made a small project that only loads the vtk files to vector and then > clears it, displaying amount of used memory in between. I can reproduce the > memory leak with this code in linux, in windows it clears the memory. > http://tesla.math.sk/vtkbug.7z > Here you can download two datasets, zebra is causing the leak, phallusia is > not > http://tesla.math.sk/zebra.7z > http://tesla.math.sk/phallusia.7z > > Thanks for any help > > Robert Spir PhD > Department of Mathematics > Slovak University of Technology > Radlinskeho 11 > 813 68 Bratislava > Slovakia > > > > > > -- > View this message in context: > http://vtk.1045678.n5.nabble.com/memory-leak-in-vtkStructuredPoints-or-am-I-doing-something-wrong-tp5738805.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Jun 21 09:44:52 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 21 Jun 2016 07:44:52 -0600 Subject: [vtkusers] VTK bug hackathon In-Reply-To: <20160621131307.GA16121@megas.kitware.com> References: <20160620213606.GA1266@megas.kitware.com> <20160621131307.GA16121@megas.kitware.com> Message-ID: On Tue, Jun 21, 2016 at 7:13 AM, Ben Boeckel wrote: > > > Could you try playing around on the CMake issue page to see how its > performance feels? > > https://gitlab.kitware.com/cmake/cmake/issues The performance for issues isn't as bad as for MRs. The real problem is that issues ported from Mantis have no actual description of the bug, instead they have a link to Mantis. This slows down the workflow. Correct me if I'm wrong, but with the ported issues we would: 1) locate the issue on gitlab, 2) click the provided link to see the bug description on mantis, 3) return to gitlab to modify the status. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 10:02:38 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 16:02:38 +0200 Subject: [vtkusers] Notification after interaction with vtkComposite(TransferFunction|ControlPoints)Item Message-ID: Hi all, I'm using a vtkCompositeTransferFunctionItem + vtkCompositeControlPointsItem in a vtkChartXY to modify the transfer functions used for some volume rendering. Is there some event from one of these items I can observe that will fire once interaction has occurred? I know I can observe the ModifiedEvent of the vtkCompositeTransferFunctionItem, but when dragging points around, it will fire on each mouse move. I need to be notified only once the interaction has stopped. Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From brad.king at kitware.com Tue Jun 21 10:17:14 2016 From: brad.king at kitware.com (Brad King) Date: Tue, 21 Jun 2016 10:17:14 -0400 Subject: [vtkusers] [vtk-developers] VTK bug hackathon In-Reply-To: References: <20160620213606.GA1266@megas.kitware.com> <20160621131307.GA16121@megas.kitware.com> Message-ID: <57694C6A.1050702@kitware.com> On 06/21/2016 09:44 AM, David Gobbi wrote: > The real problem is that issues ported from Mantis have no actual > description of the bug, instead they have a link to Mantis. That was a choice we made for CMake because the Mantis issues are widely cited in the wild so we will keep it up permanently as a reference. Since we're keeping it up anyway we might as well avoid duplication. Also, the Mantis CSV export does not include the descriptions so it will take a bit more work to do the migration with them. For VTK and ParaView we can look at including the descriptions if necessary. > This slows down the workflow. > > Correct me if I'm wrong, but with the ported issues we would: > 1) locate the issue on gitlab, 2) click the provided link to > see the bug description on mantis, 3) return to gitlab to > modify the status. Yes. I was concerned about that at first for CMake but it has been surprisingly easy to work with the dual pages since the migration (e.g. via browser tabs). -Brad From ken.martin at kitware.com Tue Jun 21 10:45:59 2016 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 21 Jun 2016 10:45:59 -0400 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: That image doesn't match what I think you are saying, so maybe you can help me understand. You mention the camera is positioned on a cylinder of radius 3.0 and from your code it looks like the focal point is not changing. If that is true then at some point some of the cones will be behind your camera. For example if your focal point was (0,0,0) and your camera was at (3,10,0) then you would be looking mostly down the y axis and from your code you have a cone positioned at (0,20,0) which would be behind you. Having said all that your image looks funny anyhow. With a parallel projection all the cones should look the exact same aside from clipping but the first cone really looks off from the rest and the others are all identical so something is off. I did look through that code and it looks reasonable to me (the patch referenced is not correct BTW, parallel projection still requires proper z buffer scaling and clipping) If you could provide a few more images from different viewpoints, ideally with the resulting camera clipping range parallel scale position focal point for those images that would help me see what is going on. Thanks Ken On Tue, Jun 21, 2016 at 7:06 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > Hi all, > > I have a setup where the camera always moves on a cylinder of radius 3.0 > around my subject (just testing with a stack of cones at the moment). The > focal point is always positioned along the Y axis, and the camera may be > moved up and down independent of the focus point, but the camera is always > at a distance of 3 from the Y axis. > > As soon as the user moves the camera, I reset the camera clipping range > with ResetCameraClippingRange(). Despite this, when the camera and the > focal point are far away from eachother, the actors (my stack of cones) get > clipped by the near plane for some reason. > > See the attached screenshot which shows the clipping. > > What I'm doing to my camera (in response to Shift+mouse drag in my custom > interactor) to end up in this situation is just: > > camera = renderer.GetActiveCamera() > (x, y, z) = camera.GetPosition() > camera.SetPosition(x, y - self.PanningFactor * dy, z) > renderer.ResetCameraClippingRange() > > and I've verified that the camera is always at a distance of 3.0 from the > Y axis. > > The cones I'm using in this test were created with: > > for i in range(-10, 20): > coneSource = vtkConeSource() > coneSource.SetDirection(0, 1, 0) > coneSource.SetResolution(8) > coneSource.SetCenter(0, i, 0) > > coneMapper = vtkPolyDataMapper() > coneMapper.SetInputConnection(coneSource.GetOutputPort()) > > coneActor = vtkActor() > coneActor.SetMapper(coneMapper) > > widget.renderer.AddActor(coneActor) > > I don't understand why I see clipping occur here, since I'm using > ResetCameraClippingRange, and nothing is behind the camera. The radius of > these cones is the default (0.5). > > It's probably something stupid, but any advice is much appreciated. > > Elvis > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From berk.geveci at kitware.com Tue Jun 21 10:54:13 2016 From: berk.geveci at kitware.com (Berk Geveci) Date: Tue, 21 Jun 2016 10:54:13 -0400 Subject: [vtkusers] [vtk-developers] VTK bug hackathon In-Reply-To: <57694C6A.1050702@kitware.com> References: <20160620213606.GA1266@megas.kitware.com> <20160621131307.GA16121@megas.kitware.com> <57694C6A.1050702@kitware.com> Message-ID: Brad reminded me that Mantis no longer allow new account registration (due to spam issues) so that may be a potential issue with using it. We can still make it work though; many of us have accounts anyway. I am fine with what others decide. I just didn't want to put undue pressure on Brad & Ben to make the transition quickly. On Tue, Jun 21, 2016 at 10:17 AM, Brad King wrote: > On 06/21/2016 09:44 AM, David Gobbi wrote: > > The real problem is that issues ported from Mantis have no actual > > description of the bug, instead they have a link to Mantis. > > That was a choice we made for CMake because the Mantis issues are > widely cited in the wild so we will keep it up permanently as a > reference. Since we're keeping it up anyway we might as well avoid > duplication. Also, the Mantis CSV export does not include the > descriptions so it will take a bit more work to do the migration > with them. > > For VTK and ParaView we can look at including the descriptions > if necessary. > > > This slows down the workflow. > > > > Correct me if I'm wrong, but with the ported issues we would: > > 1) locate the issue on gitlab, 2) click the provided link to > > see the bug description on mantis, 3) return to gitlab to > > modify the status. > > Yes. I was concerned about that at first for CMake but it has > been surprisingly easy to work with the dual pages since the > migration (e.g. via browser tabs). > > -Brad > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.demarle at kitware.com Tue Jun 21 11:39:22 2016 From: dave.demarle at kitware.com (David E DeMarle) Date: Tue, 21 Jun 2016 17:39:22 +0200 Subject: [vtkusers] [vtk-developers] VTK bug hackathon In-Reply-To: References: <20160620213606.GA1266@megas.kitware.com> <20160621131307.GA16121@megas.kitware.com> <57694C6A.1050702@kitware.com> Message-ID: I'd like to add review of merge requests to the agenda. On Jun 21, 2016 4:54 PM, "Berk Geveci" wrote: > Brad reminded me that Mantis no longer allow new account registration (due > to spam issues) so that may be a potential issue with using it. We can > still make it work though; many of us have accounts anyway. I am fine with > what others decide. I just didn't want to put undue pressure on Brad & Ben > to make the transition quickly. > > On Tue, Jun 21, 2016 at 10:17 AM, Brad King wrote: > >> On 06/21/2016 09:44 AM, David Gobbi wrote: >> > The real problem is that issues ported from Mantis have no actual >> > description of the bug, instead they have a link to Mantis. >> >> That was a choice we made for CMake because the Mantis issues are >> widely cited in the wild so we will keep it up permanently as a >> reference. Since we're keeping it up anyway we might as well avoid >> duplication. Also, the Mantis CSV export does not include the >> descriptions so it will take a bit more work to do the migration >> with them. >> >> For VTK and ParaView we can look at including the descriptions >> if necessary. >> >> > This slows down the workflow. >> > >> > Correct me if I'm wrong, but with the ported issues we would: >> > 1) locate the issue on gitlab, 2) click the provided link to >> > see the bug description on mantis, 3) return to gitlab to >> > modify the status. >> >> Yes. I was concerned about that at first for CMake but it has >> been surprisingly easy to work with the dual pages since the >> migration (e.g. via browser tabs). >> >> -Brad >> >> > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 11:44:56 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 17:44:56 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: Den 21 juni 2016 4:45 em skrev "Ken Martin" : > > That image doesn't match what I think you are saying, so maybe you can help me understand. You mention the camera is positioned on a cylinder of radius 3.0 and from your code it looks like the focal point is not changing. > > If that is true then at some point some of the cones will be behind your camera. For example if your focal point was (0,0,0) and your camera was at (3,10,0) then you would be looking mostly down the y axis and from your code you have a cone positioned at (0,20,0) which would be behind you. > > Having said all that your image looks funny anyhow. With a parallel projection all the cones should look the exact same aside from clipping but the first cone really looks off from the rest and the others are all identical so something is off. > > I did look through that code and it looks reasonable to me (the patch referenced is not correct BTW, parallel projection still requires proper z buffer scaling and clipping) If you could provide a few more images from different viewpoints, ideally with the resulting camera > > clipping range > parallel scale > position > focal point > > for those images that would help me see what is going on. Thanks a lot for taking the time Ken. You're right of course about cones being behind me. I think what I meant was I'm never inside a cone. I'll try to make a minimal test case when I get home, as I'm on the bus and only have my phone right now. Elvis > > Thanks > Ken > > > > > > On Tue, Jun 21, 2016 at 7:06 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: >> >> Hi all, >> >> I have a setup where the camera always moves on a cylinder of radius 3.0 around my subject (just testing with a stack of cones at the moment). The focal point is always positioned along the Y axis, and the camera may be moved up and down independent of the focus point, but the camera is always at a distance of 3 from the Y axis. >> >> As soon as the user moves the camera, I reset the camera clipping range with ResetCameraClippingRange(). Despite this, when the camera and the focal point are far away from eachother, the actors (my stack of cones) get clipped by the near plane for some reason. >> >> See the attached screenshot which shows the clipping. >> >> What I'm doing to my camera (in response to Shift+mouse drag in my custom interactor) to end up in this situation is just: >> >> camera = renderer.GetActiveCamera() >> (x, y, z) = camera.GetPosition() >> camera.SetPosition(x, y - self.PanningFactor * dy, z) >> renderer.ResetCameraClippingRange() >> >> and I've verified that the camera is always at a distance of 3.0 from the Y axis. >> >> The cones I'm using in this test were created with: >> >> for i in range(-10, 20): >> coneSource = vtkConeSource() >> coneSource.SetDirection(0, 1, 0) >> coneSource.SetResolution(8) >> coneSource.SetCenter(0, i, 0) >> >> coneMapper = vtkPolyDataMapper() >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >> >> coneActor = vtkActor() >> coneActor.SetMapper(coneMapper) >> >> widget.renderer.AddActor(coneActor) >> >> I don't understand why I see clipping occur here, since I'm using ResetCameraClippingRange, and nothing is behind the camera. The radius of these cones is the default (0.5). >> >> It's probably something stupid, but any advice is much appreciated. >> >> Elvis >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> > > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 11:51:34 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 17:51:34 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: Den 21 juni 2016 4:45 em skrev "Ken Martin" : > > That image doesn't match what I think you are saying, so maybe you can help me understand. You mention the camera is positioned on a cylinder of radius 3.0 and from your code it looks like the focal point is not changing. > > If that is true then at some point some of the cones will be behind your camera. For example if your focal point was (0,0,0) and your camera was at (3,10,0) then you would be looking mostly down the y axis and from your code you have a cone positioned at (0,20,0) which would be behind you. > > Having said all that your image looks funny anyhow. With a parallel projection all the cones should look the exact same aside from clipping but the first cone really looks off from the rest and the others are all identical so something is off. If by the first cone you mean the one at the bottom of the shot I sent, the one closest to the camera, then it's exactly that which I identify as clipping taking place. The clipping makes you see up into the tip of the cone I think, which is what makes it look funny. But I'll look closer and get you that test case once I'm home. Elvis > > I did look through that code and it looks reasonable to me (the patch referenced is not correct BTW, parallel projection still requires proper z buffer scaling and clipping) If you could provide a few more images from different viewpoints, ideally with the resulting camera > > clipping range > parallel scale > position > focal point > > for those images that would help me see what is going on. > > Thanks > Ken > > > > > > On Tue, Jun 21, 2016 at 7:06 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: >> >> Hi all, >> >> I have a setup where the camera always moves on a cylinder of radius 3.0 around my subject (just testing with a stack of cones at the moment). The focal point is always positioned along the Y axis, and the camera may be moved up and down independent of the focus point, but the camera is always at a distance of 3 from the Y axis. >> >> As soon as the user moves the camera, I reset the camera clipping range with ResetCameraClippingRange(). Despite this, when the camera and the focal point are far away from eachother, the actors (my stack of cones) get clipped by the near plane for some reason. >> >> See the attached screenshot which shows the clipping. >> >> What I'm doing to my camera (in response to Shift+mouse drag in my custom interactor) to end up in this situation is just: >> >> camera = renderer.GetActiveCamera() >> (x, y, z) = camera.GetPosition() >> camera.SetPosition(x, y - self.PanningFactor * dy, z) >> renderer.ResetCameraClippingRange() >> >> and I've verified that the camera is always at a distance of 3.0 from the Y axis. >> >> The cones I'm using in this test were created with: >> >> for i in range(-10, 20): >> coneSource = vtkConeSource() >> coneSource.SetDirection(0, 1, 0) >> coneSource.SetResolution(8) >> coneSource.SetCenter(0, i, 0) >> >> coneMapper = vtkPolyDataMapper() >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >> >> coneActor = vtkActor() >> coneActor.SetMapper(coneMapper) >> >> widget.renderer.AddActor(coneActor) >> >> I don't understand why I see clipping occur here, since I'm using ResetCameraClippingRange, and nothing is behind the camera. The radius of these cones is the default (0.5). >> >> It's probably something stupid, but any advice is much appreciated. >> >> Elvis >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> > > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 12:25:14 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 18:25:14 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: 2016-06-21 17:44 GMT+02:00 Elvis Stansvik : > Den 21 juni 2016 4:45 em skrev "Ken Martin" : > > > > That image doesn't match what I think you are saying, so maybe you can > help me understand. You mention the camera is positioned on a cylinder of > radius 3.0 and from your code it looks like the focal point is not changing. > > > > If that is true then at some point some of the cones will be behind your > camera. For example if your focal point was (0,0,0) and your camera was at > (3,10,0) then you would be looking mostly down the y axis and from your > code you have a cone positioned at (0,20,0) which would be behind you. > > > > Having said all that your image looks funny anyhow. With a parallel > projection all the cones should look the exact same aside from clipping but > the first cone really looks off from the rest and the others are all > identical so something is off. > > > > I did look through that code and it looks reasonable to me (the patch > referenced is not correct BTW, parallel projection still requires proper z > buffer scaling and clipping) If you could provide a few more images from > different viewpoints, ideally with the resulting camera > > > > clipping range > > parallel scale > > position > > focal point > > > > for those images that would help me see what is going on. > > Thanks a lot for taking the time Ken. You're right of course about cones > being behind me. I think what I meant was I'm never inside a cone. > > I'll try to make a minimal test case when I get home, as I'm on the bus > and only have my phone right now. > Here's a minimal test case where the camera is positioned to look "down" on the stack of cones, the stack is cut off due to clipping (see attached .png): from vtk import vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor from vtk import vtkConeSource, vtkActor, vtkPolyDataMapper renderer = vtkRenderer() renderWindow = vtkRenderWindow() renderWindow.SetSize(500, 1000) renderWindow.AddRenderer(renderer) interactor = vtkRenderWindowInteractor() interactor.SetRenderWindow(renderWindow) # Create a stack of 40 cones along the Y axis for i in range(-20, 20): coneSource = vtkConeSource() coneSource.SetDirection(0, 1, 0) coneSource.SetResolution(8) coneSource.SetCenter(0, i, 0) coneMapper = vtkPolyDataMapper() coneMapper.SetInputConnection(coneSource.GetOutputPort()) coneActor = vtkActor() coneActor.SetMapper(coneMapper) renderer.AddActor(coneActor) # Position camera at (3.0, 10.0, 0), looking "down" along the stack camera = renderer.GetActiveCamera() camera.SetParallelProjection(True) camera.SetPosition(3.0, 10.0, 0.0) camera.SetFocalPoint(0.0, 0.0, 0.0) camera.SetParallelScale(5.0) # Reset camera clipping range renderer.ResetCameraClippingRange() # Print some camera info print(camera) interactor.Start() But I'm beginning to think this is maybe just a misunderstanding on my part. Perhaps this clipping is inevitable and expected when using parallel projection? Thanks in advance, Elvis Elvis > > > > > Thanks > > Ken > > > > > > > > > > > > On Tue, Jun 21, 2016 at 7:06 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> > >> Hi all, > >> > >> I have a setup where the camera always moves on a cylinder of radius > 3.0 around my subject (just testing with a stack of cones at the moment). > The focal point is always positioned along the Y axis, and the camera may > be moved up and down independent of the focus point, but the camera is > always at a distance of 3 from the Y axis. > >> > >> As soon as the user moves the camera, I reset the camera clipping range > with ResetCameraClippingRange(). Despite this, when the camera and the > focal point are far away from eachother, the actors (my stack of cones) get > clipped by the near plane for some reason. > >> > >> See the attached screenshot which shows the clipping. > >> > >> What I'm doing to my camera (in response to Shift+mouse drag in my > custom interactor) to end up in this situation is just: > >> > >> camera = renderer.GetActiveCamera() > >> (x, y, z) = camera.GetPosition() > >> camera.SetPosition(x, y - self.PanningFactor * dy, z) > >> renderer.ResetCameraClippingRange() > >> > >> and I've verified that the camera is always at a distance of 3.0 from > the Y axis. > >> > >> The cones I'm using in this test were created with: > >> > >> for i in range(-10, 20): > >> coneSource = vtkConeSource() > >> coneSource.SetDirection(0, 1, 0) > >> coneSource.SetResolution(8) > >> coneSource.SetCenter(0, i, 0) > >> > >> coneMapper = vtkPolyDataMapper() > >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) > >> > >> coneActor = vtkActor() > >> coneActor.SetMapper(coneMapper) > >> > >> widget.renderer.AddActor(coneActor) > >> > >> I don't understand why I see clipping occur here, since I'm using > ResetCameraClippingRange, and nothing is behind the camera. The radius of > these cones is the default (0.5). > >> > >> It's probably something stupid, but any advice is much appreciated. > >> > >> Elvis > >> > >> _______________________________________________ > >> 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 > >> > >> Search the list archives at: http://markmail.org/search/?q=vtkusers > >> > >> Follow this link to subscribe/unsubscribe: > >> http://public.kitware.com/mailman/listinfo/vtkusers > >> > > > > > > > > -- > > Ken Martin PhD > > Chairman & CFO > > Kitware Inc. > > 28 Corporate Drive > > Clifton Park NY 12065 > > 518 371 3971 > > > > This communication, including all attachments, contains confidential and > legally privileged information, and it is intended only for the use of the > addressee. Access to this email by anyone else is unauthorized. If you are > not the intended recipient, any disclosure, copying, distribution or any > action taken in reliance on it is prohibited and may be unlawful. If you > received this communication in error please notify us immediately and > destroy the original message. Thank you. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testcase.py Type: text/x-python Size: 1115 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testcase.png Type: image/png Size: 29533 bytes Desc: not available URL: From elvis.stansvik at orexplore.com Tue Jun 21 12:27:22 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 18:27:22 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: 2016-06-21 18:25 GMT+02:00 Elvis Stansvik : > 2016-06-21 17:44 GMT+02:00 Elvis Stansvik : > >> Den 21 juni 2016 4:45 em skrev "Ken Martin" : >> > >> > That image doesn't match what I think you are saying, so maybe you can >> help me understand. You mention the camera is positioned on a cylinder of >> radius 3.0 and from your code it looks like the focal point is not changing. >> > >> > If that is true then at some point some of the cones will be behind >> your camera. For example if your focal point was (0,0,0) and your camera >> was at (3,10,0) then you would be looking mostly down the y axis and from >> your code you have a cone positioned at (0,20,0) which would be behind you. >> > >> > Having said all that your image looks funny anyhow. With a parallel >> projection all the cones should look the exact same aside from clipping but >> the first cone really looks off from the rest and the others are all >> identical so something is off. >> > >> > I did look through that code and it looks reasonable to me (the patch >> referenced is not correct BTW, parallel projection still requires proper z >> buffer scaling and clipping) If you could provide a few more images from >> different viewpoints, ideally with the resulting camera >> > >> > clipping range >> > parallel scale >> > position >> > focal point >> > >> > for those images that would help me see what is going on. >> >> Thanks a lot for taking the time Ken. You're right of course about cones >> being behind me. I think what I meant was I'm never inside a cone. >> >> I'll try to make a minimal test case when I get home, as I'm on the bus >> and only have my phone right now. >> > Here's a minimal test case where the camera is positioned to look "down" > on the stack of cones, the stack is cut off due to clipping (see attached > .png): > > from vtk import vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor > from vtk import vtkConeSource, vtkActor, vtkPolyDataMapper > > renderer = vtkRenderer() > renderWindow = vtkRenderWindow() > renderWindow.SetSize(500, 1000) > renderWindow.AddRenderer(renderer) > > interactor = vtkRenderWindowInteractor() > interactor.SetRenderWindow(renderWindow) > > # Create a stack of 40 cones along the Y axis > for i in range(-20, 20): > coneSource = vtkConeSource() > coneSource.SetDirection(0, 1, 0) > coneSource.SetResolution(8) > coneSource.SetCenter(0, i, 0) > > coneMapper = vtkPolyDataMapper() > coneMapper.SetInputConnection(coneSource.GetOutputPort()) > > coneActor = vtkActor() > coneActor.SetMapper(coneMapper) > > renderer.AddActor(coneActor) > > # Position camera at (3.0, 10.0, 0), looking "down" along the stack > camera = renderer.GetActiveCamera() > camera.SetParallelProjection(True) > camera.SetPosition(3.0, 10.0, 0.0) > camera.SetFocalPoint(0.0, 0.0, 0.0) > camera.SetParallelScale(5.0) > > # Reset camera clipping range > renderer.ResetCameraClippingRange() > > # Print some camera info > print(camera) > > interactor.Start() > Forgot to include the output from the test (the printing of the camera): vtkOpenGLCamera (0x2130810) Debug: Off Modified Time: 17946 Reference Count: 2 Registered Events: (none) ClippingRange: (0.0531862, 53.1862) DirectionOfProjection: (-0.287348, -0.957826, 0) Distance: 10.4403 EyeAngle: 2 FocalDisk: 1 FocalPoint: (0, 0, 0) ViewShear: (0, 0, 1) ParallelProjection: On ParallelScale: 5 Position: (3, 10, 0) Stereo: Off Left Eye: 1 Thickness: 53.133 ViewAngle: 30 UseHorizontalViewAngle: 0 UserTransform: (none) (none) FreezeFocalPoint: (none) ViewPlaneNormal: (0.287348, 0.957826, -0) ViewUp: (0, 1, 0) WindowCenter: (0, 0) UseOffAxisProjection: (0) ScreenBottomLeft: (-0.5, -0.5, -0.5) ScreenBottomRight: (0.5, -0.5, -0.5) ScreenTopRight: (0.5, 0.5, -0.5) EyeSeparation: (0.06) WorldToScreenMatrix: (0x2130a50 Debug: Off Modified Time: 12739 Reference Count: 1 Registered Events: (none) Elements: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ) EyeTransformMatrix: (0x2130b40 Debug: Off Modified Time: 12741 Reference Count: 1 Registered Events: (none) Elements: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ) ModelTransformMatrix: (0x2130c30 Debug: Off Modified Time: 12743 Reference Count: 1 Registered Events: (none) Elements: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ) ProjectionTransform: (0x2131170 Debug: Off Modified Time: 12748 Reference Count: 1 Registered Events: (none) Inverse: (0) Matrix: (0x21312a0) Debug: Off Modified Time: 17947 Reference Count: 1 Registered Events: (none) Elements: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Input: (0) InverseFlag: 0 NumberOfConcatenatedTransforms: 0 ) Elvis > > But I'm beginning to think this is maybe just a misunderstanding on my > part. Perhaps this clipping is inevitable and expected when using parallel > projection? > > Thanks in advance, > Elvis > > Elvis >> >> > >> > Thanks >> > Ken >> > >> > >> > >> > >> > >> > On Tue, Jun 21, 2016 at 7:06 AM, Elvis Stansvik < >> elvis.stansvik at orexplore.com> wrote: >> >> >> >> Hi all, >> >> >> >> I have a setup where the camera always moves on a cylinder of radius >> 3.0 around my subject (just testing with a stack of cones at the moment). >> The focal point is always positioned along the Y axis, and the camera may >> be moved up and down independent of the focus point, but the camera is >> always at a distance of 3 from the Y axis. >> >> >> >> As soon as the user moves the camera, I reset the camera clipping >> range with ResetCameraClippingRange(). Despite this, when the camera and >> the focal point are far away from eachother, the actors (my stack of cones) >> get clipped by the near plane for some reason. >> >> >> >> See the attached screenshot which shows the clipping. >> >> >> >> What I'm doing to my camera (in response to Shift+mouse drag in my >> custom interactor) to end up in this situation is just: >> >> >> >> camera = renderer.GetActiveCamera() >> >> (x, y, z) = camera.GetPosition() >> >> camera.SetPosition(x, y - self.PanningFactor * dy, z) >> >> renderer.ResetCameraClippingRange() >> >> >> >> and I've verified that the camera is always at a distance of 3.0 from >> the Y axis. >> >> >> >> The cones I'm using in this test were created with: >> >> >> >> for i in range(-10, 20): >> >> coneSource = vtkConeSource() >> >> coneSource.SetDirection(0, 1, 0) >> >> coneSource.SetResolution(8) >> >> coneSource.SetCenter(0, i, 0) >> >> >> >> coneMapper = vtkPolyDataMapper() >> >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >> >> >> >> coneActor = vtkActor() >> >> coneActor.SetMapper(coneMapper) >> >> >> >> widget.renderer.AddActor(coneActor) >> >> >> >> I don't understand why I see clipping occur here, since I'm using >> ResetCameraClippingRange, and nothing is behind the camera. The radius of >> these cones is the default (0.5). >> >> >> >> It's probably something stupid, but any advice is much appreciated. >> >> >> >> Elvis >> >> >> >> _______________________________________________ >> >> 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 >> >> >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> >> >> Follow this link to subscribe/unsubscribe: >> >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> >> > >> > >> > >> > -- >> > Ken Martin PhD >> > Chairman & CFO >> > Kitware Inc. >> > 28 Corporate Drive >> > Clifton Park NY 12065 >> > 518 371 3971 >> > >> > This communication, including all attachments, contains confidential >> and legally privileged information, and it is intended only for the use of >> the addressee. Access to this email by anyone else is unauthorized. If you >> are not the intended recipient, any disclosure, copying, distribution or >> any action taken in reliance on it is prohibited and may be unlawful. If >> you received this communication in error please notify us immediately and >> destroy the original message. Thank you. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Tue Jun 21 13:33:14 2016 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 21 Jun 2016 13:33:14 -0400 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: Thanks for the example. From what I can see everything is working correctly. To be more specific, in your example your position is 3, 10, 0 and your direction of projection is -0.29 -0.96, 0 so z distance will be (conepos - cam_pos) dot DOP taking the cone at 0, 20, 0 for example would give -3, 10, 0 dot -0.3 -0.96 0 which is about 1.0 - 9.6 or -8.6 which is far behind the camera. Parallel projection is tricky because without the perspective clues it can be hard to judge how close items are to you. If you want to avoid this issue just move your camera farther back. With parallel projection, the camera being farther back is not a problem as the size of the cones will not change. If I change your example from camera.SetPosition(3.0, 10.0, 0.0) to camera.SetPosition(30.0, 100.0, 0.0) everything looks fine as the camera is far enough away that the stack of cones never moves behind it and yet the direction of projection and parallel scale are unchanged. Hope that helps. Thanks Ken On Tue, Jun 21, 2016 at 12:27 PM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > 2016-06-21 18:25 GMT+02:00 Elvis Stansvik : > >> 2016-06-21 17:44 GMT+02:00 Elvis Stansvik : >> >>> Den 21 juni 2016 4:45 em skrev "Ken Martin" : >>> > >>> > That image doesn't match what I think you are saying, so maybe you can >>> help me understand. You mention the camera is positioned on a cylinder of >>> radius 3.0 and from your code it looks like the focal point is not changing. >>> > >>> > If that is true then at some point some of the cones will be behind >>> your camera. For example if your focal point was (0,0,0) and your camera >>> was at (3,10,0) then you would be looking mostly down the y axis and from >>> your code you have a cone positioned at (0,20,0) which would be behind you. >>> > >>> > Having said all that your image looks funny anyhow. With a parallel >>> projection all the cones should look the exact same aside from clipping but >>> the first cone really looks off from the rest and the others are all >>> identical so something is off. >>> > >>> > I did look through that code and it looks reasonable to me (the patch >>> referenced is not correct BTW, parallel projection still requires proper z >>> buffer scaling and clipping) If you could provide a few more images from >>> different viewpoints, ideally with the resulting camera >>> > >>> > clipping range >>> > parallel scale >>> > position >>> > focal point >>> > >>> > for those images that would help me see what is going on. >>> >>> Thanks a lot for taking the time Ken. You're right of course about cones >>> being behind me. I think what I meant was I'm never inside a cone. >>> >>> I'll try to make a minimal test case when I get home, as I'm on the bus >>> and only have my phone right now. >>> >> Here's a minimal test case where the camera is positioned to look "down" >> on the stack of cones, the stack is cut off due to clipping (see attached >> .png): >> >> from vtk import vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor >> from vtk import vtkConeSource, vtkActor, vtkPolyDataMapper >> >> renderer = vtkRenderer() >> renderWindow = vtkRenderWindow() >> renderWindow.SetSize(500, 1000) >> renderWindow.AddRenderer(renderer) >> >> interactor = vtkRenderWindowInteractor() >> interactor.SetRenderWindow(renderWindow) >> >> # Create a stack of 40 cones along the Y axis >> for i in range(-20, 20): >> coneSource = vtkConeSource() >> coneSource.SetDirection(0, 1, 0) >> coneSource.SetResolution(8) >> coneSource.SetCenter(0, i, 0) >> >> coneMapper = vtkPolyDataMapper() >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >> >> coneActor = vtkActor() >> coneActor.SetMapper(coneMapper) >> >> renderer.AddActor(coneActor) >> >> # Position camera at (3.0, 10.0, 0), looking "down" along the stack >> camera = renderer.GetActiveCamera() >> camera.SetParallelProjection(True) >> camera.SetPosition(3.0, 10.0, 0.0) >> camera.SetFocalPoint(0.0, 0.0, 0.0) >> camera.SetParallelScale(5.0) >> >> # Reset camera clipping range >> renderer.ResetCameraClippingRange() >> >> # Print some camera info >> print(camera) >> >> interactor.Start() >> > > Forgot to include the output from the test (the printing of the camera): > > vtkOpenGLCamera (0x2130810) > Debug: Off > Modified Time: 17946 > Reference Count: 2 > Registered Events: (none) > ClippingRange: (0.0531862, 53.1862) > DirectionOfProjection: (-0.287348, -0.957826, 0) > Distance: 10.4403 > EyeAngle: 2 > FocalDisk: 1 > FocalPoint: (0, 0, 0) > ViewShear: (0, 0, 1) > ParallelProjection: On > ParallelScale: 5 > Position: (3, 10, 0) > Stereo: Off > Left Eye: 1 > Thickness: 53.133 > ViewAngle: 30 > UseHorizontalViewAngle: 0 > UserTransform: (none) > (none) > FreezeFocalPoint: (none) > ViewPlaneNormal: (0.287348, 0.957826, -0) > ViewUp: (0, 1, 0) > WindowCenter: (0, 0) > UseOffAxisProjection: (0) > ScreenBottomLeft: (-0.5, -0.5, -0.5) > ScreenBottomRight: (0.5, -0.5, -0.5) > ScreenTopRight: (0.5, 0.5, -0.5) > EyeSeparation: (0.06) > WorldToScreenMatrix: (0x2130a50 > Debug: Off > Modified Time: 12739 > Reference Count: 1 > Registered Events: (none) > Elements: > 1 0 0 0 > 0 1 0 0 > 0 0 1 0 > 0 0 0 1 > ) > EyeTransformMatrix: (0x2130b40 > Debug: Off > Modified Time: 12741 > Reference Count: 1 > Registered Events: (none) > Elements: > 1 0 0 0 > 0 1 0 0 > 0 0 1 0 > 0 0 0 1 > ) > ModelTransformMatrix: (0x2130c30 > Debug: Off > Modified Time: 12743 > Reference Count: 1 > Registered Events: (none) > Elements: > 1 0 0 0 > 0 1 0 0 > 0 0 1 0 > 0 0 0 1 > ) > ProjectionTransform: (0x2131170 > Debug: Off > Modified Time: 12748 > Reference Count: 1 > Registered Events: (none) > Inverse: (0) > Matrix: (0x21312a0) > Debug: Off > Modified Time: 17947 > Reference Count: 1 > Registered Events: (none) > Elements: > 1 0 0 0 > 0 1 0 0 > 0 0 1 0 > 0 0 0 1 > Input: (0) > InverseFlag: 0 > NumberOfConcatenatedTransforms: 0 > ) > > Elvis > > >> >> But I'm beginning to think this is maybe just a misunderstanding on my >> part. Perhaps this clipping is inevitable and expected when using parallel >> projection? >> >> Thanks in advance, >> Elvis >> >> Elvis >>> >>> > >>> > Thanks >>> > Ken >>> > >>> > >>> > >>> > >>> > >>> > On Tue, Jun 21, 2016 at 7:06 AM, Elvis Stansvik < >>> elvis.stansvik at orexplore.com> wrote: >>> >> >>> >> Hi all, >>> >> >>> >> I have a setup where the camera always moves on a cylinder of radius >>> 3.0 around my subject (just testing with a stack of cones at the moment). >>> The focal point is always positioned along the Y axis, and the camera may >>> be moved up and down independent of the focus point, but the camera is >>> always at a distance of 3 from the Y axis. >>> >> >>> >> As soon as the user moves the camera, I reset the camera clipping >>> range with ResetCameraClippingRange(). Despite this, when the camera and >>> the focal point are far away from eachother, the actors (my stack of cones) >>> get clipped by the near plane for some reason. >>> >> >>> >> See the attached screenshot which shows the clipping. >>> >> >>> >> What I'm doing to my camera (in response to Shift+mouse drag in my >>> custom interactor) to end up in this situation is just: >>> >> >>> >> camera = renderer.GetActiveCamera() >>> >> (x, y, z) = camera.GetPosition() >>> >> camera.SetPosition(x, y - self.PanningFactor * dy, z) >>> >> renderer.ResetCameraClippingRange() >>> >> >>> >> and I've verified that the camera is always at a distance of 3.0 from >>> the Y axis. >>> >> >>> >> The cones I'm using in this test were created with: >>> >> >>> >> for i in range(-10, 20): >>> >> coneSource = vtkConeSource() >>> >> coneSource.SetDirection(0, 1, 0) >>> >> coneSource.SetResolution(8) >>> >> coneSource.SetCenter(0, i, 0) >>> >> >>> >> coneMapper = vtkPolyDataMapper() >>> >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>> >> >>> >> coneActor = vtkActor() >>> >> coneActor.SetMapper(coneMapper) >>> >> >>> >> widget.renderer.AddActor(coneActor) >>> >> >>> >> I don't understand why I see clipping occur here, since I'm using >>> ResetCameraClippingRange, and nothing is behind the camera. The radius of >>> these cones is the default (0.5). >>> >> >>> >> It's probably something stupid, but any advice is much appreciated. >>> >> >>> >> Elvis >>> >> >>> >> _______________________________________________ >>> >> 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 >>> >> >>> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >> >>> >> Follow this link to subscribe/unsubscribe: >>> >> http://public.kitware.com/mailman/listinfo/vtkusers >>> >> >>> > >>> > >>> > >>> > -- >>> > Ken Martin PhD >>> > Chairman & CFO >>> > Kitware Inc. >>> > 28 Corporate Drive >>> > Clifton Park NY 12065 >>> > 518 371 3971 >>> > >>> > This communication, including all attachments, contains confidential >>> and legally privileged information, and it is intended only for the use of >>> the addressee. Access to this email by anyone else is unauthorized. If you >>> are not the intended recipient, any disclosure, copying, distribution or >>> any action taken in reliance on it is prohibited and may be unlawful. If >>> you received this communication in error please notify us immediately and >>> destroy the original message. Thank you. >>> >> >> > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 21 14:00:32 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 Jun 2016 20:00:32 +0200 Subject: [vtkusers] Actors in front of camera clipped despite ResetCameraClippingRange() In-Reply-To: References: Message-ID: 2016-06-21 19:33 GMT+02:00 Ken Martin : > Thanks for the example. From what I can see everything is working > correctly. To be more specific, in your example your position is > > 3, 10, 0 > > and your direction of projection is > > -0.29 -0.96, 0 > > so z distance will be (conepos - cam_pos) dot DOP > > taking the cone at 0, 20, 0 for example would give > > -3, 10, 0 dot -0.3 -0.96 0 which is about 1.0 - 9.6 or -8.6 which is far > behind the camera. Parallel projection is tricky because without the > perspective clues it can be hard to judge how close items are to you. > > If you want to avoid this issue just move your camera farther back. With > parallel projection, the camera being farther back is not a problem as the > size of the cones will not change. If I change your example from > > camera.SetPosition(3.0, 10.0, 0.0) > > to > > camera.SetPosition(30.0, 100.0, 0.0) > > everything looks fine as the camera is far enough away that the stack of > cones never moves behind it and yet the direction of projection and > parallel scale are unchanged. Hope that helps. > Thanks a lot for the detailed explanation. It makes perfect sense now. I'll have to be careful then and take the size of my subjects into account when placing the camera. The reason I picked such a short distance was that I started out using a quite small factor when multiplying the dy of the mouse movement when moving the camera up and down in my interactor style, and then it was necessary to place the camera quite close to get a good reaction when looking up and down. I'll just have to do things in the right order: First determine an appropriate distance for the camera from the subject (to avoid any clipping), then based on that distance, determine a factor that "feels" good. Elvis > Thanks > Ken > > > > > > > On Tue, Jun 21, 2016 at 12:27 PM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> 2016-06-21 18:25 GMT+02:00 Elvis Stansvik : >> >>> 2016-06-21 17:44 GMT+02:00 Elvis Stansvik >>> : >>> >>>> Den 21 juni 2016 4:45 em skrev "Ken Martin" : >>>> > >>>> > That image doesn't match what I think you are saying, so maybe you >>>> can help me understand. You mention the camera is positioned on a cylinder >>>> of radius 3.0 and from your code it looks like the focal point is not >>>> changing. >>>> > >>>> > If that is true then at some point some of the cones will be behind >>>> your camera. For example if your focal point was (0,0,0) and your camera >>>> was at (3,10,0) then you would be looking mostly down the y axis and from >>>> your code you have a cone positioned at (0,20,0) which would be behind you. >>>> > >>>> > Having said all that your image looks funny anyhow. With a parallel >>>> projection all the cones should look the exact same aside from clipping but >>>> the first cone really looks off from the rest and the others are all >>>> identical so something is off. >>>> > >>>> > I did look through that code and it looks reasonable to me (the patch >>>> referenced is not correct BTW, parallel projection still requires proper z >>>> buffer scaling and clipping) If you could provide a few more images from >>>> different viewpoints, ideally with the resulting camera >>>> > >>>> > clipping range >>>> > parallel scale >>>> > position >>>> > focal point >>>> > >>>> > for those images that would help me see what is going on. >>>> >>>> Thanks a lot for taking the time Ken. You're right of course about >>>> cones being behind me. I think what I meant was I'm never inside a cone. >>>> >>>> I'll try to make a minimal test case when I get home, as I'm on the bus >>>> and only have my phone right now. >>>> >>> Here's a minimal test case where the camera is positioned to look "down" >>> on the stack of cones, the stack is cut off due to clipping (see attached >>> .png): >>> >>> from vtk import vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor >>> from vtk import vtkConeSource, vtkActor, vtkPolyDataMapper >>> >>> renderer = vtkRenderer() >>> renderWindow = vtkRenderWindow() >>> renderWindow.SetSize(500, 1000) >>> renderWindow.AddRenderer(renderer) >>> >>> interactor = vtkRenderWindowInteractor() >>> interactor.SetRenderWindow(renderWindow) >>> >>> # Create a stack of 40 cones along the Y axis >>> for i in range(-20, 20): >>> coneSource = vtkConeSource() >>> coneSource.SetDirection(0, 1, 0) >>> coneSource.SetResolution(8) >>> coneSource.SetCenter(0, i, 0) >>> >>> coneMapper = vtkPolyDataMapper() >>> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>> >>> coneActor = vtkActor() >>> coneActor.SetMapper(coneMapper) >>> >>> renderer.AddActor(coneActor) >>> >>> # Position camera at (3.0, 10.0, 0), looking "down" along the stack >>> camera = renderer.GetActiveCamera() >>> camera.SetParallelProjection(True) >>> camera.SetPosition(3.0, 10.0, 0.0) >>> camera.SetFocalPoint(0.0, 0.0, 0.0) >>> camera.SetParallelScale(5.0) >>> >>> # Reset camera clipping range >>> renderer.ResetCameraClippingRange() >>> >>> # Print some camera info >>> print(camera) >>> >>> interactor.Start() >>> >> >> Forgot to include the output from the test (the printing of the camera): >> >> vtkOpenGLCamera (0x2130810) >> Debug: Off >> Modified Time: 17946 >> Reference Count: 2 >> Registered Events: (none) >> ClippingRange: (0.0531862, 53.1862) >> DirectionOfProjection: (-0.287348, -0.957826, 0) >> Distance: 10.4403 >> EyeAngle: 2 >> FocalDisk: 1 >> FocalPoint: (0, 0, 0) >> ViewShear: (0, 0, 1) >> ParallelProjection: On >> ParallelScale: 5 >> Position: (3, 10, 0) >> Stereo: Off >> Left Eye: 1 >> Thickness: 53.133 >> ViewAngle: 30 >> UseHorizontalViewAngle: 0 >> UserTransform: (none) >> (none) >> FreezeFocalPoint: (none) >> ViewPlaneNormal: (0.287348, 0.957826, -0) >> ViewUp: (0, 1, 0) >> WindowCenter: (0, 0) >> UseOffAxisProjection: (0) >> ScreenBottomLeft: (-0.5, -0.5, -0.5) >> ScreenBottomRight: (0.5, -0.5, -0.5) >> ScreenTopRight: (0.5, 0.5, -0.5) >> EyeSeparation: (0.06) >> WorldToScreenMatrix: (0x2130a50 >> Debug: Off >> Modified Time: 12739 >> Reference Count: 1 >> Registered Events: (none) >> Elements: >> 1 0 0 0 >> 0 1 0 0 >> 0 0 1 0 >> 0 0 0 1 >> ) >> EyeTransformMatrix: (0x2130b40 >> Debug: Off >> Modified Time: 12741 >> Reference Count: 1 >> Registered Events: (none) >> Elements: >> 1 0 0 0 >> 0 1 0 0 >> 0 0 1 0 >> 0 0 0 1 >> ) >> ModelTransformMatrix: (0x2130c30 >> Debug: Off >> Modified Time: 12743 >> Reference Count: 1 >> Registered Events: (none) >> Elements: >> 1 0 0 0 >> 0 1 0 0 >> 0 0 1 0 >> 0 0 0 1 >> ) >> ProjectionTransform: (0x2131170 >> Debug: Off >> Modified Time: 12748 >> Reference Count: 1 >> Registered Events: (none) >> Inverse: (0) >> Matrix: (0x21312a0) >> Debug: Off >> Modified Time: 17947 >> Reference Count: 1 >> Registered Events: (none) >> Elements: >> 1 0 0 0 >> 0 1 0 0 >> 0 0 1 0 >> 0 0 0 1 >> Input: (0) >> InverseFlag: 0 >> NumberOfConcatenatedTransforms: 0 >> ) >> >> Elvis >> >> >>> >>> But I'm beginning to think this is maybe just a misunderstanding on my >>> part. Perhaps this clipping is inevitable and expected when using parallel >>> projection? >>> >>> Thanks in advance, >>> Elvis >>> >>> Elvis >>>> >>>> > >>>> > Thanks >>>> > Ken >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > On Tue, Jun 21, 2016 at 7:06 AM, Elvis Stansvik < >>>> elvis.stansvik at orexplore.com> wrote: >>>> >> >>>> >> Hi all, >>>> >> >>>> >> I have a setup where the camera always moves on a cylinder of radius >>>> 3.0 around my subject (just testing with a stack of cones at the moment). >>>> The focal point is always positioned along the Y axis, and the camera may >>>> be moved up and down independent of the focus point, but the camera is >>>> always at a distance of 3 from the Y axis. >>>> >> >>>> >> As soon as the user moves the camera, I reset the camera clipping >>>> range with ResetCameraClippingRange(). Despite this, when the camera and >>>> the focal point are far away from eachother, the actors (my stack of cones) >>>> get clipped by the near plane for some reason. >>>> >> >>>> >> See the attached screenshot which shows the clipping. >>>> >> >>>> >> What I'm doing to my camera (in response to Shift+mouse drag in my >>>> custom interactor) to end up in this situation is just: >>>> >> >>>> >> camera = renderer.GetActiveCamera() >>>> >> (x, y, z) = camera.GetPosition() >>>> >> camera.SetPosition(x, y - self.PanningFactor * dy, z) >>>> >> renderer.ResetCameraClippingRange() >>>> >> >>>> >> and I've verified that the camera is always at a distance of 3.0 >>>> from the Y axis. >>>> >> >>>> >> The cones I'm using in this test were created with: >>>> >> >>>> >> for i in range(-10, 20): >>>> >> coneSource = vtkConeSource() >>>> >> coneSource.SetDirection(0, 1, 0) >>>> >> coneSource.SetResolution(8) >>>> >> coneSource.SetCenter(0, i, 0) >>>> >> >>>> >> coneMapper = vtkPolyDataMapper() >>>> >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>>> >> >>>> >> coneActor = vtkActor() >>>> >> coneActor.SetMapper(coneMapper) >>>> >> >>>> >> widget.renderer.AddActor(coneActor) >>>> >> >>>> >> I don't understand why I see clipping occur here, since I'm using >>>> ResetCameraClippingRange, and nothing is behind the camera. The radius of >>>> these cones is the default (0.5). >>>> >> >>>> >> It's probably something stupid, but any advice is much appreciated. >>>> >> >>>> >> Elvis >>>> >> >>>> >> _______________________________________________ >>>> >> 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 >>>> >> >>>> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>> >> >>>> >> Follow this link to subscribe/unsubscribe: >>>> >> http://public.kitware.com/mailman/listinfo/vtkusers >>>> >> >>>> > >>>> > >>>> > >>>> > -- >>>> > Ken Martin PhD >>>> > Chairman & CFO >>>> > Kitware Inc. >>>> > 28 Corporate Drive >>>> > Clifton Park NY 12065 >>>> > 518 371 3971 >>>> > >>>> > This communication, including all attachments, contains confidential >>>> and legally privileged information, and it is intended only for the use of >>>> the addressee. Access to this email by anyone else is unauthorized. If you >>>> are not the intended recipient, any disclosure, copying, distribution or >>>> any action taken in reliance on it is prohibited and may be unlawful. If >>>> you received this communication in error please notify us immediately and >>>> destroy the original message. Thank you. >>>> >>> >>> >> > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and > legally privileged information, and it is intended only for the use of the > addressee. Access to this email by anyone else is unauthorized. If you are > not the intended recipient, any disclosure, copying, distribution or any > action taken in reliance on it is prohibited and may be unlawful. If you > received this communication in error please notify us immediately and > destroy the original message. Thank you. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spir.robert at gmail.com Tue Jun 21 14:04:03 2016 From: spir.robert at gmail.com (RobertS) Date: Tue, 21 Jun 2016 11:04:03 -0700 (MST) Subject: [vtkusers] memory leak in vtkStructuredPoints or am I doing something wrong? In-Reply-To: References: <1466490985798-5738805.post@n5.nabble.com> Message-ID: <1466532243887-5738837.post@n5.nabble.com> Thank you for the information David. I also noticed that when I'm loading new files the memory usage is not increasing (unless I load more files than before). I just haven't seen this behavior in linux before and also the fact that with some datasets it actually frees the memory is weird. Robert David Lonie-2 wrote > Hi Robert, > > I took a look at your test case (thanks, btw -- these help a lot!) and > while I can reproduce the results, it appears that linux is just caching > the memory for the process, not leaking it. > > I modified your script to do 50 cycles of load/clears, with this result: > > ./vtkbug > > Press 1 for zebra, 2 for phallucia > > > 1 > > > Data loaded: 352 MB in use. > > > Data cleared: 248 MB in use. > > > Data loaded: 378 MB in use. > > > Data cleared: 378 MB in use. > > > Data loaded: 352 MB in use. > > > Data cleared: 352 MB in use. > > > Data loaded: 352 MB in use. > > > Data cleared: 352 MB in use. > [snipped 45 load/clears] > Data loaded: 378 MB in use. > Data cleared: 378 MB in use. > > While the memory is still marked as reserved by the process, it doesn't > grow, and the 'leaked' memory is reused by later allocations. > > I also verified that the dataset destructors are being called at the > appropriate times, and valgrind confirms that no memory is leaking at > exit. > > I did a quick google search for clearing linux memory caches, and it > appears that it may be possible to instruct linux to drop the cache if > this > is causing problems, but I suspect the operating system will reclaim > cached > memory when it starts running out. Unless you start seeing memory > allocations fail or excessive swapping, this can likely be ignored. > > HTH, > Dave > > On Tue, Jun 21, 2016 at 2:36 AM, RobertS < > spir.robert@ > > wrote: > >> Hello all, >> I'm doing visualization of series of 3D volumes stored in VTK files. >> First >> I >> load all vtk files to vector of vtkStructuredPoints using this simple >> code >> inside cycle >> >> vtkSmartPointer > > reader = >> vtkSmartPointer > > ::New(); >> reader->SetFileName(filename); >> reader->Update(); >> ptsCopy = vtkSmartPointer > > ::New(); >> ptsCopy->DeepCopy(reader->GetOutput()); >> loadedPoints.push_back(ptsCopy); >> reader->CloseVTKFile(); >> >> then when I want to change the dataset I just call loadedPoints.clear() >> and >> start loading other vtk files. >> Now on windows, everything goes as expected, by calling .clear() memory >> get >> freed. This is not the case in linux, here the memory is stil occupied >> and >> since I'm working with very large datasets (>12GB) this is a serious >> problem. >> Now another interesting thing is, that with some datasets the memory gets >> cleared even in linux, but with some others it doesn't... >> I'm using VTK 7.0 compiled from source, vs2015 in windows, gcc6.1 in >> linux >> >> I made a small project that only loads the vtk files to vector and then >> clears it, displaying amount of used memory in between. I can reproduce >> the >> memory leak with this code in linux, in windows it clears the memory. >> http://tesla.math.sk/vtkbug.7z >> Here you can download two datasets, zebra is causing the leak, phallusia >> is >> not >> http://tesla.math.sk/zebra.7z >> http://tesla.math.sk/phallusia.7z >> >> Thanks for any help >> >> Robert Spir PhD >> Department of Mathematics >> Slovak University of Technology >> Radlinskeho 11 >> 813 68 Bratislava >> Slovakia >> >> >> >> >> >> -- >> View this message in context: >> http://vtk.1045678.n5.nabble.com/memory-leak-in-vtkStructuredPoints-or-am-I-doing-something-wrong-tp5738805.html >> Sent from the VTK - Users mailing list archive at Nabble.com. >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- View this message in context: http://vtk.1045678.n5.nabble.com/memory-leak-in-vtkStructuredPoints-or-am-I-doing-something-wrong-tp5738805p5738837.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Wed Jun 22 04:36:16 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 22 Jun 2016 10:36:16 +0200 Subject: [vtkusers] Notification after interaction with vtkComposite(TransferFunction|ControlPoints)Item In-Reply-To: References: Message-ID: 2016-06-21 16:02 GMT+02:00 Elvis Stansvik : > Hi all, > > I'm using a vtkCompositeTransferFunctionItem + > vtkCompositeControlPointsItem in a vtkChartXY to modify the transfer > functions used for some volume rendering. > > Is there some event from one of these items I can observe that will fire > once interaction has occurred? I know I can observe the ModifiedEvent of > the vtkCompositeTransferFunctionItem, but when dragging points around, it > will fire on each mouse move. I need to be notified only once the > interaction has stopped. > Looking at the code, I noticed that vtkControlPointsItem seem to emit vtkCommand::StartInteractionEvent and vtkCommand::EndInteractionEvent (though I'm not sure...), and since vtkCompositeControlPointsItem indirectly inherits vtkControlPointsItem, I tried to observe vtkCommand::EndInteractionEvent with self._pointsItem.AddObserver(vtkCommand.EndInteractionEvent, lambda *_: print('interaction ended')) where self._pointsItem is my vtkCompositeControlPointsItem. But it seems the event is not emitted when I interact with the points. Any ideas here? Surely there must be some way of being notified when interaction with the color transfer functions has ended? My use case is that I don't want to issue a re-render of my volume each time the mouse moves when dragging a point around. Only when dragging finally stops do I want to re-render. Any advice is much appriciated. Elvis > Thanks in advance, > Elvis > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 22 05:07:36 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 22 Jun 2016 11:07:36 +0200 Subject: [vtkusers] Notification after interaction with vtkComposite(TransferFunction|ControlPoints)Item In-Reply-To: References: Message-ID: 2016-06-22 10:36 GMT+02:00 Elvis Stansvik : > 2016-06-21 16:02 GMT+02:00 Elvis Stansvik : > >> Hi all, >> >> I'm using a vtkCompositeTransferFunctionItem + >> vtkCompositeControlPointsItem in a vtkChartXY to modify the transfer >> functions used for some volume rendering. >> >> Is there some event from one of these items I can observe that will fire >> once interaction has occurred? I know I can observe the ModifiedEvent of >> the vtkCompositeTransferFunctionItem, but when dragging points around, it >> will fire on each mouse move. I need to be notified only once the >> interaction has stopped. >> > > Looking at the code, I noticed that vtkControlPointsItem seem to emit > vtkCommand::StartInteractionEvent and vtkCommand::EndInteractionEvent > (though I'm not sure...), and since vtkCompositeControlPointsItem > indirectly inherits vtkControlPointsItem, I tried to observe > vtkCommand::EndInteractionEvent with > > self._pointsItem.AddObserver(vtkCommand.EndInteractionEvent, > lambda *_: print('interaction ended')) > > where self._pointsItem is my vtkCompositeControlPointsItem. > > But it seems the event is not emitted when I interact with the points. > > Any ideas here? Surely there must be some way of being notified when > interaction with the color transfer functions has ended? My use case is > that I don't want to issue a re-render of my volume each time the mouse > moves when dragging a point around. Only when dragging finally stops do I > want to re-render. > > Any advice is much appriciated. > After some more experimentation, trying to observe various events on the items, the chart, the context view and the context scene, I've realized I can observe vtkCommand.LeftButtonReleaseEvent vtkCommand.RightButtonReleaseEvent vtkCommand.MiddleButtonReleaseEvent on the context scene. This will work as a workaround, but seems overly liberal and complicated. Is there no single event on the composite control points item or the composite transfer function item I could observe? Elvis > Elvis > > >> Thanks in advance, >> Elvis >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 22 06:23:48 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 22 Jun 2016 12:23:48 +0200 Subject: [vtkusers] Notification after interaction with vtkComposite(TransferFunction|ControlPoints)Item In-Reply-To: References: Message-ID: 2016-06-22 11:07 GMT+02:00 Elvis Stansvik : > 2016-06-22 10:36 GMT+02:00 Elvis Stansvik : > >> 2016-06-21 16:02 GMT+02:00 Elvis Stansvik : >> >>> Hi all, >>> >>> I'm using a vtkCompositeTransferFunctionItem + >>> vtkCompositeControlPointsItem in a vtkChartXY to modify the transfer >>> functions used for some volume rendering. >>> >>> Is there some event from one of these items I can observe that will fire >>> once interaction has occurred? I know I can observe the ModifiedEvent of >>> the vtkCompositeTransferFunctionItem, but when dragging points around, it >>> will fire on each mouse move. I need to be notified only once the >>> interaction has stopped. >>> >> >> Looking at the code, I noticed that vtkControlPointsItem seem to emit >> vtkCommand::StartInteractionEvent and vtkCommand::EndInteractionEvent >> (though I'm not sure...), and since vtkCompositeControlPointsItem >> indirectly inherits vtkControlPointsItem, I tried to observe >> vtkCommand::EndInteractionEvent with >> >> self._pointsItem.AddObserver(vtkCommand.EndInteractionEvent, >> lambda *_: print('interaction >> ended')) >> >> where self._pointsItem is my vtkCompositeControlPointsItem. >> >> But it seems the event is not emitted when I interact with the points. >> >> Any ideas here? Surely there must be some way of being notified when >> interaction with the color transfer functions has ended? My use case is >> that I don't want to issue a re-render of my volume each time the mouse >> moves when dragging a point around. Only when dragging finally stops do I >> want to re-render. >> >> Any advice is much appriciated. >> > > After some more experimentation, trying to observe various events on the > items, the chart, the context view and the context scene, I've realized I > can observe > > vtkCommand.LeftButtonReleaseEvent > vtkCommand.RightButtonReleaseEvent > vtkCommand.MiddleButtonReleaseEvent > > on the context scene. This will work as a workaround, but seems overly > liberal and complicated. Is there no single event on the composite control > points item or the composite transfer function item I could observe? > Although I realized now that this approach won't work, since for some reason, by the time I get the vtkCommand.MiddleButtonReleaseEvent, the point has not yet been deleted. So still looking for a proper solution. Elvis > > Elvis > > >> Elvis >> >> >>> Thanks in advance, >>> Elvis >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ceoparis at yahoo.com Wed Jun 22 06:57:48 2016 From: ceoparis at yahoo.com (Paris Flood) Date: Wed, 22 Jun 2016 10:57:48 +0000 (UTC) Subject: [vtkusers] Passing output of a render to CUDA without going through the Host References: <1501842759.2352085.1466593068534.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <1501842759.2352085.1466593068534.JavaMail.yahoo@mail.yahoo.com> After calling a Render() on a vtkRenderWindow, I would like to pass the rendered image to a CUDA function on the device (GPU) without going through the host (CPU). Currently I have been using a vtkWindowToImageFilter to get a pointer to the image data ( windowFilter->GetOutput()->GetScalarPointer() ), however it appears this pointer is to memory on the CPU and I therefore have to upload back to the GPU to begin my CUDA computations. Of course, this is a massive bottleneck and it would greatly improve the speed of my computation to bypass this whole download/upload process. Any advice is greatly appreciated, thank you! -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 22 09:54:26 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 22 Jun 2016 15:54:26 +0200 Subject: [vtkusers] Problem with vtkPiecewiseFunction (0x1c4d430): Index out of range! (test case included) Message-ID: Hi all, I'd like to use a vtkCompositeTransferFunctionItem + vtkCompositeControlPointsItem combo inside a vtkChartXY, for editing a color transfer function (and visualizing the opacity transfer function at the same time). I want to use SetPointsFunction(vtkCompositeControlPointsItem.ColorPointsFunction) on the vtkCompositeControlPointsItem, to enable editing only of the color transfer function (while still showing the opacity transfer function). But if I do so, I get a ERROR: In /build/vtk7-0qbNHX/vtk7-7.0.0/Common/DataModel/vtkPiecewiseFunction.cxx, line 349 vtkPiecewiseFunction (0x277bc50): Index out of range! when I double a certain point in the plot to edit it. Here's a minimal test case: from vtk import vtkRenderWindow from vtk import vtkRenderWindowInteractor from vtk import vtkColorTransferFunction from vtk import vtkPiecewiseFunction from vtk import vtkContextView from vtk import vtkChartXY from vtk import vtkAxis from vtk import vtkCompositeTransferFunctionItem from vtk import vtkCompositeControlPointsItem from vtk import vtkControlPointsItem # Create a render window and interactor renderWindow = vtkRenderWindow() interactor = vtkRenderWindowInteractor() # Create a color transfer function colorFunction = vtkColorTransferFunction() colorFunction.AddHSVSegment(0., 0., 1., 1., 1./3, 1./3, 1., 1.) colorFunction.AddHSVSegment(1./3, 1./3, 1., 1., 2./3, 2./3, 1., 1.) colorFunction.AddHSVSegment(2./3, 2./3, 1., 1., 1., 0., 1., 1.) # Create an opacity transfer function opacityFunction = vtkPiecewiseFunction() opacityFunction.AddPoint(0.2, 0.) opacityFunction.AddPoint(0.5, 0.5) opacityFunction.AddPoint(1., 1.) # Create an item for showing the transfer functions functionsItem = vtkCompositeTransferFunctionItem() functionsItem.SetColorTransferFunction(colorFunction) functionsItem.SetOpacityFunction(opacityFunction) functionsItem.SetMaskAboveCurve(True) # Create an item for showing/controlling the color # transfer function points pointsItem = vtkCompositeControlPointsItem() pointsItem.SetPointsFunction( vtkCompositeControlPointsItem.ColorPointsFunction) pointsItem.SetColorTransferFunction(colorFunction) pointsItem.SetOpacityFunction(opacityFunction) pointsItem.SetUseOpacityPointHandles(True) pointsItem.SetEndPointsXMovable(False) pointsItem.SetEndPointsRemovable(False) pointsItem.SetShowLabels(True) pointsItem.SetLabelFormat("%.3f : %.3f") def editPoint(sender, event): print('TODO: edit point') pointsItem.AddObserver( vtkControlPointsItem.CurrentPointEditEvent, editPoint) # Create an XY chart to hold the items chart = vtkChartXY() chart.AddPlot(functionsItem) chart.AddPlot(pointsItem) # Create a context view to show the chart view = vtkContextView() view.GetScene().AddItem(chart) view.SetRenderWindow(renderWindow) view.SetInteractor(interactor) interactor.Start() Launch the program and then double click the third point. You will get TODO: edit point ERROR: In /build/vtk7-0qbNHX/vtk7-7.0.0/Common/DataModel/vtkPiecewiseFunction.cxx, line 349 vtkPiecewiseFunction (0x1c4d430): Index out of range! printed. The first printout ("TODO: edit point") is from my editPoint(...) function, while the ERROR message comes from inside VTK. After having made the first double click these error messages keeps spewing on the console as soon as you move the mouse over the chart. This only happens when doubleclicking the third point (at index 2), not when doubleclicking point 0, 1 or 3. Anyone know what is going on? I also noticed that if I remove the line pointsItem.SetPointsFunction( vtkCompositeControlPointsItem.ColorPointsFunction) The problem disappears. But this will not give me the kind of editor I want. Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 22 09:57:32 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 22 Jun 2016 15:57:32 +0200 Subject: [vtkusers] Problem with vtkPiecewiseFunction (0x1c4d430): Index out of range! (test case included) In-Reply-To: References: Message-ID: 2016-06-22 15:54 GMT+02:00 Elvis Stansvik : > Hi all, > > I'd like to use a vtkCompositeTransferFunctionItem + > vtkCompositeControlPointsItem combo inside a vtkChartXY, for editing a > color transfer function (and visualizing the opacity transfer function at > the same time). > > I want to use > SetPointsFunction(vtkCompositeControlPointsItem.ColorPointsFunction) on the > vtkCompositeControlPointsItem, to enable editing only of the color transfer > function (while still showing the opacity transfer function). But if I do > so, I get a > > ERROR: In > /build/vtk7-0qbNHX/vtk7-7.0.0/Common/DataModel/vtkPiecewiseFunction.cxx, > line 349 > vtkPiecewiseFunction (0x277bc50): Index out of range! > > when I double a certain point in the plot to edit it. > > Here's a minimal test case: > > from vtk import vtkRenderWindow > from vtk import vtkRenderWindowInteractor > from vtk import vtkColorTransferFunction > from vtk import vtkPiecewiseFunction > from vtk import vtkContextView > from vtk import vtkChartXY > from vtk import vtkAxis > from vtk import vtkCompositeTransferFunctionItem > from vtk import vtkCompositeControlPointsItem > from vtk import vtkControlPointsItem > > # Create a render window and interactor > renderWindow = vtkRenderWindow() > interactor = vtkRenderWindowInteractor() > > # Create a color transfer function > colorFunction = vtkColorTransferFunction() > colorFunction.AddHSVSegment(0., 0., 1., 1., 1./3, 1./3, 1., 1.) > colorFunction.AddHSVSegment(1./3, 1./3, 1., 1., 2./3, 2./3, 1., 1.) > colorFunction.AddHSVSegment(2./3, 2./3, 1., 1., 1., 0., 1., 1.) > > # Create an opacity transfer function > opacityFunction = vtkPiecewiseFunction() > opacityFunction.AddPoint(0.2, 0.) > opacityFunction.AddPoint(0.5, 0.5) > opacityFunction.AddPoint(1., 1.) > > # Create an item for showing the transfer functions > functionsItem = vtkCompositeTransferFunctionItem() > functionsItem.SetColorTransferFunction(colorFunction) > functionsItem.SetOpacityFunction(opacityFunction) > functionsItem.SetMaskAboveCurve(True) > > # Create an item for showing/controlling the color > # transfer function points > pointsItem = vtkCompositeControlPointsItem() > pointsItem.SetPointsFunction( > vtkCompositeControlPointsItem.ColorPointsFunction) > pointsItem.SetColorTransferFunction(colorFunction) > pointsItem.SetOpacityFunction(opacityFunction) > pointsItem.SetUseOpacityPointHandles(True) > pointsItem.SetEndPointsXMovable(False) > pointsItem.SetEndPointsRemovable(False) > pointsItem.SetShowLabels(True) > pointsItem.SetLabelFormat("%.3f : %.3f") > > def editPoint(sender, event): > print('TODO: edit point') > > pointsItem.AddObserver( > vtkControlPointsItem.CurrentPointEditEvent, editPoint) > > # Create an XY chart to hold the items > chart = vtkChartXY() > chart.AddPlot(functionsItem) > chart.AddPlot(pointsItem) > > # Create a context view to show the chart > view = vtkContextView() > view.GetScene().AddItem(chart) > view.SetRenderWindow(renderWindow) > view.SetInteractor(interactor) > > interactor.Start() > > Launch the program and then double click the third point. You will get > > TODO: edit point > ERROR: In > /build/vtk7-0qbNHX/vtk7-7.0.0/Common/DataModel/vtkPiecewiseFunction.cxx, > line 349 > vtkPiecewiseFunction (0x1c4d430): Index out of range! > > printed. The first printout ("TODO: edit point") is from my editPoint(...) > function, while the ERROR message comes from inside VTK. After having made > the first double click these error messages keeps spewing on the console as > soon as you move the mouse over the chart. This only happens when > doubleclicking the third point (at index 2), not when doubleclicking point > 0, 1 or 3. > > Anyone know what is going on? I also noticed that if I remove the line > > pointsItem.SetPointsFunction( > vtkCompositeControlPointsItem.ColorPointsFunction) > > The problem disappears. But this will not give me the kind of editor I > want. > To clarify which point I mean, and to show the behavior I'm seeing, I'm attaching a screenshot. I took this after doubleclicking the selected point and moving the mouse outside the window. Elvis > > Elvis > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: chart_ctf.png Type: image/png Size: 59084 bytes Desc: not available URL: From elvis.stansvik at orexplore.com Wed Jun 22 10:21:59 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 22 Jun 2016 16:21:59 +0200 Subject: [vtkusers] Problem with vtkPiecewiseFunction (0x1c4d430): Index out of range! (test case included) In-Reply-To: References: Message-ID: 2016-06-22 15:54 GMT+02:00 Elvis Stansvik : > Hi all, > > I'd like to use a vtkCompositeTransferFunctionItem + > vtkCompositeControlPointsItem combo inside a vtkChartXY, for editing a > color transfer function (and visualizing the opacity transfer function at > the same time). > > I want to use > SetPointsFunction(vtkCompositeControlPointsItem.ColorPointsFunction) on the > vtkCompositeControlPointsItem, to enable editing only of the color transfer > function (while still showing the opacity transfer function). But if I do > so, I get a > > ERROR: In > /build/vtk7-0qbNHX/vtk7-7.0.0/Common/DataModel/vtkPiecewiseFunction.cxx, > line 349 > vtkPiecewiseFunction (0x277bc50): Index out of range! > > when I double a certain point in the plot to edit it. > > Here's a minimal test case: > > from vtk import vtkRenderWindow > from vtk import vtkRenderWindowInteractor > from vtk import vtkColorTransferFunction > from vtk import vtkPiecewiseFunction > from vtk import vtkContextView > from vtk import vtkChartXY > from vtk import vtkAxis > from vtk import vtkCompositeTransferFunctionItem > from vtk import vtkCompositeControlPointsItem > from vtk import vtkControlPointsItem > > # Create a render window and interactor > renderWindow = vtkRenderWindow() > interactor = vtkRenderWindowInteractor() > > # Create a color transfer function > colorFunction = vtkColorTransferFunction() > colorFunction.AddHSVSegment(0., 0., 1., 1., 1./3, 1./3, 1., 1.) > colorFunction.AddHSVSegment(1./3, 1./3, 1., 1., 2./3, 2./3, 1., 1.) > colorFunction.AddHSVSegment(2./3, 2./3, 1., 1., 1., 0., 1., 1.) > > # Create an opacity transfer function > opacityFunction = vtkPiecewiseFunction() > opacityFunction.AddPoint(0.2, 0.) > opacityFunction.AddPoint(0.5, 0.5) > opacityFunction.AddPoint(1., 1.) > > # Create an item for showing the transfer functions > functionsItem = vtkCompositeTransferFunctionItem() > functionsItem.SetColorTransferFunction(colorFunction) > functionsItem.SetOpacityFunction(opacityFunction) > functionsItem.SetMaskAboveCurve(True) > > # Create an item for showing/controlling the color > # transfer function points > pointsItem = vtkCompositeControlPointsItem() > pointsItem.SetPointsFunction( > vtkCompositeControlPointsItem.ColorPointsFunction) > pointsItem.SetColorTransferFunction(colorFunction) > pointsItem.SetOpacityFunction(opacityFunction) > pointsItem.SetUseOpacityPointHandles(True) > pointsItem.SetEndPointsXMovable(False) > pointsItem.SetEndPointsRemovable(False) > pointsItem.SetShowLabels(True) > pointsItem.SetLabelFormat("%.3f : %.3f") > > def editPoint(sender, event): > print('TODO: edit point') > > pointsItem.AddObserver( > vtkControlPointsItem.CurrentPointEditEvent, editPoint) > > # Create an XY chart to hold the items > chart = vtkChartXY() > chart.AddPlot(functionsItem) > chart.AddPlot(pointsItem) > > # Create a context view to show the chart > view = vtkContextView() > view.GetScene().AddItem(chart) > view.SetRenderWindow(renderWindow) > view.SetInteractor(interactor) > > interactor.Start() > > Launch the program and then double click the third point. You will get > > TODO: edit point > ERROR: In > /build/vtk7-0qbNHX/vtk7-7.0.0/Common/DataModel/vtkPiecewiseFunction.cxx, > line 349 > vtkPiecewiseFunction (0x1c4d430): Index out of range! > > printed. The first printout ("TODO: edit point") is from my editPoint(...) > function, while the ERROR message comes from inside VTK. After having made > the first double click these error messages keeps spewing on the console as > soon as you move the mouse over the chart. This only happens when > doubleclicking the third point (at index 2), not when doubleclicking point > 0, 1 or 3. > > Anyone know what is going on? I also noticed that if I remove the line > > pointsItem.SetPointsFunction( > vtkCompositeControlPointsItem.ColorPointsFunction) > > The problem disappears. But this will not give me the kind of editor I > want. > I've experimented some more, and while I don't fully understand what happens, the error seems to occur when the midpoint/sharpness handles appear and one of the handles is outside the chart area. I'd appreciate a lot of someone who knows this code could point out if I'm doing something wrong, or if this is a bug. Elvis > > Elvis > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From enzo.matsumiya at gmail.com Wed Jun 22 10:49:51 2016 From: enzo.matsumiya at gmail.com (Enzo Matsumiya) Date: Wed, 22 Jun 2016 11:49:51 -0300 Subject: [vtkusers] Improve image quality when using vtkResliceCursorWidget Message-ID: <21A45DBE-E359-4BA5-B467-9231DA42BA9B@gmail.com> Hi, I'm using vtkResliceCursorWidget for oblique reslicing on a CT set. But I'm getting really bad image quality. Here is an example from my app: http://oi68.tinypic.com/1z55cop.jpg And here is one (although non-oblique) from other software: http://oi68.tinypic.com/2lidi6p.jpg I would like to know if there's a way to improve the quality on my app. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From sankhesh.jhaveri at kitware.com Wed Jun 22 10:59:56 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Wed, 22 Jun 2016 10:59:56 -0400 Subject: [vtkusers] Improve image quality when using vtkResliceCursorWidget In-Reply-To: <21A45DBE-E359-4BA5-B467-9231DA42BA9B@gmail.com> References: <21A45DBE-E359-4BA5-B467-9231DA42BA9B@gmail.com> Message-ID: Enzo, What do you mean by quality? Looking at the two images, the resolution looks the same to me. I see there is a difference in the range of pixel values between the two images. This could either be due to the data type differences in the output image or actual data value differences. Do you have ManageWindowLevel enabled for vtkResliceCursorWidget? Sankhesh On Wed, Jun 22, 2016 at 10:49 AM, Enzo Matsumiya wrote: > Hi, > > I'm using vtkResliceCursorWidget for oblique reslicing on a CT set. > But I'm getting really bad image quality. Here is an example from my app: > > http://oi68.tinypic.com/1z55cop.jpg > > And here is one (although non-oblique) from other software: > > http://oi68.tinypic.com/2lidi6p.jpg > > I would like to know if there's a way to improve the quality on my app. > > > Thanks > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From enzo.matsumiya at gmail.com Wed Jun 22 11:24:16 2016 From: enzo.matsumiya at gmail.com (Enzo Matsumiya) Date: Wed, 22 Jun 2016 12:24:16 -0300 Subject: [vtkusers] Improve image quality when using vtkResliceCursorWidget In-Reply-To: References: <21A45DBE-E359-4BA5-B467-9231DA42BA9B@gmail.com> Message-ID: <5A6ABB21-47A2-4231-A159-BF561FEAA4D7@gmail.com> Hi Sankhesh, Thanks for the reply. By quality I mean that the first image looks crispy, while the second one looks very smooth. But now that you said, I will see if I can find any data type inconsistency accross my code. ManageWindowLevel is enabled on vtkResliceCursorWidget. Thanks again, Enzo > On Jun 22, 2016, at 11:59, Sankhesh Jhaveri wrote: > > Enzo, > > What do you mean by quality? > > Looking at the two images, the resolution looks the same to me. I see there is a difference in the range of pixel values between the two images. This could either be due to the data type differences in the output image or actual data value differences. Do you have ManageWindowLevel enabled for vtkResliceCursorWidget? > > Sankhesh > > > > On Wed, Jun 22, 2016 at 10:49 AM, Enzo Matsumiya > wrote: > Hi, > > I'm using vtkResliceCursorWidget for oblique reslicing on a CT set. > But I'm getting really bad image quality. Here is an example from my app: > > http://oi68.tinypic.com/1z55cop.jpg > > And here is one (although non-oblique) from other software: > > http://oi68.tinypic.com/2lidi6p.jpg > > I would like to know if there's a way to improve the quality on my app. > > > Thanks > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sayala at ni.com Wed Jun 22 16:29:36 2016 From: sayala at ni.com (sreeram) Date: Wed, 22 Jun 2016 13:29:36 -0700 (MST) Subject: [vtkusers] unable to pass globalids through vtk filters. Message-ID: <1466627376410-5738851.post@n5.nabble.com> I am having trouble passing global ids through vtk filters. Particularly vtkclipDataSet. It appears that, the global copy flag is unset by the filter. Forcing it the flag to set in debugger does not help. My global ids are vtkIdTypeArray. I am setting them on vtkPointData. Here is the code snippet. vtkSmartPointer points = vtkSmartPointer::New(); points->InsertNextPoint(0.0, 0.0, 0.0); points->InsertNextPoint(1.0, 0.0, 0.0); points->InsertNextPoint(0.0, 1.0, 0.0); auto arr = vtkSmartPointer::New(); std::vector varr = { 0, 1, 2 }; arr->SetArray(&varr[0], 3, 1); // arr->SetName("myarr"); vtkSmartPointer pointsPolydata = vtkSmartPointer::New(); pointsPolydata->SetPoints(points); pointsPolydata->GetPointData()->SetGlobalIds(arr); pointsPolydata->GetPointData()->CopyGlobalIdsOn(); //pointsPolydata->GetPointData()->SetActiveAttribute("arr", vtkDataSetAttributes::GLOBALIDS); // pointsPolydata->GetPointData()->CopyGlobalIdsOn(); vtkSmartPointer vertexFilter = vtkSmartPointer::New(); #if VTK_MAJOR_VERSION <= 5 vertexFilter->SetInputConnection(pointsPolydata->GetProducerPort()); #else vertexFilter->SetInputData(pointsPolydata); #endif //vertexFilter->SetOutput(vertexFilter->GetInput()); //auto n0 = vertexFilter->GetOutput()->GetPointData()->GetCopyGlobalIds(); vertexFilter->Update(); auto nCells = vertexFilter->GetOutput()->GetNumberOfCells(); auto n = vertexFilter->GetOutput()->GetPointData()->GetGlobalIds(); // auto n2 = vertexFilter->GetOutput()->GetPointData()->GetGlobalIds("myarr"); vtkSmartPointer polydata = vtkSmartPointer::New(); polydata->ShallowCopy(vertexFilter->GetOutput()); auto n3 = polydata->GetPointData()->GetGlobalIds(); // Setup colors unsigned char red[3] = { 255, 0, 0 }; unsigned char green[3] = { 0, 255, 0 }; unsigned char blue[3] = { 0, 0, 255 }; vtkSmartPointer colors = vtkSmartPointer::New(); colors->SetNumberOfComponents(3); colors->SetName("Colors"); colors->InsertNextTupleValue(red); colors->InsertNextTupleValue(green); colors->InsertNextTupleValue(blue); polydata->GetPointData()->SetScalars(colors); auto pPlane = vtkSmartPointer::New(); std::vector vdNormal = { 0.1, 0, 0 }; std::vector vdOrigin = {0, 1.0, 0}; pPlane->SetNormal(&vdNormal[0]); pPlane->SetOrigin(&vdOrigin[0]); auto pClipper = vtkSmartPointer::New(); pClipper->SetClipFunction(pPlane); pClipper->SetInputData(polydata); vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->CopyGlobalIdsOn(); pClipper->GetOutput()->GetPointData()->CopyGlobalIdsOn(); auto pPt = pClipper->GetOutput()->GetPointData(); vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->Print(std::cout); pClipper->Update(); // pClipper->GetOutput()->GetPointData()->CopyAllOn(); pClipper->GetOutput()->GetPointData()->Print(std::cout); auto nnn0 = vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->GetGlobalIds(); auto a = vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->GetCopyGlobalIds(); auto a2 = pClipper->GetOutput()->GetPointData()->GetCopyGlobalIds(); auto nnn = pClipper->GetOutput()->GetPointData()->GetGlobalIds(); The globalids' does pass through vertexFilter. But does not pass through the clip filter. Any help is highly appreciated. thanks, Sreeram -- View this message in context: http://vtk.1045678.n5.nabble.com/unable-to-pass-globalids-through-vtk-filters-tp5738851.html Sent from the VTK - Users mailing list archive at Nabble.com. From patriciop at gmail.com Wed Jun 22 17:34:16 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Wed, 22 Jun 2016 17:34:16 -0400 Subject: [vtkusers] Crash when exporting to EPS Message-ID: Dear Expert I have an app which currently works with VTK 5.10 exporting to EPS image format. However after updating to VTK 7.0 OpenGL1 it crashes when trying to export with the following message: Generic Warning: In /remote/cl01home/papalma/MyPRJ/vtk-devel/IO/Export/vtkGL2PSExporter.cxx, line 26 Error: no override found for 'vtkGL2PSExporter'. Do I have to initializate some module before use the vtkGLS2PSExporter class? Regards -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcplatt at dsl.pipex.com Wed Jun 22 18:42:56 2016 From: jcplatt at dsl.pipex.com (John Platt) Date: Wed, 22 Jun 2016 23:42:56 +0100 Subject: [vtkusers] unable to pass globalids through vtk filters. In-Reply-To: <1466627376410-5738851.post@n5.nabble.com> References: <1466627376410-5738851.post@n5.nabble.com> Message-ID: Hi sreeram, Clipping/cutting global Ids would generate new Ids by interpolation from the point global Ids in a cell. These would need to be rounded to vtkIdType with new points possibly having the same interpolated global Id and therefore no longer unique. The exception is vertices where no interpolation occurs. HTH John. On 6/22/2016 9:29 PM, sreeram wrote: > I am having trouble passing global ids through vtk filters. Particularly > vtkclipDataSet. It appears that, the global copy flag is unset by the > filter. Forcing it the flag to set in debugger does not help. > > My global ids are vtkIdTypeArray. I am setting them on vtkPointData. Here > is the code snippet. > > vtkSmartPointer points = > vtkSmartPointer::New(); > points->InsertNextPoint(0.0, 0.0, 0.0); > points->InsertNextPoint(1.0, 0.0, 0.0); > points->InsertNextPoint(0.0, 1.0, 0.0); > auto arr = vtkSmartPointer::New(); > std::vector varr = { 0, 1, 2 }; > arr->SetArray(&varr[0], 3, 1); > // arr->SetName("myarr"); > vtkSmartPointer pointsPolydata = > vtkSmartPointer::New(); > > pointsPolydata->SetPoints(points); > pointsPolydata->GetPointData()->SetGlobalIds(arr); > > pointsPolydata->GetPointData()->CopyGlobalIdsOn(); > > //pointsPolydata->GetPointData()->SetActiveAttribute("arr", > vtkDataSetAttributes::GLOBALIDS); > // pointsPolydata->GetPointData()->CopyGlobalIdsOn(); > > vtkSmartPointer vertexFilter = > vtkSmartPointer::New(); > #if VTK_MAJOR_VERSION <= 5 > vertexFilter->SetInputConnection(pointsPolydata->GetProducerPort()); > #else > vertexFilter->SetInputData(pointsPolydata); > #endif > //vertexFilter->SetOutput(vertexFilter->GetInput()); > //auto n0 = vertexFilter->GetOutput()->GetPointData()->GetCopyGlobalIds(); > > vertexFilter->Update(); > auto nCells = vertexFilter->GetOutput()->GetNumberOfCells(); > auto n = vertexFilter->GetOutput()->GetPointData()->GetGlobalIds(); > // auto n2 = > vertexFilter->GetOutput()->GetPointData()->GetGlobalIds("myarr"); > > vtkSmartPointer polydata = > vtkSmartPointer::New(); > polydata->ShallowCopy(vertexFilter->GetOutput()); > auto n3 = polydata->GetPointData()->GetGlobalIds(); > > // Setup colors > unsigned char red[3] = { 255, 0, 0 }; > unsigned char green[3] = { 0, 255, 0 }; > unsigned char blue[3] = { 0, 0, 255 }; > > vtkSmartPointer colors = > vtkSmartPointer::New(); > colors->SetNumberOfComponents(3); > colors->SetName("Colors"); > colors->InsertNextTupleValue(red); > colors->InsertNextTupleValue(green); > colors->InsertNextTupleValue(blue); > > polydata->GetPointData()->SetScalars(colors); > > > auto pPlane = vtkSmartPointer::New(); > std::vector vdNormal = { 0.1, 0, 0 }; > std::vector vdOrigin = {0, 1.0, 0}; > > pPlane->SetNormal(&vdNormal[0]); > pPlane->SetOrigin(&vdOrigin[0]); > > auto pClipper = vtkSmartPointer::New(); > pClipper->SetClipFunction(pPlane); > pClipper->SetInputData(polydata); > > vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->CopyGlobalIdsOn(); > pClipper->GetOutput()->GetPointData()->CopyGlobalIdsOn(); > > auto pPt = pClipper->GetOutput()->GetPointData(); > > vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->Print(std::cout); > pClipper->Update(); > // pClipper->GetOutput()->GetPointData()->CopyAllOn(); > pClipper->GetOutput()->GetPointData()->Print(std::cout); > > auto nnn0 = > vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->GetGlobalIds(); > > auto a = > vtkDataSet::SafeDownCast(pClipper->GetInput())->GetPointData()->GetCopyGlobalIds(); > auto a2 = pClipper->GetOutput()->GetPointData()->GetCopyGlobalIds(); > auto nnn = pClipper->GetOutput()->GetPointData()->GetGlobalIds(); > > The globalids' does pass through vertexFilter. But does not pass through > the clip filter. > > Any help is highly appreciated. > > thanks, > > Sreeram > > > > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/unable-to-pass-globalids-through-vtk-filters-tp5738851.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > From nthdimensionalreality at gmail.com Wed Jun 22 22:29:13 2016 From: nthdimensionalreality at gmail.com (bhanu kiran chaluvadi) Date: Wed, 22 Jun 2016 20:29:13 -0600 Subject: [vtkusers] Programming in Visual studio - How to include all the required directories in Visual studio. Message-ID: Hi, I am new to VTK. I am using VTK - 6.3.0 along with visual studio 2013. I don't have much knowledge in cmake. I am able to build VTK and run all the example(present in bin folder) by following some youtube tutorials. Now i want to create by own sample project. I want to include "vtkRenderer.h" in my program(for example).. As usual in visual studio -> properties i included the path where the program can find vtkRenderer.h But vtkRenderer.h itself has 4 included header files #include "vtkRenderingCoreModule.h" // For export macro #include "vtkViewport.h" #include "vtkVolumeCollection.h" // Needed for access in inline members #include "vtkActorCollection.h" And Each of the above header file has further more included header file..and this continued... I will not be able to include the paths for each header file. since they are so many(more than 50)of them Is there any way around this ? i.e. if i #include It should include all its dependency files. Please help. Thanks BhanuKIran -------------- next part -------------- An HTML attachment was scrubbed... URL: From nthdimensionalreality at gmail.com Wed Jun 22 22:31:35 2016 From: nthdimensionalreality at gmail.com (BhanuKiranChaluvadi) Date: Wed, 22 Jun 2016 19:31:35 -0700 (MST) Subject: [vtkusers] Error running Medical4.cxx In-Reply-To: <1811052521.4954395.1461243589627.JavaMail.yahoo@mail.yahoo.com> References: <1811052521.4954395.1461243589627.JavaMail.yahoo@mail.yahoo.com> Message-ID: <1466649095007-5738857.post@n5.nabble.com> First download VTD data fromt the given link: https://github.com/naucoin/VTKData Now try to run the medical4.exe through command prompt and you have to pass an argument(where medical data is present) In my case it looked like this: C:\Users\Bhanu\Downloads\Compressed\VTK-6.3.0\build X86 bit\bin\Release>Medical4.exe C:\Users\Bhanu\Downloads\Compressed\VTK-6.3.0\VTKData\VTKData-master\Data\headsq\quarter This is not 2 commands ...Although it looks like two line..it is single line. "Medical4.exe C:\Users\Bhanu\Downloads\Compressed\VTK-6.3.0\VTKData\VTKData-master\Data\headsq\quarter " "C:\Users\Bhanu\Downloads\Compressed\VTK-6.3.0\build X86 bit\bin\Release" this the directory where my executables are present. "C:\Users\Bhanu\Downloads\Compressed\VTK-6.3.0\VTKData\VTKData-master\Data\headsq\quarter" this is the directory where the medical data is present. -- View this message in context: http://vtk.1045678.n5.nabble.com/Error-running-Medical4-cxx-tp5737820p5738857.html Sent from the VTK - Users mailing list archive at Nabble.com. From g.bogle at auckland.ac.nz Wed Jun 22 22:41:25 2016 From: g.bogle at auckland.ac.nz (Gib Bogle) Date: Thu, 23 Jun 2016 02:41:25 +0000 Subject: [vtkusers] [FORGED] Programming in Visual studio - How to include all the required directories in Visual studio. In-Reply-To: References: Message-ID: You definitely want to use cmake. It makes the task very easy. Here is the contents of CMakeLists.txt to build a simple program: cmake_minimum_required(VERSION 2.8) PROJECT(TensorGlyph) find_package(VTK REQUIRED) include(${VTK_USE_FILE}) add_executable(TensorGlyph TensorGlyph.cxx) target_link_libraries(TensorGlyph ${VTK_LIBRARIES}) You will generate the VS project files by a command like this (in the directory that holds CMakeLists.txt): cmake -G "Visual Studio 2013" I initially resisted using cmake when I started working with ITK and VTK, but I quickly came to see the error of my ways. Everybody will give you the same advice. Gib ________________________________ From: vtkusers [vtkusers-bounces at vtk.org] on behalf of bhanu kiran chaluvadi [nthdimensionalreality at gmail.com] Sent: Thursday, 23 June 2016 2:29 p.m. To: vtkusers at vtk.org Subject: [FORGED] [vtkusers] Programming in Visual studio - How to include all the required directories in Visual studio. Hi, I am new to VTK. I am using VTK - 6.3.0 along with visual studio 2013. I don't have much knowledge in cmake. I am able to build VTK and run all the example(present in bin folder) by following some youtube tutorials. Now i want to create by own sample project. I want to include "vtkRenderer.h" in my program(for example).. As usual in visual studio -> properties i included the path where the program can find vtkRenderer.h But vtkRenderer.h itself has 4 included header files #include "vtkRenderingCoreModule.h" // For export macro #include "vtkViewport.h" #include "vtkVolumeCollection.h" // Needed for access in inline members #include "vtkActorCollection.h" And Each of the above header file has further more included header file..and this continued... I will not be able to include the paths for each header file. since they are so many(more than 50)of them Is there any way around this ? i.e. if i #include It should include all its dependency files. Please help. Thanks BhanuKIran -------------- next part -------------- An HTML attachment was scrubbed... URL: From nthdimensionalreality at gmail.com Thu Jun 23 01:53:27 2016 From: nthdimensionalreality at gmail.com (BhanuKiranChaluvadi) Date: Wed, 22 Jun 2016 22:53:27 -0700 (MST) Subject: [vtkusers] [FORGED] Programming in Visual studio - How to include all the required directories in Visual studio. In-Reply-To: References: Message-ID: <1466661207034-5738860.post@n5.nabble.com> Thank you very much Gib Bogle.. After thinking for a while i came out with one more solution.. I create a CMakeLists.txt file with simple program provided by you. And i also created myprogram.cxx file containing only my includes and an empty main function. It looked like this ////myProgram.cxx///////////////////////// #include "vtkCylinderSource.h" #include "vtkPolyDataMapper.h" #include "vtkActor.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" // etc ...what ever need for my project int main() { return 0; } /////////////////////////////////// Now i used cmake And then i open the solution file in visual studio and started editing the main function as usual. Now, i can take advantage of both cmake(i don't need the include all libraries) and Visual studio (IDE - I get suggestion while editing). Thanks again. -- View this message in context: http://vtk.1045678.n5.nabble.com/Programming-in-Visual-studio-How-to-include-all-the-required-directories-in-Visual-studio-tp5738856p5738860.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Thu Jun 23 03:07:44 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 23 Jun 2016 09:07:44 +0200 Subject: [vtkusers] Focus issue when deleting points in vtkChartXY (present in Paraview as well) Message-ID: Hi all, I'm using a vtkChartXY with a vtkCompositeTransferFunctionItem + vtkCompositeControlPointsItem pair to edit an opacity transfer function. I can select points by clicking them, and delete them with Delete on the keyboard, but only if the mouse hovers the chart item. I would have expected that if I select a point by clicking it, then the Qt widget I'm using to hold the chart would gain focus, and then when I press Delete it wouldn't matter where the mouse cursor is. The same problem can be seen in Paraview's opacity transfer function edit, which uses the same setup. Any idea how I can fix this? Thanks, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From pkorir at ebi.ac.uk Thu Jun 23 04:51:40 2016 From: pkorir at ebi.ac.uk (Paul Kibet Korir) Date: Thu, 23 Jun 2016 09:51:40 +0100 Subject: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION In-Reply-To: References: <2eab11bb-bfd0-4d5d-be54-8d1ea1bdfccb@ebi.ac.uk> Message-ID: Thanks, once again. After hours* poring through the SlicerRT source I finally found something useful. For anyone else who comes up against this problem here are some useful links to a solution: https://subversion.assembla.com/svn/slicerrt/trunk/SlicerRt/sandbox/ContourInterpolation/ http://perk.cs.queensu.ca/contents/reconstruction-surfaces-planar-contours-through-contour-interpolation http://perk.cs.queensu.ca/sites/perkd7.cs.queensu.ca/files/Sunderland2015-manuscript.pdf Paul On 17/06/2016 08:32, Andras Lasso wrote: > > Some heuristics is needed to decide which contour to > connect/terminate/branch. > > You might give a try to the DICOM-RT importer in 3D Slicer?s SlicerRT > extension (www.slicerrt.org). It manages branching, smooth > end-capping, etc. If it works for you then you can either use it as is > or just have a look at the source code and use it in your own software > (the planar contour to closed surface converter only requires VTK). > > Andras > > *From: *Paul Kibet Korir > *Sent: *June 16, 2016 12:53 > *To: *VTK Users > *Subject: *[vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION > > Hi VTK Users, > > I'm currently using vtkRuledSurfaceFilter to convert a sequence of > contours into a surface. The problem is that if two contours happen to > be on the same plane the surface filter will join them resulting in > artefacts. > > Any suggestions on how to deal with this? > > -- > With kind regards, > > *Dr. Paul K Korir, PhD* > /Scientific Programmer/ > EMBL-EBI > Main Building, A2-35, > WTGC, Hinxton, Cambridge CB10 1SD > P: +44 1223 49 44 22 > F: +44 1223 49 44 68 -- With kind regards, *Dr. Paul K Korir, PhD* /Scientific Programmer/ EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 23 05:18:00 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 23 Jun 2016 11:18:00 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-17 14:58 GMT+02:00 David Gobbi : > On Fri, Jun 17, 2016 at 6:23 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> Alright, I see. Would you mind sharing how you handle custom interactions >> with a VTK rendering, if you don't use the interactor styles? >> >> Do you directly observe events on the interactor instead? Or do you >> simply handle the Qt events directly and then perform the appropriate >> manipulation of VTK objects in response to those? >> >> I'm very interested in if you use some event forwarding code similar to >> that in QVTKRenderWindowInteractor, or if you are simply not bothering with >> feeding input events from Qt to VTK, and handling all input on the Qt side >> of the fence so to speak. >> > > I have a subclass of QWidget that receives the Qt events and converts them > to my own events (which are similar to Qt events but also carry useful VTK > information). Those events are dispatched to my interaction bindings. > I've always done interaction in VTK this way. Neither the > vtkRenderWindowInteractor or QVTKWidget play any role. > Just a final small question about your approach if that's okay: You say here that the vtkRenderWindowInteractor does not play any role, but don't you use the interactor for some things, such as finding the poked renderer (vtkRenderWindowInteractor::FindPokedRenderer) ? Other things as well? Up until now I've based my custom interactions on vtkInteractorStyleUser, so have made use of the interactor/interactor style system. But I think I'm finally succumbing to the idea of building a system more like yours, especially as I've found that vtkInteractorStyleUser does not support wheel events (recently added that). But I'm interested in if you ever make use of the interactor/interactor style system? E.g. say you would like to provide interaction with an vtkChartXY, would you make use of the builtin interaction styles that VTK has for that, or build your own based on the mechanism you've described here? Do you use your mechanism only when you have a need for highly custom interaction behavior? Thanks in advance for your insight! Elvis > > - David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From softplanner at gmail.com Thu Jun 23 06:46:04 2016 From: softplanner at gmail.com (Muhammad Jawad) Date: Thu, 23 Jun 2016 12:46:04 +0200 Subject: [vtkusers] Add vtkActor in vtkImageViewer2 Message-ID: Dear Vtk Users, I want to show vtkActor in front of the image in vtkImageViewer2 but it is showing behind the image. Does anybody know how to get vtkActor on the top of the image ? Regards, Muhammad Jawad -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Thu Jun 23 06:30:40 2016 From: lasso at queensu.ca (Andras Lasso) Date: Thu, 23 Jun 2016 10:30:40 +0000 Subject: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION In-Reply-To: References: <2eab11bb-bfd0-4d5d-be54-8d1ea1bdfccb@ebi.ac.uk> Message-ID: Hi Paul, You can contact the authors (Kyle Sunderland and Csaba Pinter) directly - they would be happy to help you in using this method. Note that the code that you've found was just a python prototype. More advanced and maintained C++ implementation is available here: https://app.assembla.com/spaces/slicerrt/subversion/source/HEAD/trunk/SlicerRt/src/SegmentationCore/vtkPlanarContourToClosedSurfaceConversionRule.cxx?_format=raw Andras From: Paul Kibet Korir [mailto:pkorir at ebi.ac.uk] Sent: June 23, 2016 10:52 AM To: Andras Lasso ; VTK Users Subject: Re: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION Thanks, once again. After hours* poring through the SlicerRT source I finally found something useful. For anyone else who comes up against this problem here are some useful links to a solution: https://subversion.assembla.com/svn/slicerrt/trunk/SlicerRt/sandbox/ContourInterpolation/ http://perk.cs.queensu.ca/contents/reconstruction-surfaces-planar-contours-through-contour-interpolation http://perk.cs.queensu.ca/sites/perkd7.cs.queensu.ca/files/Sunderland2015-manuscript.pdf Paul On 17/06/2016 08:32, Andras Lasso wrote: Some heuristics is needed to decide which contour to connect/terminate/branch. You might give a try to the DICOM-RT importer in 3D Slicer's SlicerRT extension (www.slicerrt.org). It manages branching, smooth end-capping, etc. If it works for you then you can either use it as is or just have a look at the source code and use it in your own software (the planar contour to closed surface converter only requires VTK). Andras From: Paul Kibet Korir Sent: June 16, 2016 12:53 To: VTK Users Subject: [vtkusers] CO-PLANAR CONTOURS AND SURFACE GENERATION Hi VTK Users, I'm currently using vtkRuledSurfaceFilter to convert a sequence of contours into a surface. The problem is that if two contours happen to be on the same plane the surface filter will join them resulting in artefacts. Any suggestions on how to deal with this? -- With kind regards, Dr. Paul K Korir, PhD Scientific Programmer EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -- With kind regards, Dr. Paul K Korir, PhD Scientific Programmer EMBL-EBI Main Building, A2-35, WTGC, Hinxton, Cambridge CB10 1SD P: +44 1223 49 44 22 F: +44 1223 49 44 68 -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Thu Jun 23 08:06:28 2016 From: david.lonie at kitware.com (David Lonie) Date: Thu, 23 Jun 2016 08:06:28 -0400 Subject: [vtkusers] Crash when exporting to EPS In-Reply-To: References: Message-ID: Hi Patricio, On Wed, Jun 22, 2016 at 5:34 PM, Patricio Palma C. wrote: > Do I have to initializate some module before use the vtkGLS2PSExporter > class? > Yes. This was a recent change -- you'll now need to link the vtkIOExportOpenGL module (or vtkIOExportOpenGL2 on the new backend) to load the actual GL2PS exporter's implementation. HTH, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From flaviu2 at yahoo.com Thu Jun 23 08:11:33 2016 From: flaviu2 at yahoo.com (Flaviu2) Date: Thu, 23 Jun 2016 12:11:33 +0000 (UTC) Subject: [vtkusers] CT 1.25 mm References: <1475443770.222059.1466683893163.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <1475443770.222059.1466683893163.JavaMail.yahoo@mail.yahoo.com> Hi all of you. I have ReadDICOMSeries project, taken from?here (from C++ VTK Wiki examples). | | | | | | | | | | | VTK/Examples/Cxx/IO/ReadDICOMSeries - KitwarePublic | | | | Work ok. But when I read a CT serie, with 778 slices, 1.25 mm, I get some slices darker then others ... I mean, first slice are normal, second slices are darker, and seem to be diference between the previous ... third are normal, the fourth are darker, etc. ... Changing the slices, is looks like the image are flickering ... I suspect that this serie has slices more thinner than normal one (1.255 mm), and I see a intermediar slice ... how can I overcome this issue ? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu.westphal at kitware.com Thu Jun 23 08:15:48 2016 From: mathieu.westphal at kitware.com (Mathieu Westphal) Date: Thu, 23 Jun 2016 14:15:48 +0200 Subject: [vtkusers] [vtk-developers] VTK bug hackathon In-Reply-To: References: <20160620213606.GA1266@megas.kitware.com> <20160621131307.GA16121@megas.kitware.com> <57694C6A.1050702@kitware.com> Message-ID: Joachim and I will also be remotelly present ! Mathieu Westphal On Tue, Jun 21, 2016 at 5:39 PM, David E DeMarle wrote: > I'd like to add review of merge requests to the agenda. > On Jun 21, 2016 4:54 PM, "Berk Geveci" wrote: > >> Brad reminded me that Mantis no longer allow new account registration >> (due to spam issues) so that may be a potential issue with using it. We can >> still make it work though; many of us have accounts anyway. I am fine with >> what others decide. I just didn't want to put undue pressure on Brad & Ben >> to make the transition quickly. >> >> On Tue, Jun 21, 2016 at 10:17 AM, Brad King >> wrote: >> >>> On 06/21/2016 09:44 AM, David Gobbi wrote: >>> > The real problem is that issues ported from Mantis have no actual >>> > description of the bug, instead they have a link to Mantis. >>> >>> That was a choice we made for CMake because the Mantis issues are >>> widely cited in the wild so we will keep it up permanently as a >>> reference. Since we're keeping it up anyway we might as well avoid >>> duplication. Also, the Mantis CSV export does not include the >>> descriptions so it will take a bit more work to do the migration >>> with them. >>> >>> For VTK and ParaView we can look at including the descriptions >>> if necessary. >>> >>> > This slows down the workflow. >>> > >>> > Correct me if I'm wrong, but with the ported issues we would: >>> > 1) locate the issue on gitlab, 2) click the provided link to >>> > see the bug description on mantis, 3) return to gitlab to >>> > modify the status. >>> >>> Yes. I was concerned about that at first for CMake but it has >>> been surprisingly easy to work with the dual pages since the >>> migration (e.g. via browser tabs). >>> >>> -Brad >>> >>> >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Search the list archives at: http://markmail.org/search/?q=vtk-developers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtk-developers > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 23 08:52:02 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 23 Jun 2016 14:52:02 +0200 Subject: [vtkusers] Enable sample buffers on QGLWidget-based VTK widget from Python Message-ID: This is slightly off-topic, but here it goes: I have my own VTKWidget, similar to QVTKRenderWindowInteractor, which is based on QGLWidget. I wanted to enable sample buffers / samples on it, so that lines et.c. drawn by VTK are anti-aliased. I thought I could do glFormat = self.format() glFormat.setSampleBuffers(True) glFormat.setSamples(8) self.setFormat(glFormat) but it turns out setFormat is made obsolete in Qt 5, and PyQt does not wrap obsolete methods. Anyone know of some other way of achieving the same thing? Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From grothausmann.roman at mh-hannover.de Thu Jun 23 08:59:08 2016 From: grothausmann.roman at mh-hannover.de (Grothausmann, Roman Dr.) Date: Thu, 23 Jun 2016 14:59:08 +0200 Subject: [vtkusers] Bug or feature: incomplete table returned by vtkDataObjectToTable for arrays of varying length In-Reply-To: <575FA56D.7030801@mh-hannover.de> References: <548070F4.4070508@gmx.net> <5742E8E3.40800@mh-hannover.de> <575BD32D.1080309@mh-hannover.de> <575FA56D.7030801@mh-hannover.de> Message-ID: <576BDD1C.5050205@mh-hannover.de> I figured out, that it is possible to force a complete output by setting NumberOfTuples to the maximum found but the output then is only correct for those arrays who already had this length: https://github.com/romangrothausmann/VTK-CLIs/commit/51bbe0f03734507d62743e5ee56ad57003573372 Instead of solving this issue I resorted to a specific vtpFD2csv: https://github.com/romangrothausmann/VTK-CLIs/blob/master/vtpFD2csv.cxx On 14/06/16 08:34, Grothausmann, Roman Dr. wrote: > Before I start to write my own CSV export, iterating over each array > individually, I'm wondering whether the incomplete table returned by > vtkDataObjectToTable for arrays of varying length is intended? > > On 11/06/16 11:00, Grothausmann, Roman Dr. wrote: >> Dear mailing list members, >> >> >> I'm trying to export vtp-FieldData with arrays of varying length (as in the >> attached VTP) to CSV: >> https://github.com/romangrothausmann/VTK-CLIs/blob/master/vtp2csv.cxx >> >> However, it seems the vtkTable returned by vtkDataObjectToTable only holds as >> many rows as the first encountered array has. I had a look at >> vtkDataSetAttributes.cxx and vtkFieldData.cxx but their ShallowCopy do not use >> an iterator whose length I could set. >> How can I export as many rows as the longest array holds, as e.g. Paraview's >> CSV-exporter does? >> >> Any help or hints are very much appreciated >> Roman >> >> >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> > -- Dr. Roman Grothausmann Tomographie und Digitale Bildverarbeitung Tomography and Digital Image Analysis Institut f?r Funktionelle und Angewandte Anatomie, OE 4120 Medizinische Hochschule Hannover Carl-Neuberg-Str. 1 D-30625 Hannover Tel. +49 511 532-2900 From myk321 at gmail.com Thu Jun 23 09:26:05 2016 From: myk321 at gmail.com (Michael Arnold) Date: Thu, 23 Jun 2016 21:26:05 +0800 Subject: [vtkusers] vtkCubeAxesActor positions text labels incorrectly on axis Message-ID: Problem: for axis labels created using vtkCubeAxesActor, if we have more than 10 text labels, the labels and the data don't line-up, because the labels are positioned incorrectly on the axis. What are we Getting in more Detail: (a) If we have 9 data points (<10) we get 9 label points, with the last label at the end of the axis. So the labels can be 1,2,3,4,5,6,7,8,9, which lines-up nicely with the data: all is good in the world. (b) If we have 10 data points, we get get 6 labels points with the last label one at the end of the axis. We compute a label skip factor of 2. We start at the beginning of the axis. We label 1,3,5,7,9,11 <- what category is this last label?? We only have 10 data points! So the last data label does not line-up with its data. (c) If we have 11 data points, we again get 6 label points with the last label positioned a short distance back from the end of the axis. Again we compute a label skip factor of 2. We begin to label at the beginning of the axis. So we get 1,3,5,7,9,11. Ok, because we had 11 data-points, but now we land-up with the label for the last data element being back from the end of the axis i.e. the data label does not line-up with its data. What we want: (a) VTK seems to make a quite reasonable assumption to limit the number of labels to less than 10, so lets stick with that. (b) VTK works fine with data sets with 9 or fewer elements, so lets focus on data-sets with 10 or more data-points. (c) We need to handle data-sets with an even count of elements slightly differently from data-sets with an odd count of elements. (For a more generic handling this would be if the count of the elements is divisible by the skip factor, but for the moment lets stick to a skip factor of 2 and thus even or odd element counts). (d) For a data-set with an odd count of elements (lets say 11) we can easily imagine the handling to be: Smallest at the start (e.g. 1) Biggest at the end (eg. 11) Then fill-in the labels using the skip factor (2 in this case), so we get something like 1,3,5,7,9,11 (e) For a data-set with an even count of elements (lets say 10), we need to have a gap between the last label and the end of the axis. The end of the axis seems most logical place for this gap, so the last label point is back a bit from the end of the axis. So: Smallest at the start (e.g. 1) Then fill in the labels using the skip factor, so something like 1,3,5,7,9 and we happily land-up with a label of 9 being a bit back from the end of the axis. So what was the difference between what we want and what we are getting? The problem is not about the calculation of the number of labels - that is fine. The problem is the positioning of the labels on the axis - is the last label at the end of the axis or bit back from the end? Today, for data-sets with an even number of elements, we are getting the last label at the end of the axis. This is incorrect because for an even number of elements, we want the last label to be positioned back from the end of axis. Today, for data-sets with odd number of elements, we are getting the last label positioned with a gap before the end of the axis. Again this is incorrect, because the label should be positioned at the end of the axis. Questions: I'm using an old'ish version of VTK 6.1 - has this issue been fixed in a newer version? Am I misunderstanding something or can I raise a defect for this? Some Code: vtkSmartPointer cubeAxesActor = vtkSmartPointer::New(); cubeAxesActor->SetBounds(outputPolyData->GetBounds()); cubeAxesActor->SetCamera(Renderer->GetActiveCamera()); cubeAxesActor->GetTitleTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White cubeAxesActor->GetLabelTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White cubeAxesActor->SetXTitle("X-Axis"); cubeAxesActor->GetXAxesGridlinesProperty()->SetColor(1.0, 1.0, 1.0); //White cubeAxesActor->DrawXGridlinesOn(); cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST); cubeAxesActor->SetFlyModeToOuterEdges(); //Place the axes on the outer edges of the cube //Set the labels on the x-axis vtkSmartPointer XAxisLabels = vtkSmartPointer::New(); std::vector Labels = ResultsServer->GetXLabels(); //Get a list of axis labels if (!Labels.empty()) { int32_t SkipFactor = (Labels.size() / 10) + 1; int32_t Counter = 0; //Evenly divisble for (auto LabelsIt = std::begin(Labels); LabelsIt != std::end(Labels); ++LabelsIt) if (Counter++ % SkipFactor == 0) XAxisLabels->InsertNextValue(LabelsIt->c_str()); cubeAxesActor->SetXAxisRange(0.0, Labels.size() * 1.0); cubeAxesActor->GetLabelTextProperty(0)->SetFontSize(20); cubeAxesActor->GetLabelTextProperty(0)->SetOrientation(90.0); cubeAxesActor->SetAxisLabels(0, XAxisLabels); Labels.clear(); } Kind regards, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From enzo.matsumiya at gmail.com Thu Jun 23 09:34:49 2016 From: enzo.matsumiya at gmail.com (Enzo Matsumiya) Date: Thu, 23 Jun 2016 10:34:49 -0300 Subject: [vtkusers] Improve image quality when using vtkResliceCursorWidget In-Reply-To: <5A6ABB21-47A2-4231-A159-BF561FEAA4D7@gmail.com> References: <21A45DBE-E359-4BA5-B467-9231DA42BA9B@gmail.com> <5A6ABB21-47A2-4231-A159-BF561FEAA4D7@gmail.com> Message-ID: Hi, I got the result I wanted (quality-wise) adding a vtkImageSincInterpolator to the image reslice within vtkResliceCursorRepresentation. I think the default was using the nearest neighbor algorithm. But now I have 2 problems: - The performance decrease was huge. Is there any way to improve that? - Here are 2 images showing my second issue. There are artifacts *only* in orthogonal slices, and also only in coronal and sagittal. The artifacts are gone when I oblique reslice: http://oi65.tinypic.com/dcga2x.jpg - with artifacts http://oi64.tinypic.com/30cuoug.jpg - oblique reslicing, without artifacts I'm guessing it's a bug in the interpolator because it really looks like some mathematical bug, but I could be wrong of course. Can anyone help me out? > On Jun 22, 2016, at 12:24, Enzo Matsumiya wrote: > > Hi Sankhesh, > > Thanks for the reply. > > By quality I mean that the first image looks crispy, while the second one looks very smooth. > But now that you said, I will see if I can find any data type inconsistency accross my code. > > ManageWindowLevel is enabled on vtkResliceCursorWidget. > > > Thanks again, > > Enzo > > >> On Jun 22, 2016, at 11:59, Sankhesh Jhaveri > wrote: >> >> Enzo, >> >> What do you mean by quality? >> >> Looking at the two images, the resolution looks the same to me. I see there is a difference in the range of pixel values between the two images. This could either be due to the data type differences in the output image or actual data value differences. Do you have ManageWindowLevel enabled for vtkResliceCursorWidget? >> >> Sankhesh >> >> >> >> On Wed, Jun 22, 2016 at 10:49 AM, Enzo Matsumiya > wrote: >> Hi, >> >> I'm using vtkResliceCursorWidget for oblique reslicing on a CT set. >> But I'm getting really bad image quality. Here is an example from my app: >> >> http://oi68.tinypic.com/1z55cop.jpg >> >> And here is one (although non-oblique) from other software: >> >> http://oi68.tinypic.com/2lidi6p.jpg >> >> I would like to know if there's a way to improve the quality on my app. >> >> >> Thanks >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sankhesh.jhaveri at kitware.com Thu Jun 23 09:40:37 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Thu, 23 Jun 2016 09:40:37 -0400 Subject: [vtkusers] Enable sample buffers on QGLWidget-based VTK widget from Python In-Reply-To: References: Message-ID: Elvis, According to Qt documentation[1], QGLWidget is obsolete in Qt 5 and they suggest using QOpenGLWidget (which has setFormat API). ?[1] http://doc.qt.io/qt-5/qglwidget.html ? Sankhesh On Thu, Jun 23, 2016 at 8:52 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > This is slightly off-topic, but here it goes: I have my own VTKWidget, > similar to QVTKRenderWindowInteractor, which is based on QGLWidget. I > wanted to enable sample buffers / samples on it, so that lines et.c. drawn > by VTK are anti-aliased. > > I thought I could do > > glFormat = self.format() > glFormat.setSampleBuffers(True) > glFormat.setSamples(8) > self.setFormat(glFormat) > > but it turns out setFormat is made obsolete in Qt 5, and PyQt does not > wrap obsolete methods. > > Anyone know of some other way of achieving the same thing? > > Elvis > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 23 10:21:12 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 23 Jun 2016 16:21:12 +0200 Subject: [vtkusers] Enable sample buffers on QGLWidget-based VTK widget from Python In-Reply-To: References: Message-ID: 2016-06-23 15:40 GMT+02:00 Sankhesh Jhaveri : > Elvis, > > According to Qt documentation[1], QGLWidget is obsolete in Qt 5 and they > suggest using QOpenGLWidget (which has setFormat API). > Yes, I know, but I've based my class on QVTKRenderWindowInteractor, which still uses QGLWidget. So I was looking for some alternative way of doing it with QGLWidget. Howeve, I've now begun looking into porting my class to QOpenGLWidget, taking inspiration from QVTKWidget2 and this SO answer: http://stackoverflow.com/a/26946040/252857 But I've hit some snags (will make another post about it). Elvis > > ?[1] http://doc.qt.io/qt-5/qglwidget.html > ? > > Sankhesh > > > On Thu, Jun 23, 2016 at 8:52 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> This is slightly off-topic, but here it goes: I have my own VTKWidget, >> similar to QVTKRenderWindowInteractor, which is based on QGLWidget. I >> wanted to enable sample buffers / samples on it, so that lines et.c. drawn >> by VTK are anti-aliased. >> >> I thought I could do >> >> glFormat = self.format() >> glFormat.setSampleBuffers(True) >> glFormat.setSamples(8) >> self.setFormat(glFormat) >> >> but it turns out setFormat is made obsolete in Qt 5, and PyQt does not >> wrap obsolete methods. >> >> Anyone know of some other way of achieving the same thing? >> >> Elvis >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Thu Jun 23 10:25:41 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 23 Jun 2016 08:25:41 -0600 Subject: [vtkusers] Improve image quality when using vtkResliceCursorWidget In-Reply-To: References: <21A45DBE-E359-4BA5-B467-9231DA42BA9B@gmail.com> <5A6ABB21-47A2-4231-A159-BF561FEAA4D7@gmail.com> Message-ID: Hi Enzo, The artifact might be due to this bug, which was recently fixed in the master branch: https://gitlab.kitware.com/vtk/vtk/merge_requests/1279 Cubic interpolation is much faster than Sinc. - David On Thu, Jun 23, 2016 at 7:34 AM, Enzo Matsumiya wrote: > Hi, > > I got the result I wanted (quality-wise) adding a vtkImageSincInterpolator > to the image reslice within vtkResliceCursorRepresentation. I think the > default was using the nearest neighbor algorithm. > > But now I have 2 problems: > > - The performance decrease was huge. Is there any way to improve that? > - Here are 2 images showing my second issue. There are artifacts *only* in > orthogonal slices, and also only in coronal and sagittal. The artifacts are > gone when I oblique reslice: > > http://oi65.tinypic.com/dcga2x.jpg - with artifacts > http://oi64.tinypic.com/30cuoug.jpg - oblique reslicing, without artifacts > > I'm guessing it's a bug in the interpolator because it really looks like > some mathematical bug, but I could be wrong of course. > > > Can anyone help me out? > > > On Jun 22, 2016, at 12:24, Enzo Matsumiya > wrote: > > Hi Sankhesh, > > Thanks for the reply. > > By quality I mean that the first image looks crispy, while the second one > looks very smooth. > But now that you said, I will see if I can find any data type > inconsistency accross my code. > > ManageWindowLevel is enabled on vtkResliceCursorWidget. > > > Thanks again, > > Enzo > > > On Jun 22, 2016, at 11:59, Sankhesh Jhaveri > wrote: > > Enzo, > > What do you mean by quality? > > Looking at the two images, the resolution looks the same to me. I see > there is a difference in the range of pixel values between the two images. > This could either be due to the data type differences in the output image > or actual data value differences. Do you have ManageWindowLevel enabled for > vtkResliceCursorWidget? > > Sankhesh > > > > On Wed, Jun 22, 2016 at 10:49 AM, Enzo Matsumiya > wrote: > >> Hi, >> >> I'm using vtkResliceCursorWidget for oblique reslicing on a CT set. >> But I'm getting really bad image quality. Here is an example from my app: >> >> http://oi68.tinypic.com/1z55cop.jpg >> >> And here is one (although non-oblique) from other software: >> >> http://oi68.tinypic.com/2lidi6p.jpg >> >> I would like to know if there's a way to improve the quality on my app. >> >> >> Thanks >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 23 10:26:35 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 23 Jun 2016 16:26:35 +0200 Subject: [vtkusers] Handling "out" pointer callData parameters in events from Python Message-ID: Hi all, I'm trying to make a QOpenGLWidget based VTK widget, and I'm taking inspiration from QVTKWidget2 and this stack overflow answer: http://stackoverflow.com/a/26946040/252857 which provides a QVTKWidget3 based on QOpenGLWidget. Given how QVTKWidget2 handles IsCurrentEvent, IsDirectEvent and SupportsOpenGLEvent from the render window [1], e.g: void QVTKWidget2::IsCurrent(vtkObject*, unsigned long, void*, void* call_data) { bool* ptr = reinterpret_cast(call_data); *ptr = QGLContext::currentContext() == this->context(); } Is there any way to do this operation from Python? I know there's some support for callData, but how would I effect a write to the memory pointed at by the call_data parameter like this from Python? If it's not possible, am I completely doomed in trying to make a Python class similar to QVTKWidget2? Many thanks in advance, Elvis [1] https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/QtOpenGL/QVTKWidget2.cxx#L458-474 -------------- next part -------------- An HTML attachment was scrubbed... URL: From luis.vieira at vektore.com Thu Jun 23 10:27:58 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Thu, 23 Jun 2016 10:27:58 -0400 Subject: [vtkusers] vtkThresholdTable - VTK 7.0 Message-ID: <1363e01d1cd5b$7151f690$53f5e3b0$@vektore.com> Hello guys, Any ideas about how to build a vtkThresholdTable with characters (e.g L,P,C,N) representing MinValue/ MaxValue? I have a python version but in C++ is returning NULL/empty. Following my code and the *.CSV I am trying to filter (simulate 3 distinct tables L=line Table; P=plane Table; C=cone Table) Thank you very much. Python # Set up filters for extracting feature types self.thresholders = {} for threshVals in [('line', 'K', 'M'), ('plane', 'O','Q'), ('cone', 'B', 'D')]: tt = vtkThresholdTable() tt.SetInputConnection(self.rdr.GetOutputPort()) tt.SetInputArrayToProcess(0, 0, 0, vtkDataObject.FIELD_ASSOCIATION_ROWS, 'Vector Type') tt.SetMinValue(vtkVariant(threshVals[1])) tt.SetMaxValue(vtkVariant(threshVals[2])) tt.SetMode(vtkThresholdTable.ACCEPT_BETWEEN) self.thresholders[threshVals[0]] = tt C++ const char* tnames [] = { "line", "plane", "cone" }; char tminmax [] = { 'K', 'M', 'O', 'Q', 'B', 'D' }; unsigned int numThresh = sizeof(tnames) / sizeof(tnames[0]); // == 3 for (unsigned ti = 0; ti < numThresh; ++ti) { thHoldTable = vtkSmartPointer::New(); thHoldTable->SetInputConnection(readerStructureData->GetOutputPort()); thHoldTable->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_ROWS, "Vector Type"); thHoldTable->SetMinValue(vtkVariant(tminmax[2*ti])); thHoldTable->SetMaxValue(vtkVariant(tminmax[2*ti+1])); thHoldTable->SetMode(vtkThresholdTable::ACCEPT_BETWEEN); thHoldTable->Update(); thresholders[tnames[ti]] = thHoldTable; } *.csv FElemID Structural Type Vector Type Depth Easting Northing Elevation SiteID Borehole_Dip Borehole_DipDirection CA Structure_Dip Structure_DipDirection Channel 1 Channel 2 Channel 3 1 Ctt P 0 0 0 2 FSEX-41 -47 137.2 60 75 1 1 1 1 Ctt P 0 0 0 0 FSEX-41 -47 137.2 0 0 1 1 1 2 Ctt L 1 1 1 2 FSEX-42 -46 135.9 0 0 7 1 1 2 Ctt L 1 1 1 1 FSEX-42 -46 135.9 45 0 7 1 1 2 Ctt L 1 1 1 0 FSEX-42 -46 135.9 60 45 7 1 1 3 Ctt C 2 2 0 2 FSEX-47 -45 30 5 1 1 1 3 Ctt C 2 2 0 1 FSEX-47 -45 30 45 1 1 1 3 Ctt C 2 2 0 0 FSEX-47 -45 30 85 1 1 1 Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From luis.vieira at vektore.com Thu Jun 23 10:39:12 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Thu, 23 Jun 2016 10:39:12 -0400 Subject: [vtkusers] vtkTable Filter By Column Message-ID: <13db901d1cd5d$02d9b610$088d2230$@vektore.com> Hello Guys Is possible to filter vtkTable by column? I have the following data within a vtkTable from a *.CSV file and I want to share this in three distinct tables as L=line table; P=plane table and C=cone table. I had posted here about vtkThresholdTable and the answers still not come. Following is my *CSV, and the referred column is Vector Type. I appreciate any help. FElemID Structural Type Vector Type Depth Easting Northing Elevation SiteID Borehole_Dip Borehole_DipDirection CA Structure_Dip Structure_DipDirection Channel 1 Channel 2 Channel 3 1 Ctt P 0 0 0 2 FSEX-41 -47 137.2 60 75 1 1 1 1 Ctt P 0 0 0 0 FSEX-41 -47 137.2 0 0 1 1 1 2 Ctt L 1 1 1 2 FSEX-42 -46 135.9 0 0 7 1 1 2 Ctt L 1 1 1 1 FSEX-42 -46 135.9 45 0 7 1 1 2 Ctt L 1 1 1 0 FSEX-42 -46 135.9 60 45 7 1 1 3 Ctt C 2 2 0 2 FSEX-47 -45 30 5 1 1 1 3 Ctt C 2 2 0 1 FSEX-47 -45 30 45 1 1 1 3 Ctt C 2 2 0 0 FSEX-47 -45 30 85 1 1 1 Luis Vieira, Toronto Consultant, Software Engineer Vektore Exploration Consulting Corporation luis.vieira at vektore.com www.vektore.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sayala at ni.com Thu Jun 23 10:42:20 2016 From: sayala at ni.com (sreeram) Date: Thu, 23 Jun 2016 07:42:20 -0700 (MST) Subject: [vtkusers] number of points in the output increases 10 fold with use of vtkNonMergingPointLocator in vtkClipDataSet filter Message-ID: <1466692940096-5738882.post@n5.nabble.com> I am using vtkNonMergingPointLoactor with vtkClipDataSet filter. This is to prevent the filter stripping the duplicate nodes I have added. Here is the code snippet. pPlane->SetNormal(&vdNormal[0]); pPlane->SetOrigin(&vdOrigin[0]); auto npts = pInput->GetDS()->GetNumberOfPoints(); auto pClipper = vtkSmartPointer::New(); pClipper->SetClipFunction(pPlane); pClipper->SetInputData(pInput->GetDS()); auto locator = vtkSmartPointer::New(); pClipper->SetLocator(locator); pClipper->Update(); pOutput->Set(pClipper->GetOutput()); auto npts2 = pOutput->GetDS()->GetNumberOfPoints(); For a particular dataset, the number of points in the input dataset is 1546. Without using locator, the output contains 1488 points. The filter is removing 58 duplicate nodes I have added. These nodes are required for rendering purpose. Using the locator (vtkNonMergingPointLocator), the output contains 26552 points. I expect to see 1546 points in the output with sue of vtkNonMergingPointLocator. Can anyone tell what is wrong. thanks, Sreeram -- View this message in context: http://vtk.1045678.n5.nabble.com/number-of-points-in-the-output-increases-10-fold-with-use-of-vtkNonMergingPointLocator-in-vtkClipDatr-tp5738882.html Sent from the VTK - Users mailing list archive at Nabble.com. From enzo.matsumiya at gmail.com Thu Jun 23 11:18:50 2016 From: enzo.matsumiya at gmail.com (Enzo Matsumiya) Date: Thu, 23 Jun 2016 12:18:50 -0300 Subject: [vtkusers] Improve image quality when using vtkResliceCursorWidget In-Reply-To: References: <21A45DBE-E359-4BA5-B467-9231DA42BA9B@gmail.com> <5A6ABB21-47A2-4231-A159-BF561FEAA4D7@gmail.com> Message-ID: Hi David. Cubic interpolation did it. I'll take a look into Sinc again in the future. Thank you. > On Jun 23, 2016, at 11:25, David Gobbi wrote: > > Hi Enzo, > > The artifact might be due to this bug, which was recently fixed in the master branch: > > https://gitlab.kitware.com/vtk/vtk/merge_requests/1279 > > Cubic interpolation is much faster than Sinc. > > - David > > > > > On Thu, Jun 23, 2016 at 7:34 AM, Enzo Matsumiya > wrote: > Hi, > > I got the result I wanted (quality-wise) adding a vtkImageSincInterpolator to the image reslice within vtkResliceCursorRepresentation. I think the default was using the nearest neighbor algorithm. > > But now I have 2 problems: > > - The performance decrease was huge. Is there any way to improve that? > - Here are 2 images showing my second issue. There are artifacts *only* in orthogonal slices, and also only in coronal and sagittal. The artifacts are gone when I oblique reslice: > > http://oi65.tinypic.com/dcga2x.jpg - with artifacts > http://oi64.tinypic.com/30cuoug.jpg - oblique reslicing, without artifacts > > I'm guessing it's a bug in the interpolator because it really looks like some mathematical bug, but I could be wrong of course. > > > Can anyone help me out? > > >> On Jun 22, 2016, at 12:24, Enzo Matsumiya > wrote: >> >> Hi Sankhesh, >> >> Thanks for the reply. >> >> By quality I mean that the first image looks crispy, while the second one looks very smooth. >> But now that you said, I will see if I can find any data type inconsistency accross my code. >> >> ManageWindowLevel is enabled on vtkResliceCursorWidget. >> >> >> Thanks again, >> >> Enzo >> >> >>> On Jun 22, 2016, at 11:59, Sankhesh Jhaveri > wrote: >>> >>> Enzo, >>> >>> What do you mean by quality? >>> >>> Looking at the two images, the resolution looks the same to me. I see there is a difference in the range of pixel values between the two images. This could either be due to the data type differences in the output image or actual data value differences. Do you have ManageWindowLevel enabled for vtkResliceCursorWidget? >>> >>> Sankhesh >>> >>> >>> >>> On Wed, Jun 22, 2016 at 10:49 AM, Enzo Matsumiya > wrote: >>> Hi, >>> >>> I'm using vtkResliceCursorWidget for oblique reslicing on a CT set. >>> But I'm getting really bad image quality. Here is an example from my app: >>> >>> http://oi68.tinypic.com/1z55cop.jpg >>> >>> And here is one (although non-oblique) from other software: >>> >>> http://oi68.tinypic.com/2lidi6p.jpg >>> >>> I would like to know if there's a way to improve the quality on my app. >>> >>> >>> Thanks >>> >>> _______________________________________________ >>> 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 >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/vtkusers >>> >>> >> > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bill.lorensen at gmail.com Thu Jun 23 12:04:25 2016 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Thu, 23 Jun 2016 12:04:25 -0400 Subject: [vtkusers] number of points in the output increases 10 fold with use of vtkNonMergingPointLocator in vtkClipDataSet filter In-Reply-To: <1466692940096-5738882.post@n5.nabble.com> References: <1466692940096-5738882.post@n5.nabble.com> Message-ID: The clip algorithm will process each polygon inside the clip region and produce ol\ne point per polygon vertex. Without merging, each polygon will produce N point, where N is the number of vertices in the polygon. On Thu, Jun 23, 2016 at 10:42 AM, sreeram wrote: > I am using vtkNonMergingPointLoactor with vtkClipDataSet filter. This is to > prevent the filter stripping the duplicate nodes I have added. Here is the > code snippet. > > pPlane->SetNormal(&vdNormal[0]); > pPlane->SetOrigin(&vdOrigin[0]); > > auto npts = pInput->GetDS()->GetNumberOfPoints(); > auto pClipper = vtkSmartPointer::New(); > pClipper->SetClipFunction(pPlane); > pClipper->SetInputData(pInput->GetDS()); > auto locator = vtkSmartPointer::New(); > pClipper->SetLocator(locator); > pClipper->Update(); > pOutput->Set(pClipper->GetOutput()); > auto npts2 = pOutput->GetDS()->GetNumberOfPoints(); > > For a particular dataset, the number of points in the input dataset is 1546. > Without using locator, the output contains 1488 points. > > The filter is removing 58 duplicate nodes I have added. These nodes are > required for rendering purpose. > > Using the locator (vtkNonMergingPointLocator), the output contains 26552 > points. > > I expect to see 1546 points in the output with sue of > vtkNonMergingPointLocator. > > Can anyone tell what is wrong. > > thanks, > > Sreeram > > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/number-of-points-in-the-output-increases-10-fold-with-use-of-vtkNonMergingPointLocator-in-vtkClipDatr-tp5738882.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- Unpaid intern in BillsBasement at noware dot com From patriciop at gmail.com Thu Jun 23 12:14:53 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Thu, 23 Jun 2016 12:14:53 -0400 Subject: [vtkusers] Issues with QVTKWidget with VTK 7.1 (devel) OpenGL1 Message-ID: Hello Expert I'm using a development snapshot of VTK 7.1 with OpenGL1. I'm having a couple of issues when using QVTKWidget. When the application is executed on a machine with GPU, the QVTKWidget seems transparent showing the structure mixed with the background and the terminal text :). The same application executed with on a machine with no GPU using Mesa 7 shows the structure like made of broken glass (it seems that the back side of some cells are reversed). Is this a know issue? Do you know if it's possible to solve it and avoid the transparency on QVTKWidget and the issues with Mesa? Regards -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.boeckel at kitware.com Thu Jun 23 15:59:10 2016 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 23 Jun 2016 15:59:10 -0400 Subject: [vtkusers] Issues with QVTKWidget with VTK 7.1 (devel) OpenGL1 In-Reply-To: References: Message-ID: <20160623195910.GA19779@megas.kitware.com> On Thu, Jun 23, 2016 at 12:14:53 -0400, Patricio Palma C. wrote: > Is this a know issue? Do you know if it's possible to solve it and avoid > the transparency on QVTKWidget and the issues with Mesa? Could you try QVTKWidget2? Does it behave better? --Ben From patriciop at gmail.com Thu Jun 23 16:13:33 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Thu, 23 Jun 2016 16:13:33 -0400 Subject: [vtkusers] Issues with QVTKWidget with VTK 7.1 (devel) OpenGL1 In-Reply-To: <20160623195910.GA19779@megas.kitware.com> References: <20160623195910.GA19779@megas.kitware.com> Message-ID: Hi Ben Thanks you for the response. I've managed to solve this by moving to a newer VTK snapshot, that solved the transparency issue. The broken glass looking was solved by stop using the system provided Mesa (10.1.2) and using an old Mesa 7 Regards Patricio On Thu, Jun 23, 2016 at 3:59 PM, Ben Boeckel wrote: > On Thu, Jun 23, 2016 at 12:14:53 -0400, Patricio Palma C. wrote: > > Is this a know issue? Do you know if it's possible to solve it and avoid > > the transparency on QVTKWidget and the issues with Mesa? > > Could you try QVTKWidget2? Does it behave better? > > --Ben > -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.boeckel at kitware.com Thu Jun 23 16:28:18 2016 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 23 Jun 2016 16:28:18 -0400 Subject: [vtkusers] Issues with QVTKWidget with VTK 7.1 (devel) OpenGL1 In-Reply-To: References: <20160623195910.GA19779@megas.kitware.com> Message-ID: <20160623202818.GD19779@megas.kitware.com> On Thu, Jun 23, 2016 at 16:13:33 -0400, Patricio Palma C. wrote: > Thanks you for the response. I've managed to solve this by moving to a > newer VTK snapshot, that solved the transparency issue. Ah, sounds good. > The broken glass looking was solved by stop using the system provided Mesa > (10.1.2) and using an old Mesa 7 It'd be nice to know if this is still an issue with modern Mesa releases (11.2 and newer) if you get the chance. Mesa 7 is increasingly not a solution for many :) . --Ben From patriciop at gmail.com Thu Jun 23 17:26:04 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Thu, 23 Jun 2016 17:26:04 -0400 Subject: [vtkusers] Crash when exporting to EPS In-Reply-To: References: Message-ID: Hi David Thank you for your response. It worked for OpenGL1 but not for OpenGL2. I tried to initialize the module with VTK_MODULE_INIT(vtkIOExportOpenGL2) However the application crashes with the following message: Generic Warning: In /remote/MyPRJ/vtk-devel/Rendering/OpenGL2/vtkOpenGLGL2PSHelper.cxx, line 24 Error: no override found for 'vtkOpenGLGL2PSHelper'. After some googling I found that by using VTK_MODULE_INIT(vtkRenderingGL2PSOpenGL2) allows the GL2PS module to work. I'm happy because the app is working, but is it safe to initialize that module in that way ? Regards -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From myk321 at gmail.com Fri Jun 24 07:12:23 2016 From: myk321 at gmail.com (Michael Arnold) Date: Fri, 24 Jun 2016 19:12:23 +0800 Subject: [vtkusers] vtkCubeAxesActor positions text labels incorrectly on axis Message-ID: Sorry - my bad: cubeAxesActor->SetXAxisRange(0.0, Labels.size() * 1.0); needs to be: cubeAxesActor->SetXAxisRange(1.0, Labels.size() * 1.0); Michael ----------------------------------------------------------------------------------------- Problem: for axis labels created using vtkCubeAxesActor, if we have more than 10 text labels, the labels and the data don't line-up, because the labels are positioned incorrectly on the axis. What are we Getting in more Detail: (a) If we have 9 data points (<10) we get 9 label points, with the last label at the end of the axis. So the labels can be 1,2,3,4,5,6,7,8,9, which lines-up nicely with the data: all is good in the world. (b) If we have 10 data points, we get get 6 labels points with the last label one at the end of the axis. We compute a label skip factor of 2. We start at the beginning of the axis. We label 1,3,5,7,9,11 <- what category is this last label?? We only have 10 data points! So the last data label does not line-up with its data. (c) If we have 11 data points, we again get 6 label points with the last label positioned a short distance back from the end of the axis. Again we compute a label skip factor of 2. We begin to label at the beginning of the axis. So we get 1,3,5,7,9,11. Ok, because we had 11 data-points, but now we land-up with the label for the last data element being back from the end of the axis i.e. the data label does not line-up with its data. What we want: (a) VTK seems to make a quite reasonable assumption to limit the number of labels to less than 10, so lets stick with that. (b) VTK works fine with data sets with 9 or fewer elements, so lets focus on data-sets with 10 or more data-points. (c) We need to handle data-sets with an even count of elements slightly differently from data-sets with an odd count of elements. (For a more generic handling this would be if the count of the elements is divisible by the skip factor, but for the moment lets stick to a skip factor of 2 and thus even or odd element counts). (d) For a data-set with an odd count of elements (lets say 11) we can easily imagine the handling to be: Smallest at the start (e.g. 1) Biggest at the end (eg. 11) Then fill-in the labels using the skip factor (2 in this case), so we get something like 1,3,5,7,9,11 (e) For a data-set with an even count of elements (lets say 10), we need to have a gap between the last label and the end of the axis. The end of the axis seems most logical place for this gap, so the last label point is back a bit from the end of the axis. So: Smallest at the start (e.g. 1) Then fill in the labels using the skip factor, so something like 1,3,5,7,9 and we happily land-up with a label of 9 being a bit back from the end of the axis. So what was the difference between what we want and what we are getting? The problem is not about the calculation of the number of labels - that is fine. The problem is the positioning of the labels on the axis - is the last label at the end of the axis or bit back from the end? Today, for data-sets with an even number of elements, we are getting the last label at the end of the axis. This is incorrect because for an even number of elements, we want the last label to be positioned back from the end of axis. Today, for data-sets with odd number of elements, we are getting the last label positioned with a gap before the end of the axis. Again this is incorrect, because the label should be positioned at the end of the axis. Questions: I'm using an old'ish version of VTK 6.1 - has this issue been fixed in a newer version? Am I misunderstanding something or can I raise a defect for this? Some Code: vtkSmartPointer cubeAxesActor = vtkSmartPointer::New(); cubeAxesActor->SetBounds(outputPolyData->GetBounds()); cubeAxesActor->SetCamera(Renderer->GetActiveCamera()); cubeAxesActor->GetTitleTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White cubeAxesActor->GetLabelTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White cubeAxesActor->SetXTitle("X-Axis"); cubeAxesActor->GetXAxesGridlinesProperty()->SetColor(1.0, 1.0, 1.0); //White cubeAxesActor->DrawXGridlinesOn(); cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST); cubeAxesActor->SetFlyModeToOuterEdges(); //Place the axes on the outer edges of the cube //Set the labels on the x-axis vtkSmartPointer XAxisLabels = vtkSmartPointer::New(); std::vector Labels = ResultsServer->GetXLabels(); //Get a list of axis labels if (!Labels.empty()) { int32_t SkipFactor = (Labels.size() / 10) + 1; int32_t Counter = 0; //Evenly divisble for (auto LabelsIt = std::begin(Labels); LabelsIt != std::end(Labels); ++LabelsIt) if (Counter++ % SkipFactor == 0) XAxisLabels->InsertNextValue(LabelsIt->c_str()); cubeAxesActor->SetXAxisRange(0.0, Labels.size() * 1.0); cubeAxesActor->GetLabelTextProperty(0)->SetFontSize(20); cubeAxesActor->GetLabelTextProperty(0)->SetOrientation(90.0); cubeAxesActor->SetAxisLabels(0, XAxisLabels); Labels.clear(); } Kind regards, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Fri Jun 24 07:13:26 2016 From: david.lonie at kitware.com (David Lonie) Date: Fri, 24 Jun 2016 07:13:26 -0400 Subject: [vtkusers] Crash when exporting to EPS In-Reply-To: References: Message-ID: On Thu, Jun 23, 2016 at 5:26 PM, Patricio Palma C. wrote: > After some googling I found that by using > VTK_MODULE_INIT(vtkRenderingGL2PSOpenGL2) allows the GL2PS module to work. > I'm happy because the app is working, but is it safe to initialize that > module in that way ? > I believe that is correct, and hopefully someone here can correct me if not. The VTK_MODULE_INIT macros are only needed for non-CMake applications (as I understand it), so I'm not very familiar with them. Glad you resolved the other missing module issue. Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Fri Jun 24 07:50:26 2016 From: david.lonie at kitware.com (David Lonie) Date: Fri, 24 Jun 2016 07:50:26 -0400 Subject: [vtkusers] vtkCubeAxesActor positions text labels incorrectly on axis In-Reply-To: References: Message-ID: Hi Michael, Looking at our change log, it doesn't appear that the vtkCubeAxesActor has seen many significant changes since 6.1, so I doubt a newer version would work any differently. I'm not aware of anyone currently working on this class, but I do know that there is a replacement in development in ParaView, vtkGridAxes3DActor: https://github.com/Kitware/ParaView/blob/master/ParaViewCore/VTKExtensions/Default/vtkGridAxes3DActor.h There's been talk of moving it into VTK, but I'm not aware of any firm plans at this point. In the meantime, feel free to file a bug report / feature request for this so it doesn't get lost. Dave On Fri, Jun 24, 2016 at 7:12 AM, Michael Arnold wrote: > Sorry - my bad: > cubeAxesActor->SetXAxisRange(0.0, Labels.size() * 1.0); > needs to be: > cubeAxesActor->SetXAxisRange(1.0, Labels.size() * 1.0); > > Michael > > > ----------------------------------------------------------------------------------------- > > Problem: for axis labels created using vtkCubeAxesActor, if we have more > than 10 text labels, the labels and the data don't line-up, because the > labels are positioned incorrectly on the axis. > > What are we Getting in more Detail: > (a) If we have 9 data points (<10) we get 9 label points, with the last > label at the end of the axis. So the labels can be 1,2,3,4,5,6,7,8,9, > which lines-up nicely with the data: all is good in the world. > (b) If we have 10 data points, we get get 6 labels points with the last > label one at the end of the axis. We compute a label skip factor of 2. We > start at the beginning of the axis. We label 1,3,5,7,9,11 <- what category > is this last label?? We only have 10 data points! So the last data label > does not line-up with its data. > (c) If we have 11 data points, we again get 6 label points with the last > label positioned a short distance back from the end of the axis. Again we > compute a label skip factor of 2. We begin to label at the beginning of > the axis. So we get 1,3,5,7,9,11. Ok, because we had 11 data-points, but > now we land-up with the label for the last data element being back from the > end of the axis i.e. the data label does not line-up with its data. > > What we want: > (a) VTK seems to make a quite reasonable assumption to limit the number of > labels to less than 10, so lets stick with that. > (b) VTK works fine with data sets with 9 or fewer elements, so lets focus > on data-sets with 10 or more data-points. > (c) We need to handle data-sets with an even count of elements slightly > differently from data-sets with an odd count of elements. (For a more > generic handling this would be if the count of the elements is divisible by > the skip factor, but for the moment lets stick to a skip factor of 2 and > thus even or odd element counts). > (d) For a data-set with an odd count of elements (lets say 11) we can > easily imagine the handling to be: > Smallest at the start (e.g. 1) > Biggest at the end (eg. 11) > Then fill-in the labels using the skip factor (2 in this case), so we get > something like 1,3,5,7,9,11 > (e) For a data-set with an even count of elements (lets say 10), we need to > have a gap between the last label and the end of the axis. The end of the > axis seems most logical place for this gap, so the last label point is back > a bit from the end of the axis. So: > Smallest at the start (e.g. 1) > Then fill in the labels using the skip factor, so something like 1,3,5,7,9 > and we happily land-up with a label of 9 being a bit back from the end of > the axis. > > So what was the difference between what we want and what we are getting? > The problem is not about the calculation of the number of labels - that is > fine. > The problem is the positioning of the labels on the axis - is the last > label at the end of the axis or bit back from the end? > Today, for data-sets with an even number of elements, we are getting the > last label at the end of the axis. This is incorrect because for an even > number of elements, we want the last label to be positioned back from the > end of axis. > Today, for data-sets with odd number of elements, we are getting the last > label positioned with a gap before the end of the axis. Again this is > incorrect, because the label should be positioned at the end of the axis. > > Questions: > I'm using an old'ish version of VTK 6.1 - has this issue been fixed in a > newer version? > Am I misunderstanding something or can I raise a defect for this? > > Some Code: > > vtkSmartPointer cubeAxesActor = > vtkSmartPointer::New(); > cubeAxesActor->SetBounds(outputPolyData->GetBounds()); > cubeAxesActor->SetCamera(Renderer->GetActiveCamera()); > cubeAxesActor->GetTitleTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White > cubeAxesActor->GetLabelTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White > cubeAxesActor->SetXTitle("X-Axis"); > cubeAxesActor->GetXAxesGridlinesProperty()->SetColor(1.0, 1.0, 1.0); > //White > > cubeAxesActor->DrawXGridlinesOn(); > cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST); > cubeAxesActor->SetFlyModeToOuterEdges(); //Place the axes on the > outer edges of the cube > > //Set the labels on the x-axis > vtkSmartPointer XAxisLabels = > vtkSmartPointer::New(); > std::vector Labels = ResultsServer->GetXLabels(); //Get a > list of axis labels > if (!Labels.empty()) { > > int32_t SkipFactor = (Labels.size() / 10) + 1; > int32_t Counter = 0; > > //Evenly divisble > for (auto LabelsIt = std::begin(Labels); LabelsIt != std::end(Labels); > ++LabelsIt) > if (Counter++ % SkipFactor == 0) > XAxisLabels->InsertNextValue(LabelsIt->c_str()); > > cubeAxesActor->SetXAxisRange(0.0, Labels.size() * 1.0); > cubeAxesActor->GetLabelTextProperty(0)->SetFontSize(20); > cubeAxesActor->GetLabelTextProperty(0)->SetOrientation(90.0); > cubeAxesActor->SetAxisLabels(0, XAxisLabels); > > Labels.clear(); > } > > Kind regards, > Michael > > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Fri Jun 24 08:59:53 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Fri, 24 Jun 2016 06:59:53 -0600 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: On Thu, Jun 23, 2016 at 3:18 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> > > > Just a final small question about your approach if that's okay: You say > here that the vtkRenderWindowInteractor does not play any role, but don't > you use the interactor for some things, such as finding the poked renderer > (vtkRenderWindowInteractor::FindPokedRenderer) ? Other things as well? > For event handling, I have a "Frame" class that manages the vtkRenderWindow and each "Frame" object has child "Pane" objects that manage each renderer, i.e. they manage both the layout and event bindings. So the "Frame" object has a method that decides which "Pane" to forward each event to (and this method does not use FindPokedRenderer). Instead of attaching a interaction style to the RenderWindow, I attach a set of event bindings to a Pane (where each Pane manages events for a Renderer). In other words, interaction is handled at the level of the Renderer, not at the level of the RenderWindow. > Up until now I've based my custom interactions on vtkInteractorStyleUser, > so have made use of the interactor/interactor style system. But I think I'm > finally succumbing to the idea of building a system more like yours, > especially as I've found that vtkInteractorStyleUser does not support wheel > events (recently added that). But I'm interested in if you ever make use of > the interactor/interactor style system? E.g. say you would like to provide > interaction with an vtkChartXY, would you make use of the builtin > interaction styles that VTK has for that, or build your own based on the > mechanism you've described here? Do you use your mechanism only when you > have a need for highly custom interaction behavior? > So far I haven't used interaction with charts. Take a look at QVTKInteractorAdapter.cxx if you're interested in handling some events yourself and forwarding others to VTK's interactors. I haven't tried doing this yet. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From cris.ardito at gmail.com Fri Jun 24 12:32:04 2016 From: cris.ardito at gmail.com (ING. CRISTIAN ARDITO) Date: Fri, 24 Jun 2016 18:32:04 +0200 Subject: [vtkusers] RENDER WINDOW FORCE REDRAW ACKTOR Message-ID: Hi I have a simple question. In a loop I load an Acktor which contains a set of 3d points and I add this acktor to a rendered; then I add a rendered on a render window and at the end i render with the method ' Render()' brief steps of code here: while(...) vtkSmartPointer cloudSlice= createCloudeSlice(...); rendered->AddActor(cloudSlice); renWin->Render(); end while This works well, I see on the render window all my point , however in this way at each cycle i render all the acktors...but I wonder whether it is possible adding the acktor and after the render remove it, so that in the render window remain the previous acktors rendering and the render window render only the last acktor; given that the result must be the same that is, I have to see all the points during the process of rendering. CRI -- CRIS -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.hirsch at st.ovgu.de Fri Jun 24 12:38:32 2016 From: jan.hirsch at st.ovgu.de (jhirsch) Date: Fri, 24 Jun 2016 09:38:32 -0700 (MST) Subject: [vtkusers] PrintAsCSV method from vtkXYPlotActor crashed In-Reply-To: <1466506303125-5738809.post@n5.nabble.com> References: <1466506303125-5738809.post@n5.nabble.com> Message-ID: <1466786312737-5738895.post@n5.nabble.com> I got it working. The thing was that the arrays of the histogram have to hava a name. The linked example does not do this. It uses the labels only for plotting purpose. So the first thing would be to name the data in the histogram: Then you have to tell the XYPlotActor what array to use: -- View this message in context: http://vtk.1045678.n5.nabble.com/PrintAsCSV-method-from-vtkXYPlotActor-crashed-tp5738809p5738895.html Sent from the VTK - Users mailing list archive at Nabble.com. From luis.vieira at vektore.com Fri Jun 24 14:35:27 2016 From: luis.vieira at vektore.com (Luis Vieira) Date: Fri, 24 Jun 2016 14:35:27 -0400 Subject: [vtkusers] VTKCamera vtk 7.0 Message-ID: <1cc4a01d1ce47$308a87c0$919f9740$@vektore.com> Hello, I want show up/open up my camera similar Paraview option +Y directly. Is anybody that knows how to render VTK Camera with Z+ (up), Y+ and X+ similar within ParaView, in the Toolbar option "Set view direction to +Y"? Thank you very much, Luis -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image005.png Type: image/png Size: 444 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image006.emz Type: application/octet-stream Size: 902 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image007.png Type: image/png Size: 510 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image008.emz Type: application/octet-stream Size: 900 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image009.png Type: image/png Size: 517 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image010.emz Type: application/octet-stream Size: 902 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image011.png Type: image/png Size: 1868 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image012.png Type: image/png Size: 1998 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image013.png Type: image/png Size: 911 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image014.png Type: image/png Size: 400 bytes Desc: not available URL: From neok.m4700 at gmail.com Fri Jun 24 20:58:51 2016 From: neok.m4700 at gmail.com (neok m4700) Date: Sat, 25 Jun 2016 02:58:51 +0200 Subject: [vtkusers] GL2PSExporter issue Message-ID: Hi, I have built vtk 7.0.0 with OpenGL2 backend. (enabling Module_vtkIOExportOpenGL2 and Module_vtkRenderingGL2PSOpenGL2) Instanciating vtkGL2PSExporter in the attached sample script results in the following error: *Generic Warning: In <...>/IO/Export/vtkGL2PSExporter.cxx, line 26* *Error: no override found for 'vtkGL2PSExporter'.* *Traceback (most recent call last):* * File "<...>/test.py", line 22, in * * wr = vtk.vtkGL2PSExporter()* *NotImplementedError: no concrete implementation exists for this class* I'm trying to understand why the vtkAbstractObjectFactoryNewMacro() fails. Does someone have any clue on how to debug this ? Thank you for the support -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: text/x-python Size: 493 bytes Desc: not available URL: From zhangjiang.dudu at gmail.com Sat Jun 25 00:42:40 2016 From: zhangjiang.dudu at gmail.com (=?utf-8?B?5byg5rGf?=) Date: Fri, 24 Jun 2016 23:42:40 -0500 Subject: [vtkusers] convert unstructured grid data to exodusII Message-ID: <8345C8EC-9E04-44F9-8AF4-A56F6A8E96D0@gmail.com> Hi, Currently I want to convert an unstructured grid data to exodusII format. The input unstructured grid data has a cell type of wedge. But when I execute the following code, the output data contains TETRA cell type. Can anybody explain this? vtkUnstructuredGridReader *reader = vtkUnstructuredGridReader::New(); reader->SetFileName(?input.vtk"); reader->Update(); vtkUnstructuredGrid *grid = reader->GetOutput(); vtkExodusIIWriter *writer = vtkExodusIIWriter::New(); writer->SetInputData(grid); writer->SetFileName(?output.e"); writer->Write(); -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickfrank at me.com Sat Jun 25 11:11:16 2016 From: rickfrank at me.com (Richard Frank) Date: Sat, 25 Jun 2016 11:11:16 -0400 Subject: [vtkusers] VtkLight example Message-ID: <2E9DC594-0A14-4EA8-B78F-DE1C47248823@me.com> The example here http://www.vtk.org/Wiki/VTK/Examples/Cxx/Lighting/Light Has a comment that states the light must be added after the first render(). What is the reason for this? Thanks Rick Sent from my iPad From bill.lorensen at gmail.com Sat Jun 25 12:14:49 2016 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Sat, 25 Jun 2016 12:14:49 -0400 Subject: [vtkusers] VtkLight example In-Reply-To: <2E9DC594-0A14-4EA8-B78F-DE1C47248823@me.com> References: <2E9DC594-0A14-4EA8-B78F-DE1C47248823@me.com> Message-ID: On the first Render(), if there are no lights specified, vtk will create a HeadLight (follows the camera). When you add a light before the first render, the head light will not be created. So in the example, if you add a light before the first render, only that light will be used by the renderer. Try it. Also set the background for the renderer and you will see plane. renderer->SetBackground(.4, .5, .6); HTH, Bill On Sat, Jun 25, 2016 at 11:11 AM, Richard Frank wrote: > The example here > > http://www.vtk.org/Wiki/VTK/Examples/Cxx/Lighting/Light > > Has a comment that states the light must be added after the first render(). > > What is the reason for this? > > Thanks > > Rick > > Sent from my iPad > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- Unpaid intern in BillsBasement at noware dot com From patriciop at gmail.com Sat Jun 25 16:55:44 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Sat, 25 Jun 2016 16:55:44 -0400 Subject: [vtkusers] GL2PSExporter issue In-Reply-To: References: Message-ID: Hello As far as I know, gl2ps support is broken in VTK 7.0. I had to move to VTK devel branch to use it (since EPS support was merged during January this year) Regards Patricio El Friday, June 24, 2016, neok m4700 escribi?: > Hi, > > I have built vtk 7.0.0 with OpenGL2 backend. > (enabling Module_vtkIOExportOpenGL2 and Module_vtkRenderingGL2PSOpenGL2) > > Instanciating vtkGL2PSExporter in the attached sample script results in > the following error: > > *Generic Warning: In <...>/IO/Export/vtkGL2PSExporter.cxx, line 26* > *Error: no override found for 'vtkGL2PSExporter'.* > > *Traceback (most recent call last):* > * File "<...>/test.py", line 22, in * > * wr = vtk.vtkGL2PSExporter()* > *NotImplementedError: no concrete implementation exists for this class* > > I'm trying to understand why the vtkAbstractObjectFactoryNewMacro() fails. > > Does someone have any clue on how to debug this ? > > > Thank you for the support > -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From woquendo at gmail.com Sat Jun 25 18:15:10 2016 From: woquendo at gmail.com (William Oquendo) Date: Sat, 25 Jun 2016 17:15:10 -0500 Subject: [vtkusers] vtkpython imports vtk fine when run on the same install directory, but not elsewhere Message-ID: Dear all, I am in Mac Os X Yosemite. Trying to fix "import vtk" errors, I downloaded and moved vtkpython onto /Applications. If I go to taht directory and run vtkpython and try to import vtk, everything works: $ cd /Applications/vtkpython/bin $ ./vtkpython vtk version 7.0.0 Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import vtk No error. But, if run vtkpython from another directory , I get the interpreter but it cannot import vtk: $ /Applications/vtkpython/bin/vtkpython vtk version 7.0.0 Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import vtk Traceback (most recent call last): File "", line 1, in ImportError: No module named vtk ?BTW, the following variables are set: $ echo $PYTHONPATH :/Applications/vtkpython/lib/:/Applications/vtkpython/bin/vtk/ $ echo $LD_LIBRARY_PATH :/Applications/vtkpython/lib/:/Applications/vtkpython/bin/vtk/ Could you please help to fix this and be able to run vtkpython from outside the installation directory? Thanks in advance? -- Best regards / Cordialmente, William-Fernando Oquendo -------------------------- Este correo puede carecer de tildes o e?es debido al teclado. -------------- next part -------------- An HTML attachment was scrubbed... URL: From neok.m4700 at gmail.com Sat Jun 25 18:26:22 2016 From: neok.m4700 at gmail.com (neok m4700) Date: Sun, 26 Jun 2016 00:26:22 +0200 Subject: [vtkusers] GL2PSExporter issue In-Reply-To: References: Message-ID: Hi Patricio, Building against the latest commit fails as well :( I've seen some answers talking about using VTK_MODULE_INIT(...) in C++, but is there any similar command for the python wrappers ? Thanks Le samedi 25 juin 2016, Patricio Palma C. a ?crit : > Hello > > As far as I know, gl2ps support is broken in VTK 7.0. I had to move to VTK > devel branch to use it (since EPS support was merged during January this > year) > > Regards > Patricio > > El Friday, June 24, 2016, neok m4700 escribi?: > >> Hi, >> >> I have built vtk 7.0.0 with OpenGL2 backend. >> (enabling Module_vtkIOExportOpenGL2 and Module_vtkRenderingGL2PSOpenGL2) >> >> Instanciating vtkGL2PSExporter in the attached sample script results in >> the following error: >> >> *Generic Warning: In <...>/IO/Export/vtkGL2PSExporter.cxx, line 26* >> *Error: no override found for 'vtkGL2PSExporter'.* >> >> *Traceback (most recent call last):* >> * File "<...>/test.py", line 22, in * >> * wr = vtk.vtkGL2PSExporter()* >> *NotImplementedError: no concrete implementation exists for this class* >> >> I'm trying to understand why the vtkAbstractObjectFactoryNewMacro() >> fails. >> >> Does someone have any clue on how to debug this ? >> >> >> Thank you for the support >> > > > -- > Patricio Palma Contreras > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From woquendo at gmail.com Sat Jun 25 18:54:19 2016 From: woquendo at gmail.com (William Oquendo) Date: Sat, 25 Jun 2016 17:54:19 -0500 Subject: [vtkusers] vtkpython imports vtk fine when run on the same install directory, but not elsewhere In-Reply-To: References: Message-ID: To answer myself and in case anyone needs this, I fixed the problem by appending the bin directory to the PYTHONPATH variable: $ export PYTHONPATH=${PYTHONPATH}:/Applications/vtkpython/bin/ It is important to run the executable with absolute path, $ /Applications/vtkpython/bin/vtkpython since some libraries linked by this executable are relative to the actual installation directory. This info obtained from otool: $ otool -L /Applications/vtkpython/bin/vtkpython /Applications/vtkpython/bin/vtkpython: @executable_path/../lib/libvtkWrappingPython27Core-7.0.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0) @executable_path/../lib/libvtkCommonCore-7.0.1.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.1) @executable_path/../lib/libvtksys-7.0.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) Best regards On Sat, Jun 25, 2016 at 5:15 PM, William Oquendo wrote: > Dear all, > I am in Mac Os X Yosemite. Trying to fix "import vtk" errors, I downloaded > and moved vtkpython onto /Applications. If I go to taht directory and run > vtkpython and try to import vtk, everything works: > $ cd /Applications/vtkpython/bin > $ ./vtkpython > vtk version 7.0.0 > Python 2.7.10 (default, Jul 14 2015, 19:46:27) > [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import vtk > No error. > But, if run vtkpython from another directory , I get the interpreter but > it cannot import vtk: > $ /Applications/vtkpython/bin/vtkpython > vtk version 7.0.0 > Python 2.7.10 (default, Jul 14 2015, 19:46:27) > [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import vtk > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named vtk > > ?BTW, the following variables are set: > $ echo $PYTHONPATH > :/Applications/vtkpython/lib/:/Applications/vtkpython/bin/vtk/ > $ echo $LD_LIBRARY_PATH > :/Applications/vtkpython/lib/:/Applications/vtkpython/bin/vtk/ > > Could you please help to fix this and be able to run vtkpython from > outside the installation directory? > > Thanks in advance? > > > -- > > Best regards / Cordialmente, > > William-Fernando Oquendo > -------------------------- > Este correo puede carecer de tildes o e?es debido al teclado. > > -- Best regards / Cordialmente, William-Fernando Oquendo -------------------------- Este correo puede carecer de tildes o e?es debido al teclado. -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 04:03:36 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 10:03:36 +0200 Subject: [vtkusers] About MouseEvents.py example In-Reply-To: References: Message-ID: 2016-06-24 14:59 GMT+02:00 David Gobbi : > On Thu, Jun 23, 2016 at 3:18 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> >> >> >> Just a final small question about your approach if that's okay: You say >> here that the vtkRenderWindowInteractor does not play any role, but don't >> you use the interactor for some things, such as finding the poked renderer >> (vtkRenderWindowInteractor::FindPokedRenderer) ? Other things as well? >> > > For event handling, I have a "Frame" class that manages the > vtkRenderWindow and each "Frame" object has child "Pane" objects that > manage each renderer, i.e. they manage both the layout and event bindings. > So the "Frame" object has a method that decides which "Pane" to forward > each event to (and this method does not use FindPokedRenderer). > > Instead of attaching a interaction style to the RenderWindow, I attach a > set of event bindings to a Pane (where each Pane manages events for a > Renderer). In other words, interaction is handled at the level of the > Renderer, not at the level of the RenderWindow. > Interesting, so you really are forgoing the entire interactor system. Thanks for explaining. > > > >> Up until now I've based my custom interactions on vtkInteractorStyleUser, >> so have made use of the interactor/interactor style system. But I think I'm >> finally succumbing to the idea of building a system more like yours, >> especially as I've found that vtkInteractorStyleUser does not support wheel >> events (recently added that). But I'm interested in if you ever make use of >> the interactor/interactor style system? E.g. say you would like to provide >> interaction with an vtkChartXY, would you make use of the builtin >> interaction styles that VTK has for that, or build your own based on the >> mechanism you've described here? Do you use your mechanism only when you >> have a need for highly custom interaction behavior? >> > > So far I haven't used interaction with charts. Take a look at > QVTKInteractorAdapter.cxx if you're interested in handling some events > yourself and forwarding others to VTK's interactors. I haven't tried doing > this yet. > Thanks, I'll have a look. Right now I'm stuck on another problem I ran into while trying to port my own renderering/event adapter to QOpenGLWidget (see other thread), but I hope I'll solve that. Elvis > - David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 04:08:15 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 10:08:15 +0200 Subject: [vtkusers] Handling "out" pointer callData parameters in events from Python In-Reply-To: References: Message-ID: 2016-06-23 16:26 GMT+02:00 Elvis Stansvik : > Hi all, > > I'm trying to make a QOpenGLWidget based VTK widget, and I'm taking > inspiration from QVTKWidget2 and this stack overflow answer: > > http://stackoverflow.com/a/26946040/252857 > > which provides a QVTKWidget3 based on QOpenGLWidget. > > Given how QVTKWidget2 handles IsCurrentEvent, IsDirectEvent and > SupportsOpenGLEvent from the render window [1], e.g: > > void QVTKWidget2::IsCurrent(vtkObject*, unsigned long, void*, void* > call_data) > { > bool* ptr = reinterpret_cast(call_data); > *ptr = QGLContext::currentContext() == this->context(); > } > > Is there any way to do this operation from Python? I know there's some > support for callData, but how would I effect a write to the memory pointed > at by the call_data parameter like this from Python? > > If it's not possible, am I completely doomed in trying to make a Python > class similar to QVTKWidget2? > Noone knows? David Gobbi, I think you worked on calldata support for Python (?), do you know if it's currently impossible to handle these events correctly from Python? (since they expect an answer through a memory write). I find these events quite strange actually. An event to me is something you fire and forget, not a request for information like these ones seems to be. Anyone know why the API was built like this? Elvis > Many thanks in advance, > Elvis > > [1] > https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/QtOpenGL/QVTKWidget2.cxx#L458-474 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 05:01:21 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 11:01:21 +0200 Subject: [vtkusers] Is -DVTK_RENDERING_BACKEND=OpenGL needed for Haswell with 7.0.0? In-Reply-To: References: Message-ID: 2016-05-25 17:08 GMT+02:00 Elvis Stansvik : > 2016-05-25 13:49 GMT+02:00 Ken Martin : > >> Yes, you should be fine with VTK 7.0, OpenGL2 and Haswell. - Ken >> > Hm, initially it seemed like things were working fine. I was using the GPU based volume mapper without problems (using a modified QVTKRenderWindowInteractor), and I _think_ I was using the OpenGL2 backend (how can I tell btw?). But now, as I started trying to make a QOpenGLWidget-based Qt<->VTK adapter class instead, I get the following when trying to initialize the render window: ERROR: In /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 545 vtkGenericOpenGLRenderWindow (0x205fb10): GL version 2.1 with the gpu_shader4 extension is not supported by your graphics driver but is required for the new OpenGL rendering backend. Please update your OpenGL driver. If you are using Mesa please make sure you have version 10.6.5 or later and make sure your driver in Mesa supports OpenGL 3.2. And sure enough: estan at newton:~$ glxinfo | grep "OpenGL version" OpenGL version string: 3.0 Mesa 11.2.0 However: estan at newton:~$ glxinfo | grep "OpenGL core profile version" OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 I'm a little unsure about which of these version numbers I should be looking at to see if my graphics has what it takes. Also, I'm now even unsure if I was ever using the OpenGL2 backend.. perhaps VTK was falling back to OpenGL1 somehow, and that's why it worked in the beginning? Or is the selection of backend always a compile time thing? I build my VTK 7.0.0 in a Personal Package Archive at: https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 and the full build log is at: https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz Any advice is much appreciated! I'm considering switching to the old OpenGL1 backend anyway, since I realized my laptop at home only has a Sandybridge chipset (at work it's Haswell), and it's convenient to be able to do some work from my home laptop. But I'd like to know why I get the above error on my work laptop, since I thought it'd be compatible. Elvis > Great, thanks! > > Elvis > > >> >> On Wed, May 25, 2016 at 4:50 AM, Elvis Stansvik < >> elvis.stansvik at orexplore.com> wrote: >> >>> Hi all, >>> >>> I'm about to try a compile of VTK 7.0.0 release on Ubuntu 16.04 (Xenial). >>> >>> The machine where I need this to run has a Haswell Intel graphics chip >>> (Intel(R) HD Graphics 4400), which supports the OpenGL 3.3 profile. Will >>> the new OpenGL backend (the version in 7.0.0) support this graphics card, >>> or will I need to use the old backend with -DVTK_RENDERING_BACKEND=OpenGL? >>> >>> I read that support for is for Ivy Bridge and later in 7.0.0, so I think >>> I should be OK right? >>> >>> Thanks in advance, >>> Elvis >>> >>> _______________________________________________ >>> 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 >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/vtkusers >>> >>> >> >> >> -- >> Ken Martin PhD >> Chairman & CFO >> Kitware Inc. >> 28 Corporate Drive >> Clifton Park NY 12065 >> 518 371 3971 >> >> This communication, including all attachments, contains confidential and >> legally privileged information, and it is intended only for the use of the >> addressee. Access to this email by anyone else is unauthorized. If you are >> not the intended recipient, any disclosure, copying, distribution or any >> action taken in reliance on it is prohibited and may be unlawful. If you >> received this communication in error please notify us immediately and >> destroy the original message. Thank you. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 05:05:25 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 11:05:25 +0200 Subject: [vtkusers] Is -DVTK_RENDERING_BACKEND=OpenGL needed for Haswell with 7.0.0? In-Reply-To: References: Message-ID: 2016-06-26 11:01 GMT+02:00 Elvis Stansvik : > 2016-05-25 17:08 GMT+02:00 Elvis Stansvik : > >> 2016-05-25 13:49 GMT+02:00 Ken Martin : >> >>> Yes, you should be fine with VTK 7.0, OpenGL2 and Haswell. - Ken >>> >> > Hm, initially it seemed like things were working fine. I was using the GPU > based volume mapper without problems (using a modified > QVTKRenderWindowInteractor), and I _think_ I was using the OpenGL2 backend > (how can I tell btw?). > > But now, as I started trying to make a QOpenGLWidget-based Qt<->VTK > adapter class instead, I get the following when trying to initialize the > render window: > > ERROR: In > /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, > line 545 > vtkGenericOpenGLRenderWindow (0x205fb10): GL version 2.1 with the > gpu_shader4 extension is not supported by your graphics driver but is > required for the new OpenGL rendering backend. Please update your OpenGL > driver. If you are using Mesa please make sure you have version 10.6.5 or > later and make sure your driver in Mesa supports OpenGL 3.2. > > And sure enough: > > estan at newton:~$ glxinfo | grep "OpenGL version" > OpenGL version string: 3.0 Mesa 11.2.0 > > However: > > estan at newton:~$ glxinfo | grep "OpenGL core profile version" > OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 > > I'm a little unsure about which of these version numbers I should be > looking at to see if my graphics has what it takes. > > Also, I'm now even unsure if I was ever using the OpenGL2 backend.. > perhaps VTK was falling back to OpenGL1 somehow, and that's why it worked > in the beginning? Or is the selection of backend always a compile time > thing? > > I build my VTK 7.0.0 in a Personal Package Archive at: > > https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 > > and the full build log is at: > > > https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz > Okay, so looking at that build log, I see: -- Setting rendering backend to 'OpenGL2' as none was specified. -- Backend OpenGL modules: vtkRenderingContextOpenGL;vtkRenderingOpenGL;vtkRenderingLIC;vtkRenderingVolumeOpenGL;vtkRenderingGL2PS -- Backend OpenGL2 modules: vtkRenderingContextOpenGL2;vtkRenderingVolumeOpenGL2;vtkRenderingOpenGL2;vtkRenderingLICOpenGL2;vtkDomainsChemistryOpenGL2 -- Enabling modules for OpenGL2. Does this mean I'll always be using the OpenGL2 backend, or that OpenGL vs OpenGL2 is a runtime choice? Elvis > > Any advice is much appreciated! > > I'm considering switching to the old OpenGL1 backend anyway, since I > realized my laptop at home only has a Sandybridge chipset (at work it's > Haswell), and it's convenient to be able to do some work from my home > laptop. But I'd like to know why I get the above error on my work laptop, > since I thought it'd be compatible. > > Elvis > > >> Great, thanks! >> >> Elvis >> >> >>> >>> On Wed, May 25, 2016 at 4:50 AM, Elvis Stansvik < >>> elvis.stansvik at orexplore.com> wrote: >>> >>>> Hi all, >>>> >>>> I'm about to try a compile of VTK 7.0.0 release on Ubuntu 16.04 >>>> (Xenial). >>>> >>>> The machine where I need this to run has a Haswell Intel graphics chip >>>> (Intel(R) HD Graphics 4400), which supports the OpenGL 3.3 profile. Will >>>> the new OpenGL backend (the version in 7.0.0) support this graphics card, >>>> or will I need to use the old backend with -DVTK_RENDERING_BACKEND=OpenGL? >>>> >>>> I read that support for is for Ivy Bridge and later in 7.0.0, so I >>>> think I should be OK right? >>>> >>>> Thanks in advance, >>>> Elvis >>>> >>>> _______________________________________________ >>>> 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 >>>> >>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>> >>>> Follow this link to subscribe/unsubscribe: >>>> http://public.kitware.com/mailman/listinfo/vtkusers >>>> >>>> >>> >>> >>> -- >>> Ken Martin PhD >>> Chairman & CFO >>> Kitware Inc. >>> 28 Corporate Drive >>> Clifton Park NY 12065 >>> 518 371 3971 >>> >>> This communication, including all attachments, contains confidential and >>> legally privileged information, and it is intended only for the use of the >>> addressee. Access to this email by anyone else is unauthorized. If you are >>> not the intended recipient, any disclosure, copying, distribution or any >>> action taken in reliance on it is prohibited and may be unlawful. If you >>> received this communication in error please notify us immediately and >>> destroy the original message. Thank you. >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From squelsh at gmx.net Sun Jun 26 05:13:49 2016 From: squelsh at gmx.net (Andreas Hermann) Date: Sun, 26 Jun 2016 11:13:49 +0200 Subject: [vtkusers] CMake, UseVTK.cmake and CUDA incompatibility Message-ID: <576F9CCD.10401@gmx.net> Hi everyone, I am new to the list, but I already found several postings here that describe the same problem. Unfortunately no satisfying answer was given yet (AFAIK). I am trying to compile a larger project that uses CUDA and PCL (invoking VTK). But a bunch of CMAKE Flags defined by VTK kill NVCCs parsing, as they include spaces. Result is: "nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified" Those flags are not required when calling NVCC but VTK defines them globally ): Gregory Kramida describes the problem best in his mail from Dec 2015: http://public.kitware.com/pipermail/vtkusers/2015-December/093367.html So my question is: How do you use CUDA together with VTK in a CMake project? It would be great to get any advice on how to handle this... Thanks, Andreas From elvis.stansvik at orexplore.com Sun Jun 26 05:42:30 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 11:42:30 +0200 Subject: [vtkusers] Is -DVTK_RENDERING_BACKEND=OpenGL needed for Haswell with 7.0.0? In-Reply-To: References: Message-ID: 2016-06-26 11:05 GMT+02:00 Elvis Stansvik : > 2016-06-26 11:01 GMT+02:00 Elvis Stansvik : > >> 2016-05-25 17:08 GMT+02:00 Elvis Stansvik : >> >>> 2016-05-25 13:49 GMT+02:00 Ken Martin : >>> >>>> Yes, you should be fine with VTK 7.0, OpenGL2 and Haswell. - Ken >>>> >>> >> Hm, initially it seemed like things were working fine. I was using the >> GPU based volume mapper without problems (using a modified >> QVTKRenderWindowInteractor), and I _think_ I was using the OpenGL2 backend >> (how can I tell btw?). >> >> But now, as I started trying to make a QOpenGLWidget-based Qt<->VTK >> adapter class instead, I get the following when trying to initialize the >> render window: >> >> ERROR: In >> /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, >> line 545 >> vtkGenericOpenGLRenderWindow (0x205fb10): GL version 2.1 with the >> gpu_shader4 extension is not supported by your graphics driver but is >> required for the new OpenGL rendering backend. Please update your OpenGL >> driver. If you are using Mesa please make sure you have version 10.6.5 or >> later and make sure your driver in Mesa supports OpenGL 3.2. >> >> And sure enough: >> >> estan at newton:~$ glxinfo | grep "OpenGL version" >> OpenGL version string: 3.0 Mesa 11.2.0 >> >> However: >> >> estan at newton:~$ glxinfo | grep "OpenGL core profile version" >> OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 >> >> I'm a little unsure about which of these version numbers I should be >> looking at to see if my graphics has what it takes. >> >> Also, I'm now even unsure if I was ever using the OpenGL2 backend.. >> perhaps VTK was falling back to OpenGL1 somehow, and that's why it worked >> in the beginning? Or is the selection of backend always a compile time >> thing? >> >> I build my VTK 7.0.0 in a Personal Package Archive at: >> >> https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 >> >> and the full build log is at: >> >> >> https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz >> > > Okay, so looking at that build log, I see: > > -- Setting rendering backend to 'OpenGL2' as none was specified. > -- Backend OpenGL modules: vtkRenderingContextOpenGL;vtkRenderingOpenGL;vtkRenderingLIC;vtkRenderingVolumeOpenGL;vtkRenderingGL2PS > -- Backend OpenGL2 modules: vtkRenderingContextOpenGL2;vtkRenderingVolumeOpenGL2;vtkRenderingOpenGL2;vtkRenderingLICOpenGL2;vtkDomainsChemistryOpenGL2 > -- Enabling modules for OpenGL2. > > > Does this mean I'll always be using the OpenGL2 backend, or that OpenGL vs > OpenGL2 is a runtime choice? > I've now done some testing here at home, on my old Sandybridge laptop which I think only has a HD 3000 graphics chip: [estan at pyret ~]$ glxinfo | grep "OpenGL version" OpenGL version string: 3.0 Mesa 11.2.2 and the "Extended renderer info" section says: Extended renderer info (GLX_MESA_query_renderer): Vendor: Intel Open Source Technology Center (0x8086) Device: Mesa DRI Intel(R) Sandybridge Mobile (0x126) Version: 11.2.2 Accelerated: yes Video memory: 1536MB Unified memory: yes Preferred profile: core (0x1) Max core profile version: 3.3 Max compat profile version: 3.0 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.0 And it turns out that all I had to do in my little QOpenGLWidget-adapter was: surfaceFormat.setMajorVersion(3) surfaceFormat.setMinorVersion(2) surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) self.setFormat(surfaceFormat) to request OpenGL 3.2 compatibility profile. After this I no longer get the error and rendering seems to work. I'm actually a little surprised this works, since I didn't think my old home laptop would support the OpenGL2 backend. And the glxinfo output shows "Max compat profile version: 3.0". But printing the .format().majorVersion() and .format().minorVersion() after setting it on the QOpenGLWidget confirms that I've gotten the 3.2 format set. Oh well, I'm happy now, but would still like some clarification from someone who knows more than me about these things. Elvis > Elvis > > >> >> Any advice is much appreciated! >> >> I'm considering switching to the old OpenGL1 backend anyway, since I >> realized my laptop at home only has a Sandybridge chipset (at work it's >> Haswell), and it's convenient to be able to do some work from my home >> laptop. But I'd like to know why I get the above error on my work laptop, >> since I thought it'd be compatible. >> >> Elvis >> >> >>> Great, thanks! >>> >>> Elvis >>> >>> >>>> >>>> On Wed, May 25, 2016 at 4:50 AM, Elvis Stansvik < >>>> elvis.stansvik at orexplore.com> wrote: >>>> >>>>> Hi all, >>>>> >>>>> I'm about to try a compile of VTK 7.0.0 release on Ubuntu 16.04 >>>>> (Xenial). >>>>> >>>>> The machine where I need this to run has a Haswell Intel graphics chip >>>>> (Intel(R) HD Graphics 4400), which supports the OpenGL 3.3 profile. Will >>>>> the new OpenGL backend (the version in 7.0.0) support this graphics card, >>>>> or will I need to use the old backend with -DVTK_RENDERING_BACKEND=OpenGL? >>>>> >>>>> I read that support for is for Ivy Bridge and later in 7.0.0, so I >>>>> think I should be OK right? >>>>> >>>>> Thanks in advance, >>>>> Elvis >>>>> >>>>> _______________________________________________ >>>>> 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 >>>>> >>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>>> >>>>> Follow this link to subscribe/unsubscribe: >>>>> http://public.kitware.com/mailman/listinfo/vtkusers >>>>> >>>>> >>>> >>>> >>>> -- >>>> Ken Martin PhD >>>> Chairman & CFO >>>> Kitware Inc. >>>> 28 Corporate Drive >>>> Clifton Park NY 12065 >>>> 518 371 3971 >>>> >>>> This communication, including all attachments, contains confidential >>>> and legally privileged information, and it is intended only for the use of >>>> the addressee. Access to this email by anyone else is unauthorized. If you >>>> are not the intended recipient, any disclosure, copying, distribution or >>>> any action taken in reliance on it is prohibited and may be unlawful. If >>>> you received this communication in error please notify us immediately and >>>> destroy the original message. Thank you. >>>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 05:45:31 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 11:45:31 +0200 Subject: [vtkusers] Is -DVTK_RENDERING_BACKEND=OpenGL needed for Haswell with 7.0.0? In-Reply-To: References: Message-ID: 2016-06-26 11:42 GMT+02:00 Elvis Stansvik : > 2016-06-26 11:05 GMT+02:00 Elvis Stansvik : > >> 2016-06-26 11:01 GMT+02:00 Elvis Stansvik : >> >>> 2016-05-25 17:08 GMT+02:00 Elvis Stansvik >>> : >>> >>>> 2016-05-25 13:49 GMT+02:00 Ken Martin : >>>> >>>>> Yes, you should be fine with VTK 7.0, OpenGL2 and Haswell. - Ken >>>>> >>>> >>> Hm, initially it seemed like things were working fine. I was using the >>> GPU based volume mapper without problems (using a modified >>> QVTKRenderWindowInteractor), and I _think_ I was using the OpenGL2 backend >>> (how can I tell btw?). >>> >>> But now, as I started trying to make a QOpenGLWidget-based Qt<->VTK >>> adapter class instead, I get the following when trying to initialize the >>> render window: >>> >>> ERROR: In >>> /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, >>> line 545 >>> vtkGenericOpenGLRenderWindow (0x205fb10): GL version 2.1 with the >>> gpu_shader4 extension is not supported by your graphics driver but is >>> required for the new OpenGL rendering backend. Please update your OpenGL >>> driver. If you are using Mesa please make sure you have version 10.6.5 or >>> later and make sure your driver in Mesa supports OpenGL 3.2. >>> >>> And sure enough: >>> >>> estan at newton:~$ glxinfo | grep "OpenGL version" >>> OpenGL version string: 3.0 Mesa 11.2.0 >>> >>> However: >>> >>> estan at newton:~$ glxinfo | grep "OpenGL core profile version" >>> OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 >>> >>> I'm a little unsure about which of these version numbers I should be >>> looking at to see if my graphics has what it takes. >>> >>> Also, I'm now even unsure if I was ever using the OpenGL2 backend.. >>> perhaps VTK was falling back to OpenGL1 somehow, and that's why it worked >>> in the beginning? Or is the selection of backend always a compile time >>> thing? >>> >>> I build my VTK 7.0.0 in a Personal Package Archive at: >>> >>> https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 >>> >>> and the full build log is at: >>> >>> >>> https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz >>> >> >> Okay, so looking at that build log, I see: >> >> -- Setting rendering backend to 'OpenGL2' as none was specified. >> -- Backend OpenGL modules: vtkRenderingContextOpenGL;vtkRenderingOpenGL;vtkRenderingLIC;vtkRenderingVolumeOpenGL;vtkRenderingGL2PS >> -- Backend OpenGL2 modules: vtkRenderingContextOpenGL2;vtkRenderingVolumeOpenGL2;vtkRenderingOpenGL2;vtkRenderingLICOpenGL2;vtkDomainsChemistryOpenGL2 >> -- Enabling modules for OpenGL2. >> >> >> Does this mean I'll always be using the OpenGL2 backend, or that OpenGL >> vs OpenGL2 is a runtime choice? >> > > I've now done some testing here at home, on my old Sandybridge laptop > which I think only has a HD 3000 graphics chip: > > [estan at pyret ~]$ glxinfo | grep "OpenGL version" > OpenGL version string: 3.0 Mesa 11.2.2 > > and the "Extended renderer info" section says: > > Extended renderer info (GLX_MESA_query_renderer): > Vendor: Intel Open Source Technology Center (0x8086) > Device: Mesa DRI Intel(R) Sandybridge Mobile (0x126) > Version: 11.2.2 > Accelerated: yes > Video memory: 1536MB > Unified memory: yes > Preferred profile: core (0x1) > Max core profile version: 3.3 > Max compat profile version: 3.0 > Max GLES1 profile version: 1.1 > Max GLES[23] profile version: 3.0 > > And it turns out that all I had to do in my little QOpenGLWidget-adapter > was: > > surfaceFormat.setMajorVersion(3) > surfaceFormat.setMinorVersion(2) > surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) > self.setFormat(surfaceFormat) > > to request OpenGL 3.2 compatibility profile. After this I no longer get > the error and rendering seems to work. > > I'm actually a little surprised this works, since I didn't think my old > home laptop would support the OpenGL2 backend. And the glxinfo output shows > "Max compat profile version: 3.0". But printing the > .format().majorVersion() and .format().minorVersion() after setting it on > the QOpenGLWidget confirms that I've gotten the 3.2 format set. > > Oh well, I'm happy now, but would still like some clarification from > someone who knows more than me about these things. > For full disclosure, on this older home laptop I run Arch Linux and not Kubuntu 16.04 like at work. The VTK I build using a custom Arch Linux package which does for lib in EXPAT FREETYPE JPEG PNG TIFF ZLIB LIBXML2 OGGTHEORA TWISTED ZOPE SIX AUTOBAHN MPI4PY JSONCPP GLEW GL2PS; do cmake_system_flags+="-DVTK_USE_SYSTEM_${lib}:BOOL=ON " done ... cmake \ -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DBUILD_SHARED_LIBS:BOOL=ON \ -DCMAKE_INSTALL_PREFIX:FILEPATH=/usr \ -DBUILD_DOCUMENTATION:BOOL=ON \ -DDOCUMENTATION_HTML_HELP:BOOL=ON \ -DDOCUMENTATION_HTML_TARZ:BOOL=ON \ -DBUILD_EXAMPLES:BOOL=ON \ -DVTK_USE_FFMPEG_ENCODER:BOOL=ON \ -DVTK_BUILD_ALL_MODULES:BOOL=ON \ -DVTK_USE_LARGE_DATA:BOOL=ON \ -DVTK_QT_VERSION:STRING="5" \ -DVTK_WRAP_JAVA:BOOL=ON \ -DVTK_WRAP_PYTHON:BOOL=ON \ -DVTK_WRAP_TCL:BOOL=ON \ -DCMAKE_CXX_FLAGS="-D__STDC_CONSTANT_MACROS" \ -DVTK_CUSTOM_LIBRARY_SUFFIX="" \ -DVTK_INSTALL_INCLUDE_DIR:PATH=include/vtk \ -DVTK_INSTALL_TCL_DIR=/usr/lib/tcl${_tkver}/vtk/ \ -DVTK_PYTHON_VERSION=3 \ -DPYTHON_EXECUTABLE=/usr/bin/python3 \ -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m \ -DPYTHON_LIBRARY=/usr/lib/libpython3.5m.so \ -DVTK_USE_SYSTEM_HDF5=OFF \ ${cmake_system_flags} \ -DCMAKE_BUILD_TYPE=Release \ "${srcdir}/VTK-$pkgver" \ -GNinja ninja to build VTK. I don't have the build log for it, but I would think the above would give me the OpenGL2 backend (?), since I didn't specify anything special in the cmake command. Elvis > Elvis > > > >> Elvis >> >> >>> >>> Any advice is much appreciated! >>> >>> I'm considering switching to the old OpenGL1 backend anyway, since I >>> realized my laptop at home only has a Sandybridge chipset (at work it's >>> Haswell), and it's convenient to be able to do some work from my home >>> laptop. But I'd like to know why I get the above error on my work laptop, >>> since I thought it'd be compatible. >>> >>> Elvis >>> >>> >>>> Great, thanks! >>>> >>>> Elvis >>>> >>>> >>>>> >>>>> On Wed, May 25, 2016 at 4:50 AM, Elvis Stansvik < >>>>> elvis.stansvik at orexplore.com> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> I'm about to try a compile of VTK 7.0.0 release on Ubuntu 16.04 >>>>>> (Xenial). >>>>>> >>>>>> The machine where I need this to run has a Haswell Intel graphics >>>>>> chip (Intel(R) HD Graphics 4400), which supports the OpenGL 3.3 profile. >>>>>> Will the new OpenGL backend (the version in 7.0.0) support this graphics >>>>>> card, or will I need to use the old backend with >>>>>> -DVTK_RENDERING_BACKEND=OpenGL? >>>>>> >>>>>> I read that support for is for Ivy Bridge and later in 7.0.0, so I >>>>>> think I should be OK right? >>>>>> >>>>>> Thanks in advance, >>>>>> Elvis >>>>>> >>>>>> _______________________________________________ >>>>>> 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 >>>>>> >>>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>>>> >>>>>> Follow this link to subscribe/unsubscribe: >>>>>> http://public.kitware.com/mailman/listinfo/vtkusers >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Ken Martin PhD >>>>> Chairman & CFO >>>>> Kitware Inc. >>>>> 28 Corporate Drive >>>>> Clifton Park NY 12065 >>>>> 518 371 3971 >>>>> >>>>> This communication, including all attachments, contains confidential >>>>> and legally privileged information, and it is intended only for the use of >>>>> the addressee. Access to this email by anyone else is unauthorized. If you >>>>> are not the intended recipient, any disclosure, copying, distribution or >>>>> any action taken in reliance on it is prohibited and may be unlawful. If >>>>> you received this communication in error please notify us immediately and >>>>> destroy the original message. Thank you. >>>>> >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Sun Jun 26 05:53:45 2016 From: cory.quammen at kitware.com (Cory Quammen) Date: Sun, 26 Jun 2016 11:53:45 +0200 Subject: [vtkusers] CMake, UseVTK.cmake and CUDA incompatibility In-Reply-To: <576F9CCD.10401@gmx.net> References: <576F9CCD.10401@gmx.net> Message-ID: Hi Andreas, The best way I have found to build a project that uses CUDA and VTK is to: - make sure the CUDA code is compiled into a separate library target - clear out the include directories and compiler definitions prior to specifying the CUDA library target to avoid problems with spaces in the VTK definitions and too-long command lines - link you application against the CUDA library and VTK In your CMakeLists.txt file in the directory for the CUDA library, the library target set up would look something like this: # Reset the include directories to avoid an error from the number of /I -I options # making the command line for nvcc too long. set_directory_properties( PROPERTIES INCLUDE_DIRECTORIES "" ) # The definitions (-DFOO) from VTK were confusing nvcc set_directory_properties( PROPERTIES COMPILE_DEFINITIONS "" ) cuda_add_library( myCUDAlibrary ${CUDA_SRCS} ) Hope that helps, Cory On Sun, Jun 26, 2016 at 11:13 AM, Andreas Hermann wrote: > Hi everyone, > > I am new to the list, but I already found several postings here that > describe the same problem. Unfortunately no satisfying answer was given yet > (AFAIK). > > I am trying to compile a larger project that uses CUDA and PCL (invoking > VTK). > But a bunch of CMAKE Flags defined by VTK kill NVCCs parsing, as they > include spaces. > Result is: > > "nvcc fatal : A single input file is required for a non-link phase when an > outputfile is specified" > > Those flags are not required when calling NVCC but VTK defines them globally > ): > > Gregory Kramida describes the problem best in his mail from Dec 2015: > http://public.kitware.com/pipermail/vtkusers/2015-December/093367.html > > So my question is: How do you use CUDA together with VTK in a CMake project? > It would be great to get any advice on how to handle this... > > > Thanks, > Andreas > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -- Cory Quammen R&D Engineer Kitware, Inc. From elvis.stansvik at orexplore.com Sun Jun 26 07:06:44 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 13:06:44 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events Message-ID: Hi, In my quest to create a PyQt5 widget based on QOpenGLWidget for showing/interacting with VTK, I now have something that seems to work (including the whole thing as a runnable example below). I do however have two problems (indicated by "FIXME:"s in the code below): 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when handling the render window StartEvent (commented out below), similar to how QVTKWidget2 does, I get a segmentation fault: (gdb) bt #0 0x0000000000000000 in ?? () #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () from /usr/lib/libvtkRenderingOpenGL2.so.1 #2 0x00007fffd8de8479 in ?? () from /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 #3 0x00007ffff79ba5e9 in PyCFunction_Call () from /usr/lib/libpython3.5m.so.1.0 #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from /usr/lib/libpython3.5m.so.1.0 #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from /usr/lib/libpython3.5m.so.1.0 #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 #8 0x00007ffff79730da in PyObject_Call () from /usr/lib/libpython3.5m.so.1.0 #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 #10 0x00007ffff79730da in PyObject_Call () from /usr/lib/libpython3.5m.so.1.0 #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython3.5m.so.1.0 #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, unsigned long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from /usr/lib/libvtkRenderingCore.so.1 #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from /usr/lib/libvtkRenderingOpenGL2.so.1 #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from /usr/lib/libvtkRenderingCore.so.1 #17 0x00007fffdf3ee789 in ?? () from /usr/lib/libvtkRenderingCorePython35D.so.1 #18 0x00007ffff79ba5e9 in PyCFunction_Call () from /usr/lib/libpython3.5m.so.1.0 #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from /usr/lib/libpython3.5m.so.1.0 #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from /usr/lib/libpython3.5m.so.1.0 #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 #23 0x00007ffff79730da in PyObject_Call () from /usr/lib/libpython3.5m.so.1.0 #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 #25 0x00007ffff79730da in PyObject_Call () from /usr/lib/libpython3.5m.so.1.0 #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 #28 0x00007ffff79730da in PyObject_Call () from /usr/lib/libpython3.5m.so.1.0 #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from /usr/lib/libpython3.5m.so.1.0 #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from /usr/lib/libpython3.5m.so.1.0 #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from /usr/lib/libpython3.5m.so.1.0 #33 0x00007ffff7a33aeb in PyEval_EvalCode () from /usr/lib/libpython3.5m.so.1.0 #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 #35 0x00007ffff79ba5e9 in PyCFunction_Call () from /usr/lib/libpython3.5m.so.1.0 #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from /usr/lib/libpython3.5m.so.1.0 #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from /usr/lib/libpython3.5m.so.1.0 #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from /usr/lib/libpython3.5m.so.1.0 #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 #42 0x00007ffff79730da in PyObject_Call () from /usr/lib/libpython3.5m.so.1.0 #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 #45 0x0000000000400ae7 in main () (gdb) Sorry for the lack of debugging symbols, but before I recompile VTK with debugging symbols, I thought I'd ask if anyone has an idea what may be the reason for the crash? I haven't seen any adverse effects from not calling this function, but I suspect something is broken? (how can I test?) 2. I can't seem to find a way to properly implement the WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent render window events. E.g. (from below): def _onWindowIsCurrentEvent(self, sender, event, callData): callData = True # FIXME: This won't work... def _onWindowIsDirectEvent(self, sender, event, callData): callData = True # FIXME: This won't work... def _onWindowSupportsOpenGLEvent(self, sender, event, callData): callData = True # FIXME: This won't work... The callData is a bool* and the handler is expected to write a bool to the pointed memory. I can't see that there's any way to do this from Python (is it possible with ctypes somehow?). So far I haven't seen any adverse effects from not implementing these three events correctly, but expect something to be broken..? Thankful for any advice on these two issues, and it would be great if someone could try out the example, with the # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( line uncommented, to confirm the segfault I'm seeing. Cheers, Elvis from PyQt5.QtCore import Qt, QTimer, QEvent, QSize from PyQt5.QtGui import QSurfaceFormat from PyQt5.QtWidgets import QWidget, QOpenGLWidget from vtk import vtkGenericOpenGLRenderWindow from vtk import vtkGenericRenderWindowInteractor from vtk import vtkCommand from vtk import vtkRenderer from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR class VTKWidget(QOpenGLWidget): def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), *args, **kwargs): super().__init__(*args, **kwargs) # Request OpenGL 3.2 compatibility profile and enable multi-sampling surfaceFormat.setMajorVersion(3) surfaceFormat.setMinorVersion(2) surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) surfaceFormat.setSamples(8) self.setFormat(surfaceFormat) # Create render window self.renderWindow = vtkGenericOpenGLRenderWindow() self.renderWindow.SetSize(self.width(), self.height()) self.renderWindow.SetPosition(self.x(), self.y()) self.renderWindow.AddObserver(vtkCommand.StartEvent, self._onStartEvent) self.renderWindow.AddObserver(vtkCommand.EndEvent, self._onEndEvent) self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, self._onCursorChangedEvent) self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, self._onWindowMakeCurrentEvent) self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, self._onWindowIsCurrentEvent) self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, self._onWindowFrameEvent) self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, self._onWindowIsDirectEvent) self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, self._onWindowSupportsOpenGLEvent) # Create interactor self.interactor = vtkGenericRenderWindowInteractor() self.interactor.SetRenderWindow(self.renderWindow) self.interactor.SetSize(self.width(), self.height()) self.interactor.AddObserver(vtkCommand.CreateTimerEvent, lambda *_: self._timer.start(10)) self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, lambda *_: self._timer.stop()) self.interactor.Start() # Create renderer self.renderer = vtkRenderer() self.renderWindow.AddRenderer(self.renderer) # Timer for the interactor self._timer = QTimer(self) self._timer.timeout.connect(self.interactor.TimerEvent) # Some tracked input state self._pressedButton = Qt.NoButton self._lastMouseX = 0 self._lastMouseY = 0 self._lastModifiers = Qt.NoModifier self._lastButtons = Qt.NoButton self._wheelDelta = 0 # Finalize render window before we're destroyed self._hidden = QWidget(self) self._hidden.hide() self._hidden.destroyed.connect(self.renderWindow.Finalize) # # Handle VTK render window events # def _onStartEvent(self, *_): self.makeCurrent() self.renderWindow.PushState() # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( def _onEndEvent(self, *_): self.renderWindow.PopState() def _onWindowMakeCurrentEvent(self, *_): pass # Handled automatically by QOpenGLWidget def _onWindowIsCurrentEvent(self, sender, event, callData): callData = True # FIXME: This won't work... def _onWindowIsDirectEvent(self, sender, event, callData): callData = True # FIXME: This won't work... def _onWindowSupportsOpenGLEvent(self, sender, event, callData): callData = True # FIXME: This won't work... def _onWindowFrameEvent(self, *_): if self.renderWindow.GetSwapBuffers(): self.update() def _onCursorChangedEvent(self): def showCursor(): vtkCursor = self.renderWindow.GetCurrentCursor() qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) self.setCursor(qtCursor) # Defer until cursor has actually changed QTimer.singleShot(0, showCursor) # # Implement QOpenGLWidget functions # def initializeGL(self): self.renderWindow.OpenGLInitContext() def paintGL(self): self.interactor.Render() def resizeGL(self, width, height): self.renderWindow.SetSize(width, height) self.interactor.SetSize(width, height) self.interactor.ConfigureEvent() # # Handle QWidget events # def closeEvent(self, _): self.renderWindow.Finalize() def sizeHint(self): return QSize(400, 400) def moveEvent(self, event): super().moveEvent(event) self.renderWindow.SetPosition(self.x(), self.y()) def enterEvent(self, event): ctrl, shift = self._modifiers(event) self.interactor.SetEventInformationFlipY(self._lastMouseX, self._lastMouseY, ctrl, shift, chr(0), 0, None) self.interactor.EnterEvent() def leaveEvent(self, event): ctrl, shift = self._modifiers(event) self.interactor.SetEventInformationFlipY(self._lastMouseX, self._lastMouseY, ctrl, shift, chr(0), 0, None) self.interactor.LeaveEvent() def mousePressEvent(self, event): ctrl, shift = self._modifiers(event) repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 self.interactor.SetEventInformationFlipY(event.x(), event.y(), ctrl, shift, chr(0), repeat, None) self._pressedButton = event.button() if self._pressedButton == Qt.LeftButton: self.interactor.LeftButtonPressEvent() elif self._pressedButton == Qt.RightButton: self.interactor.RightButtonPressEvent() elif self._pressedButton == Qt.MidButton: self.interactor.MiddleButtonPressEvent() def mouseReleaseEvent(self, event): ctrl, shift = self._modifiers(event) self.interactor.SetEventInformationFlipY(event.x(), event.y(), ctrl, shift, chr(0), 0, None) if self._pressedButton == Qt.LeftButton: self.interactor.LeftButtonReleaseEvent() elif self._pressedButton == Qt.RightButton: self.interactor.RightButtonReleaseEvent() elif self._pressedButton == Qt.MidButton: self.interactor.MiddleButtonReleaseEvent() self._pressedButton = Qt.NoButton def mouseMoveEvent(self, event): self._lastModifiers = event.modifiers() self._lastButtons = event.buttons() self._lastMouseX = event.x() self._lastMouseY = event.y() ctrl, shift = self._modifiers(event) self.interactor.SetEventInformationFlipY(event.x(), event.y(), ctrl, shift, chr(0), 0, None) self.interactor.MouseMoveEvent() def keyPressEvent(self, event): ctrl, shift = self._modifiers(event) key = str(event.text()) if event.key() < 256 else chr(0) keySym = VTKWidget._qtKeyToKeySymbol(event.key()) if shift and len(keySym) == 1 and keySym.isalpha(): keySym = keySym.upper() self.interactor.SetEventInformationFlipY(self._lastMouseX, self._lastMouseY, ctrl, shift, key, 0, keySym) self.interactor.KeyPressEvent() self.interactor.CharEvent() def keyReleaseEvent(self, event): ctrl, shift = self._modifiers(event) key = chr(event.key()) if event.key() < 256 else chr(0) self.interactor.SetEventInformationFlipY(self._lastMouseX, self._lastMouseY, ctrl, shift, key, 0, None) self.interactor.KeyReleaseEvent() def wheelEvent(self, event): self._wheelDelta += event.angleDelta().y() if self._wheelDelta >= 120: self.interactor.MouseWheelForwardEvent() self._wheelDelta = 0 elif self._wheelDelta <= -120: self.interactor.MouseWheelBackwardEvent() self._wheelDelta = 0 def _modifiers(self, event): ctrl = shift = False if hasattr(event, 'modifiers'): if event.modifiers() & Qt.ShiftModifier: shift = True if event.modifiers() & Qt.ControlModifier: ctrl = True else: if self._lastModifiers & Qt.ShiftModifier: shift = True if self._lastModifiers & Qt.ControlModifier: ctrl = True return ctrl, shift @classmethod def _qtKeyToKeySymbol(cls, key): if key not in VTKWidget._keySymbols: return None return VTKWidget._keySymbols[key] # Maps VTK cursors to Qt cursors _cursors = { VTK_CURSOR_DEFAULT: Qt.ArrowCursor, VTK_CURSOR_ARROW: Qt.ArrowCursor, VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, VTK_CURSOR_SIZENS: Qt.SizeVerCursor, VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, VTK_CURSOR_HAND: Qt.PointingHandCursor, VTK_CURSOR_CROSSHAIR: Qt.CrossCursor } # Maps Qt keys to VTK key symbols _keySymbols = { Qt.Key_Backspace: 'BackSpace', Qt.Key_Tab: 'Tab', Qt.Key_Backtab: 'Tab', # Qt.Key_Clear : 'Clear', Qt.Key_Return: 'Return', Qt.Key_Enter: 'Return', Qt.Key_Shift: 'Shift_L', Qt.Key_Control: 'Control_L', Qt.Key_Alt: 'Alt_L', Qt.Key_Pause: 'Pause', Qt.Key_CapsLock: 'Caps_Lock', Qt.Key_Escape: 'Escape', Qt.Key_Space: 'space', # Qt.Key_Prior : 'Prior', # Qt.Key_Next : 'Next', Qt.Key_End: 'End', Qt.Key_Home: 'Home', Qt.Key_Left: 'Left', Qt.Key_Up: 'Up', Qt.Key_Right: 'Right', Qt.Key_Down: 'Down', Qt.Key_SysReq: 'Snapshot', Qt.Key_Insert: 'Insert', Qt.Key_Delete: 'Delete', Qt.Key_Help: 'Help', Qt.Key_0: '0', Qt.Key_1: '1', Qt.Key_2: '2', Qt.Key_3: '3', Qt.Key_4: '4', Qt.Key_5: '5', Qt.Key_6: '6', Qt.Key_7: '7', Qt.Key_8: '8', Qt.Key_9: '9', Qt.Key_A: 'a', Qt.Key_B: 'b', Qt.Key_C: 'c', Qt.Key_D: 'd', Qt.Key_E: 'e', Qt.Key_F: 'f', Qt.Key_G: 'g', Qt.Key_H: 'h', Qt.Key_I: 'i', Qt.Key_J: 'j', Qt.Key_K: 'k', Qt.Key_L: 'l', Qt.Key_M: 'm', Qt.Key_N: 'n', Qt.Key_O: 'o', Qt.Key_P: 'p', Qt.Key_Q: 'q', Qt.Key_R: 'r', Qt.Key_S: 's', Qt.Key_T: 't', Qt.Key_U: 'u', Qt.Key_V: 'v', Qt.Key_W: 'w', Qt.Key_X: 'x', Qt.Key_Y: 'y', Qt.Key_Z: 'z', Qt.Key_Asterisk: 'asterisk', Qt.Key_Plus: 'plus', Qt.Key_Minus: 'minus', Qt.Key_Period: 'period', Qt.Key_Slash: 'slash', Qt.Key_F1: 'F1', Qt.Key_F2: 'F2', Qt.Key_F3: 'F3', Qt.Key_F4: 'F4', Qt.Key_F5: 'F5', Qt.Key_F6: 'F6', Qt.Key_F7: 'F7', Qt.Key_F8: 'F8', Qt.Key_F9: 'F9', Qt.Key_F10: 'F10', Qt.Key_F11: 'F11', Qt.Key_F12: 'F12', Qt.Key_F13: 'F13', Qt.Key_F14: 'F14', Qt.Key_F15: 'F15', Qt.Key_F16: 'F16', Qt.Key_F17: 'F17', Qt.Key_F18: 'F18', Qt.Key_F19: 'F19', Qt.Key_F20: 'F20', Qt.Key_F21: 'F21', Qt.Key_F22: 'F22', Qt.Key_F23: 'F23', Qt.Key_F24: 'F24', Qt.Key_NumLock: 'Num_Lock', Qt.Key_ScrollLock: 'Scroll_Lock' } def example(): # # Try out VTKWidget by showing a couple of cones # from sys import argv, exit from PyQt5.QtWidgets import QApplication, QVBoxLayout from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor app = QApplication(argv) layout = QVBoxLayout() for i in range(2): widget = VTKWidget() coneSource = vtkConeSource() coneSource.SetResolution(8) coneMapper = vtkPolyDataMapper() coneMapper.SetInputConnection(coneSource.GetOutputPort()) coneActor = vtkActor() coneActor.SetMapper(coneMapper) widget.renderer.AddActor(coneActor) layout.addWidget(widget) container = QWidget() container.setLayout(layout) container.show() exit(app.exec_()) if __name__ == '__main__': example() -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 07:11:39 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 13:11:39 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-26 13:06 GMT+02:00 Elvis Stansvik : > Hi, > > In my quest to create a PyQt5 widget based on QOpenGLWidget for > showing/interacting with VTK, I now have something that seems to work > (including the whole thing as a runnable example below). > > I do however have two problems (indicated by "FIXME:"s in the code below): > > 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when handling > the render window StartEvent (commented out below), similar to how > QVTKWidget2 does, I get a segmentation fault: > > (gdb) bt > #0 0x0000000000000000 in ?? () > #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () from > /usr/lib/libvtkRenderingOpenGL2.so.1 > #2 0x00007fffd8de8479 in ?? () from > /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 > #3 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #8 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #10 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from > /usr/lib/libpython3.5m.so.1.0 > #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, unsigned > long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 > #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 > #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from > /usr/lib/libvtkRenderingCore.so.1 > #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from > /usr/lib/libvtkRenderingOpenGL2.so.1 > #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from > /usr/lib/libvtkRenderingCore.so.1 > #17 0x00007fffdf3ee789 in ?? () from > /usr/lib/libvtkRenderingCorePython35D.so.1 > #18 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #23 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #25 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #28 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #33 0x00007ffff7a33aeb in PyEval_EvalCode () from > /usr/lib/libpython3.5m.so.1.0 > #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 > #35 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #42 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 > #45 0x0000000000400ae7 in main () > (gdb) > > Sorry for the lack of debugging symbols, but before I recompile VTK with > debugging symbols, I thought I'd ask if anyone has an idea what may be the > reason for the crash? I haven't seen any adverse effects from not calling > this function, but I suspect something is broken? (how can I test?) > > 2. I can't seem to find a way to properly implement the > WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent > render window events. E.g. (from below): > > def _onWindowIsCurrentEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowIsDirectEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowSupportsOpenGLEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > The callData is a bool* and the handler is expected to write a bool to the > pointed memory. I can't see that there's any way to do this from Python (is > it possible with ctypes somehow?). > > So far I haven't seen any adverse effects from not implementing these > three events correctly, but expect something to be broken..? > In fact, so far I haven't seen any of these three events being emitted by the render window at all. When are they emitted? How can I provoke emissions of them to test how broken my widget is from not handling them correctly? Elvis > > Thankful for any advice on these two issues, and it would be great if > someone could try out the example, with the > > # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( > > line uncommented, to confirm the segfault I'm seeing. > > Cheers, > Elvis > > > from PyQt5.QtCore import Qt, QTimer, QEvent, QSize > from PyQt5.QtGui import QSurfaceFormat > from PyQt5.QtWidgets import QWidget, QOpenGLWidget > > from vtk import vtkGenericOpenGLRenderWindow > from vtk import vtkGenericRenderWindowInteractor > from vtk import vtkCommand > from vtk import vtkRenderer > > from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE > from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE > from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL > from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR > > > class VTKWidget(QOpenGLWidget): > > def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), > *args, **kwargs): > super().__init__(*args, **kwargs) > > # Request OpenGL 3.2 compatibility profile and enable > multi-sampling > surfaceFormat.setMajorVersion(3) > surfaceFormat.setMinorVersion(2) > surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) > surfaceFormat.setSamples(8) > self.setFormat(surfaceFormat) > > # Create render window > self.renderWindow = vtkGenericOpenGLRenderWindow() > self.renderWindow.SetSize(self.width(), self.height()) > self.renderWindow.SetPosition(self.x(), self.y()) > > self.renderWindow.AddObserver(vtkCommand.StartEvent, > self._onStartEvent) > self.renderWindow.AddObserver(vtkCommand.EndEvent, > self._onEndEvent) > self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, > self._onCursorChangedEvent) > self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, > self._onWindowMakeCurrentEvent) > self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, > self._onWindowIsCurrentEvent) > self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, > self._onWindowFrameEvent) > self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, > self._onWindowIsDirectEvent) > self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, > self._onWindowSupportsOpenGLEvent) > > # Create interactor > self.interactor = vtkGenericRenderWindowInteractor() > self.interactor.SetRenderWindow(self.renderWindow) > self.interactor.SetSize(self.width(), self.height()) > self.interactor.AddObserver(vtkCommand.CreateTimerEvent, > lambda *_: self._timer.start(10)) > self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, > lambda *_: self._timer.stop()) > self.interactor.Start() > > # Create renderer > self.renderer = vtkRenderer() > self.renderWindow.AddRenderer(self.renderer) > > # Timer for the interactor > self._timer = QTimer(self) > self._timer.timeout.connect(self.interactor.TimerEvent) > > # Some tracked input state > self._pressedButton = Qt.NoButton > self._lastMouseX = 0 > self._lastMouseY = 0 > self._lastModifiers = Qt.NoModifier > self._lastButtons = Qt.NoButton > self._wheelDelta = 0 > > # Finalize render window before we're destroyed > self._hidden = QWidget(self) > self._hidden.hide() > self._hidden.destroyed.connect(self.renderWindow.Finalize) > > # > # Handle VTK render window events > # > > def _onStartEvent(self, *_): > self.makeCurrent() > self.renderWindow.PushState() > # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( > > def _onEndEvent(self, *_): > self.renderWindow.PopState() > > def _onWindowMakeCurrentEvent(self, *_): > pass # Handled automatically by QOpenGLWidget > > def _onWindowIsCurrentEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowIsDirectEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowSupportsOpenGLEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowFrameEvent(self, *_): > if self.renderWindow.GetSwapBuffers(): > self.update() > > def _onCursorChangedEvent(self): > > def showCursor(): > vtkCursor = self.renderWindow.GetCurrentCursor() > qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) > self.setCursor(qtCursor) > > # Defer until cursor has actually changed > QTimer.singleShot(0, showCursor) > > # > # Implement QOpenGLWidget functions > # > > def initializeGL(self): > self.renderWindow.OpenGLInitContext() > > def paintGL(self): > self.interactor.Render() > > def resizeGL(self, width, height): > self.renderWindow.SetSize(width, height) > self.interactor.SetSize(width, height) > self.interactor.ConfigureEvent() > > # > # Handle QWidget events > # > > def closeEvent(self, _): > self.renderWindow.Finalize() > > def sizeHint(self): > return QSize(400, 400) > > def moveEvent(self, event): > super().moveEvent(event) > self.renderWindow.SetPosition(self.x(), self.y()) > > def enterEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, chr(0), 0, > None) > self.interactor.EnterEvent() > > def leaveEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, chr(0), 0, > None) > self.interactor.LeaveEvent() > > def mousePressEvent(self, event): > ctrl, shift = self._modifiers(event) > repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), repeat, None) > > self._pressedButton = event.button() > > if self._pressedButton == Qt.LeftButton: > self.interactor.LeftButtonPressEvent() > elif self._pressedButton == Qt.RightButton: > self.interactor.RightButtonPressEvent() > elif self._pressedButton == Qt.MidButton: > self.interactor.MiddleButtonPressEvent() > > def mouseReleaseEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), 0, None) > > if self._pressedButton == Qt.LeftButton: > self.interactor.LeftButtonReleaseEvent() > elif self._pressedButton == Qt.RightButton: > self.interactor.RightButtonReleaseEvent() > elif self._pressedButton == Qt.MidButton: > self.interactor.MiddleButtonReleaseEvent() > > self._pressedButton = Qt.NoButton > > def mouseMoveEvent(self, event): > self._lastModifiers = event.modifiers() > self._lastButtons = event.buttons() > self._lastMouseX = event.x() > self._lastMouseY = event.y() > > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), 0, None) > self.interactor.MouseMoveEvent() > > def keyPressEvent(self, event): > ctrl, shift = self._modifiers(event) > key = str(event.text()) if event.key() < 256 else chr(0) > keySym = VTKWidget._qtKeyToKeySymbol(event.key()) > > if shift and len(keySym) == 1 and keySym.isalpha(): > keySym = keySym.upper() > > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, key, 0, > keySym) > self.interactor.KeyPressEvent() > self.interactor.CharEvent() > > def keyReleaseEvent(self, event): > ctrl, shift = self._modifiers(event) > key = chr(event.key()) if event.key() < 256 else chr(0) > > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, key, 0, None) > self.interactor.KeyReleaseEvent() > > def wheelEvent(self, event): > self._wheelDelta += event.angleDelta().y() > > if self._wheelDelta >= 120: > self.interactor.MouseWheelForwardEvent() > self._wheelDelta = 0 > elif self._wheelDelta <= -120: > self.interactor.MouseWheelBackwardEvent() > self._wheelDelta = 0 > > def _modifiers(self, event): > ctrl = shift = False > > if hasattr(event, 'modifiers'): > if event.modifiers() & Qt.ShiftModifier: > shift = True > if event.modifiers() & Qt.ControlModifier: > ctrl = True > else: > if self._lastModifiers & Qt.ShiftModifier: > shift = True > if self._lastModifiers & Qt.ControlModifier: > ctrl = True > > return ctrl, shift > > @classmethod > def _qtKeyToKeySymbol(cls, key): > if key not in VTKWidget._keySymbols: > return None > return VTKWidget._keySymbols[key] > > # Maps VTK cursors to Qt cursors > _cursors = { > VTK_CURSOR_DEFAULT: Qt.ArrowCursor, > VTK_CURSOR_ARROW: Qt.ArrowCursor, > VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, > VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, > VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, > VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, > VTK_CURSOR_SIZENS: Qt.SizeVerCursor, > VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, > VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, > VTK_CURSOR_HAND: Qt.PointingHandCursor, > VTK_CURSOR_CROSSHAIR: Qt.CrossCursor > } > > # Maps Qt keys to VTK key symbols > _keySymbols = { > Qt.Key_Backspace: 'BackSpace', > Qt.Key_Tab: 'Tab', > Qt.Key_Backtab: 'Tab', > # Qt.Key_Clear : 'Clear', > Qt.Key_Return: 'Return', > Qt.Key_Enter: 'Return', > Qt.Key_Shift: 'Shift_L', > Qt.Key_Control: 'Control_L', > Qt.Key_Alt: 'Alt_L', > Qt.Key_Pause: 'Pause', > Qt.Key_CapsLock: 'Caps_Lock', > Qt.Key_Escape: 'Escape', > Qt.Key_Space: 'space', > # Qt.Key_Prior : 'Prior', > # Qt.Key_Next : 'Next', > Qt.Key_End: 'End', > Qt.Key_Home: 'Home', > Qt.Key_Left: 'Left', > Qt.Key_Up: 'Up', > Qt.Key_Right: 'Right', > Qt.Key_Down: 'Down', > Qt.Key_SysReq: 'Snapshot', > Qt.Key_Insert: 'Insert', > Qt.Key_Delete: 'Delete', > Qt.Key_Help: 'Help', > Qt.Key_0: '0', > Qt.Key_1: '1', > Qt.Key_2: '2', > Qt.Key_3: '3', > Qt.Key_4: '4', > Qt.Key_5: '5', > Qt.Key_6: '6', > Qt.Key_7: '7', > Qt.Key_8: '8', > Qt.Key_9: '9', > Qt.Key_A: 'a', > Qt.Key_B: 'b', > Qt.Key_C: 'c', > Qt.Key_D: 'd', > Qt.Key_E: 'e', > Qt.Key_F: 'f', > Qt.Key_G: 'g', > Qt.Key_H: 'h', > Qt.Key_I: 'i', > Qt.Key_J: 'j', > Qt.Key_K: 'k', > Qt.Key_L: 'l', > Qt.Key_M: 'm', > Qt.Key_N: 'n', > Qt.Key_O: 'o', > Qt.Key_P: 'p', > Qt.Key_Q: 'q', > Qt.Key_R: 'r', > Qt.Key_S: 's', > Qt.Key_T: 't', > Qt.Key_U: 'u', > Qt.Key_V: 'v', > Qt.Key_W: 'w', > Qt.Key_X: 'x', > Qt.Key_Y: 'y', > Qt.Key_Z: 'z', > Qt.Key_Asterisk: 'asterisk', > Qt.Key_Plus: 'plus', > Qt.Key_Minus: 'minus', > Qt.Key_Period: 'period', > Qt.Key_Slash: 'slash', > Qt.Key_F1: 'F1', > Qt.Key_F2: 'F2', > Qt.Key_F3: 'F3', > Qt.Key_F4: 'F4', > Qt.Key_F5: 'F5', > Qt.Key_F6: 'F6', > Qt.Key_F7: 'F7', > Qt.Key_F8: 'F8', > Qt.Key_F9: 'F9', > Qt.Key_F10: 'F10', > Qt.Key_F11: 'F11', > Qt.Key_F12: 'F12', > Qt.Key_F13: 'F13', > Qt.Key_F14: 'F14', > Qt.Key_F15: 'F15', > Qt.Key_F16: 'F16', > Qt.Key_F17: 'F17', > Qt.Key_F18: 'F18', > Qt.Key_F19: 'F19', > Qt.Key_F20: 'F20', > Qt.Key_F21: 'F21', > Qt.Key_F22: 'F22', > Qt.Key_F23: 'F23', > Qt.Key_F24: 'F24', > Qt.Key_NumLock: 'Num_Lock', > Qt.Key_ScrollLock: 'Scroll_Lock' > } > > def example(): > # > # Try out VTKWidget by showing a couple of cones > # > from sys import argv, exit > from PyQt5.QtWidgets import QApplication, QVBoxLayout > from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor > > app = QApplication(argv) > > layout = QVBoxLayout() > > for i in range(2): > widget = VTKWidget() > > coneSource = vtkConeSource() > coneSource.SetResolution(8) > > coneMapper = vtkPolyDataMapper() > coneMapper.SetInputConnection(coneSource.GetOutputPort()) > > coneActor = vtkActor() > coneActor.SetMapper(coneMapper) > > widget.renderer.AddActor(coneActor) > > layout.addWidget(widget) > > container = QWidget() > container.setLayout(layout) > container.show() > > exit(app.exec_()) > > > if __name__ == '__main__': > example() > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arasakumaran at yahoo.com Sun Jun 26 07:11:00 2016 From: arasakumaran at yahoo.com (arasu) Date: Sun, 26 Jun 2016 11:11:00 +0000 (UTC) Subject: [vtkusers] Relationship between interactor/render window and VTKRenderWindowInteractor for VTK Charting References: <2136307302.1704615.1466939460597.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <2136307302.1704615.1466939460597.JavaMail.yahoo@mail.yahoo.com> The problem is similiar to the one reported by Elvis Stansvik earlier this month about creating and displaying Chart in own Window. I am using C++ on Windows and VTK7.0. I am not using QT. I have adapted the MFC version that comes with VTK to not be dependent on MFC. I am using the lines below (based on the documentation shows for QT ) SetRenderWindow(vtkWin32OpenGLRenderWindow::SafeDownCast(view->GetRenderWindow())); view->SetInteractor(GetInteractor()); I am able to get the chart to display on the Window I create in the program. However the Interactor does not work - i.e. mouse actions do not pan/zoom the chart. I have no such problem when using VTK for other visualizations -creating and connecting Mapper / Actor / Renderer / Interactor etc. and connecting the renderwindow to the renderer. The visualization is shown in my window and the display responds to mouse and keyboard actions. What do I need to do in order to do the same with VTK Charting ? The interacting seems to have been initialized and started as I can put a break in the program and step through the Interactor code for mouse events. Thanks in advance, From elvis.stansvik at orexplore.com Sun Jun 26 07:31:18 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 13:31:18 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-26 13:06 GMT+02:00 Elvis Stansvik : > Hi, > > In my quest to create a PyQt5 widget based on QOpenGLWidget for > showing/interacting with VTK, I now have something that seems to work > (including the whole thing as a runnable example below). > It was a little too early to say "seems to work": When trying to show one of the volumes I need to render, I get (gui) [estan at pyret orexplore.gui]$ python -m orexplore.gui.main enabling depth test ERROR: In /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 1682 vtkGenericOpenGLRenderWindow (0x308c3f0): Hardware does not support the number of textures defined. Segmentation fault (core dumped) (gui) [estan at pyret orexplore.gui]$ on my Sandybridge laptop :/ Anyone know if I'd be able to use the old OpenGL backend here? Elvis > > I do however have two problems (indicated by "FIXME:"s in the code below): > > 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when handling > the render window StartEvent (commented out below), similar to how > QVTKWidget2 does, I get a segmentation fault: > > (gdb) bt > #0 0x0000000000000000 in ?? () > #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () from > /usr/lib/libvtkRenderingOpenGL2.so.1 > #2 0x00007fffd8de8479 in ?? () from > /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 > #3 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #8 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #10 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from > /usr/lib/libpython3.5m.so.1.0 > #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, unsigned > long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 > #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 > #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from > /usr/lib/libvtkRenderingCore.so.1 > #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from > /usr/lib/libvtkRenderingOpenGL2.so.1 > #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from > /usr/lib/libvtkRenderingCore.so.1 > #17 0x00007fffdf3ee789 in ?? () from > /usr/lib/libvtkRenderingCorePython35D.so.1 > #18 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #23 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #25 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #28 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #33 0x00007ffff7a33aeb in PyEval_EvalCode () from > /usr/lib/libpython3.5m.so.1.0 > #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 > #35 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #42 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 > #45 0x0000000000400ae7 in main () > (gdb) > > Sorry for the lack of debugging symbols, but before I recompile VTK with > debugging symbols, I thought I'd ask if anyone has an idea what may be the > reason for the crash? I haven't seen any adverse effects from not calling > this function, but I suspect something is broken? (how can I test?) > > 2. I can't seem to find a way to properly implement the > WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent > render window events. E.g. (from below): > > def _onWindowIsCurrentEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowIsDirectEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowSupportsOpenGLEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > The callData is a bool* and the handler is expected to write a bool to the > pointed memory. I can't see that there's any way to do this from Python (is > it possible with ctypes somehow?). > > So far I haven't seen any adverse effects from not implementing these > three events correctly, but expect something to be broken..? > > Thankful for any advice on these two issues, and it would be great if > someone could try out the example, with the > > # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( > > line uncommented, to confirm the segfault I'm seeing. > > Cheers, > Elvis > > > from PyQt5.QtCore import Qt, QTimer, QEvent, QSize > from PyQt5.QtGui import QSurfaceFormat > from PyQt5.QtWidgets import QWidget, QOpenGLWidget > > from vtk import vtkGenericOpenGLRenderWindow > from vtk import vtkGenericRenderWindowInteractor > from vtk import vtkCommand > from vtk import vtkRenderer > > from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE > from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE > from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL > from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR > > > class VTKWidget(QOpenGLWidget): > > def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), > *args, **kwargs): > super().__init__(*args, **kwargs) > > # Request OpenGL 3.2 compatibility profile and enable > multi-sampling > surfaceFormat.setMajorVersion(3) > surfaceFormat.setMinorVersion(2) > surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) > surfaceFormat.setSamples(8) > self.setFormat(surfaceFormat) > > # Create render window > self.renderWindow = vtkGenericOpenGLRenderWindow() > self.renderWindow.SetSize(self.width(), self.height()) > self.renderWindow.SetPosition(self.x(), self.y()) > > self.renderWindow.AddObserver(vtkCommand.StartEvent, > self._onStartEvent) > self.renderWindow.AddObserver(vtkCommand.EndEvent, > self._onEndEvent) > self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, > self._onCursorChangedEvent) > self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, > self._onWindowMakeCurrentEvent) > self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, > self._onWindowIsCurrentEvent) > self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, > self._onWindowFrameEvent) > self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, > self._onWindowIsDirectEvent) > self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, > self._onWindowSupportsOpenGLEvent) > > # Create interactor > self.interactor = vtkGenericRenderWindowInteractor() > self.interactor.SetRenderWindow(self.renderWindow) > self.interactor.SetSize(self.width(), self.height()) > self.interactor.AddObserver(vtkCommand.CreateTimerEvent, > lambda *_: self._timer.start(10)) > self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, > lambda *_: self._timer.stop()) > self.interactor.Start() > > # Create renderer > self.renderer = vtkRenderer() > self.renderWindow.AddRenderer(self.renderer) > > # Timer for the interactor > self._timer = QTimer(self) > self._timer.timeout.connect(self.interactor.TimerEvent) > > # Some tracked input state > self._pressedButton = Qt.NoButton > self._lastMouseX = 0 > self._lastMouseY = 0 > self._lastModifiers = Qt.NoModifier > self._lastButtons = Qt.NoButton > self._wheelDelta = 0 > > # Finalize render window before we're destroyed > self._hidden = QWidget(self) > self._hidden.hide() > self._hidden.destroyed.connect(self.renderWindow.Finalize) > > # > # Handle VTK render window events > # > > def _onStartEvent(self, *_): > self.makeCurrent() > self.renderWindow.PushState() > # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( > > def _onEndEvent(self, *_): > self.renderWindow.PopState() > > def _onWindowMakeCurrentEvent(self, *_): > pass # Handled automatically by QOpenGLWidget > > def _onWindowIsCurrentEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowIsDirectEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowSupportsOpenGLEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowFrameEvent(self, *_): > if self.renderWindow.GetSwapBuffers(): > self.update() > > def _onCursorChangedEvent(self): > > def showCursor(): > vtkCursor = self.renderWindow.GetCurrentCursor() > qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) > self.setCursor(qtCursor) > > # Defer until cursor has actually changed > QTimer.singleShot(0, showCursor) > > # > # Implement QOpenGLWidget functions > # > > def initializeGL(self): > self.renderWindow.OpenGLInitContext() > > def paintGL(self): > self.interactor.Render() > > def resizeGL(self, width, height): > self.renderWindow.SetSize(width, height) > self.interactor.SetSize(width, height) > self.interactor.ConfigureEvent() > > # > # Handle QWidget events > # > > def closeEvent(self, _): > self.renderWindow.Finalize() > > def sizeHint(self): > return QSize(400, 400) > > def moveEvent(self, event): > super().moveEvent(event) > self.renderWindow.SetPosition(self.x(), self.y()) > > def enterEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, chr(0), 0, > None) > self.interactor.EnterEvent() > > def leaveEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, chr(0), 0, > None) > self.interactor.LeaveEvent() > > def mousePressEvent(self, event): > ctrl, shift = self._modifiers(event) > repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), repeat, None) > > self._pressedButton = event.button() > > if self._pressedButton == Qt.LeftButton: > self.interactor.LeftButtonPressEvent() > elif self._pressedButton == Qt.RightButton: > self.interactor.RightButtonPressEvent() > elif self._pressedButton == Qt.MidButton: > self.interactor.MiddleButtonPressEvent() > > def mouseReleaseEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), 0, None) > > if self._pressedButton == Qt.LeftButton: > self.interactor.LeftButtonReleaseEvent() > elif self._pressedButton == Qt.RightButton: > self.interactor.RightButtonReleaseEvent() > elif self._pressedButton == Qt.MidButton: > self.interactor.MiddleButtonReleaseEvent() > > self._pressedButton = Qt.NoButton > > def mouseMoveEvent(self, event): > self._lastModifiers = event.modifiers() > self._lastButtons = event.buttons() > self._lastMouseX = event.x() > self._lastMouseY = event.y() > > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), 0, None) > self.interactor.MouseMoveEvent() > > def keyPressEvent(self, event): > ctrl, shift = self._modifiers(event) > key = str(event.text()) if event.key() < 256 else chr(0) > keySym = VTKWidget._qtKeyToKeySymbol(event.key()) > > if shift and len(keySym) == 1 and keySym.isalpha(): > keySym = keySym.upper() > > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, key, 0, > keySym) > self.interactor.KeyPressEvent() > self.interactor.CharEvent() > > def keyReleaseEvent(self, event): > ctrl, shift = self._modifiers(event) > key = chr(event.key()) if event.key() < 256 else chr(0) > > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, key, 0, None) > self.interactor.KeyReleaseEvent() > > def wheelEvent(self, event): > self._wheelDelta += event.angleDelta().y() > > if self._wheelDelta >= 120: > self.interactor.MouseWheelForwardEvent() > self._wheelDelta = 0 > elif self._wheelDelta <= -120: > self.interactor.MouseWheelBackwardEvent() > self._wheelDelta = 0 > > def _modifiers(self, event): > ctrl = shift = False > > if hasattr(event, 'modifiers'): > if event.modifiers() & Qt.ShiftModifier: > shift = True > if event.modifiers() & Qt.ControlModifier: > ctrl = True > else: > if self._lastModifiers & Qt.ShiftModifier: > shift = True > if self._lastModifiers & Qt.ControlModifier: > ctrl = True > > return ctrl, shift > > @classmethod > def _qtKeyToKeySymbol(cls, key): > if key not in VTKWidget._keySymbols: > return None > return VTKWidget._keySymbols[key] > > # Maps VTK cursors to Qt cursors > _cursors = { > VTK_CURSOR_DEFAULT: Qt.ArrowCursor, > VTK_CURSOR_ARROW: Qt.ArrowCursor, > VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, > VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, > VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, > VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, > VTK_CURSOR_SIZENS: Qt.SizeVerCursor, > VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, > VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, > VTK_CURSOR_HAND: Qt.PointingHandCursor, > VTK_CURSOR_CROSSHAIR: Qt.CrossCursor > } > > # Maps Qt keys to VTK key symbols > _keySymbols = { > Qt.Key_Backspace: 'BackSpace', > Qt.Key_Tab: 'Tab', > Qt.Key_Backtab: 'Tab', > # Qt.Key_Clear : 'Clear', > Qt.Key_Return: 'Return', > Qt.Key_Enter: 'Return', > Qt.Key_Shift: 'Shift_L', > Qt.Key_Control: 'Control_L', > Qt.Key_Alt: 'Alt_L', > Qt.Key_Pause: 'Pause', > Qt.Key_CapsLock: 'Caps_Lock', > Qt.Key_Escape: 'Escape', > Qt.Key_Space: 'space', > # Qt.Key_Prior : 'Prior', > # Qt.Key_Next : 'Next', > Qt.Key_End: 'End', > Qt.Key_Home: 'Home', > Qt.Key_Left: 'Left', > Qt.Key_Up: 'Up', > Qt.Key_Right: 'Right', > Qt.Key_Down: 'Down', > Qt.Key_SysReq: 'Snapshot', > Qt.Key_Insert: 'Insert', > Qt.Key_Delete: 'Delete', > Qt.Key_Help: 'Help', > Qt.Key_0: '0', > Qt.Key_1: '1', > Qt.Key_2: '2', > Qt.Key_3: '3', > Qt.Key_4: '4', > Qt.Key_5: '5', > Qt.Key_6: '6', > Qt.Key_7: '7', > Qt.Key_8: '8', > Qt.Key_9: '9', > Qt.Key_A: 'a', > Qt.Key_B: 'b', > Qt.Key_C: 'c', > Qt.Key_D: 'd', > Qt.Key_E: 'e', > Qt.Key_F: 'f', > Qt.Key_G: 'g', > Qt.Key_H: 'h', > Qt.Key_I: 'i', > Qt.Key_J: 'j', > Qt.Key_K: 'k', > Qt.Key_L: 'l', > Qt.Key_M: 'm', > Qt.Key_N: 'n', > Qt.Key_O: 'o', > Qt.Key_P: 'p', > Qt.Key_Q: 'q', > Qt.Key_R: 'r', > Qt.Key_S: 's', > Qt.Key_T: 't', > Qt.Key_U: 'u', > Qt.Key_V: 'v', > Qt.Key_W: 'w', > Qt.Key_X: 'x', > Qt.Key_Y: 'y', > Qt.Key_Z: 'z', > Qt.Key_Asterisk: 'asterisk', > Qt.Key_Plus: 'plus', > Qt.Key_Minus: 'minus', > Qt.Key_Period: 'period', > Qt.Key_Slash: 'slash', > Qt.Key_F1: 'F1', > Qt.Key_F2: 'F2', > Qt.Key_F3: 'F3', > Qt.Key_F4: 'F4', > Qt.Key_F5: 'F5', > Qt.Key_F6: 'F6', > Qt.Key_F7: 'F7', > Qt.Key_F8: 'F8', > Qt.Key_F9: 'F9', > Qt.Key_F10: 'F10', > Qt.Key_F11: 'F11', > Qt.Key_F12: 'F12', > Qt.Key_F13: 'F13', > Qt.Key_F14: 'F14', > Qt.Key_F15: 'F15', > Qt.Key_F16: 'F16', > Qt.Key_F17: 'F17', > Qt.Key_F18: 'F18', > Qt.Key_F19: 'F19', > Qt.Key_F20: 'F20', > Qt.Key_F21: 'F21', > Qt.Key_F22: 'F22', > Qt.Key_F23: 'F23', > Qt.Key_F24: 'F24', > Qt.Key_NumLock: 'Num_Lock', > Qt.Key_ScrollLock: 'Scroll_Lock' > } > > def example(): > # > # Try out VTKWidget by showing a couple of cones > # > from sys import argv, exit > from PyQt5.QtWidgets import QApplication, QVBoxLayout > from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor > > app = QApplication(argv) > > layout = QVBoxLayout() > > for i in range(2): > widget = VTKWidget() > > coneSource = vtkConeSource() > coneSource.SetResolution(8) > > coneMapper = vtkPolyDataMapper() > coneMapper.SetInputConnection(coneSource.GetOutputPort()) > > coneActor = vtkActor() > coneActor.SetMapper(coneMapper) > > widget.renderer.AddActor(coneActor) > > layout.addWidget(widget) > > container = QWidget() > container.setLayout(layout) > container.show() > > exit(app.exec_()) > > > if __name__ == '__main__': > example() > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 08:17:33 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 14:17:33 +0200 Subject: [vtkusers] Relationship between interactor/render window and VTKRenderWindowInteractor for VTK Charting In-Reply-To: <2136307302.1704615.1466939460597.JavaMail.yahoo@mail.yahoo.com> References: <2136307302.1704615.1466939460597.JavaMail.yahoo.ref@mail.yahoo.com> <2136307302.1704615.1466939460597.JavaMail.yahoo@mail.yahoo.com> Message-ID: Hi Arasu, 2016-06-26 13:11 GMT+02:00 arasu via vtkusers : > The problem is similiar to the one reported by Elvis Stansvik earlier this > month about creating and displaying Chart in own Window. > > I am using C++ on Windows and VTK7.0. I am not using QT. I have adapted > the MFC version that comes with VTK to not be dependent on MFC. I am using > the lines below (based on the documentation shows for QT ) > > SetRenderWindow(vtkWin32OpenGLRenderWindow::SafeDownCast(view->GetRenderWindow())); > view->SetInteractor(GetInteractor()); > > I am able to get the chart to display on the Window I create in the > program. However the Interactor does not work - i.e. mouse actions do not > pan/zoom the chart. > > I have no such problem when using VTK for other visualizations -creating > and connecting Mapper / Actor / Renderer / Interactor etc. and connecting > the renderwindow to the renderer. The visualization is shown in my window > and the display responds to mouse and keyboard actions. What do I need > to do in order to do the same with VTK Charting ? The interacting seems to > have been initialized and started as I can put a break in the program and > step through the Interactor code for mouse events. > I finally solved my problem. Unfortunately, I don't quite know what I did that made it work :/ It just started working when I began using a heavily customized QVTKRenderWindowInteractor. I know your case is different from mine (C++, not Python and MFC, not Qt), but I'm attaching my code anyway, and perhaps something can be of help. The attached files are: vtk_widget.py: Contains VTKWidget, a customized/simplified version of QVTKRenderWindowInteractor that I'm using. It essentially just sets up the render window, interactor and renderer to render into the QGLWidget, and forwards Qt input events to the interactor. transfer_functions_editor.py: This is where I make use of VTK charts. Have a look at the constructors for CompositeTransferFunctionEditor and ColorTransferFunctionEditor. These two widgets subclass my VTKWidget, so to get the full picture of how I set things up, read the constructor in there first. If I read my own code right, what I do is: 1. Create the render window 2. Create the interactor 3. Set the render window on the interactor with SetRenderWindow(..) 4. Start the interactor with Start() 5. Create the renderer 6. Add the renderer to the render window with AddRenderer(..) The above is done in my VTKWidget class. Then I 7. Create the plots I want to show (subclasses of vtkPlot) 8. Create the chart (vtkChartXY) 9. Add the plots to the chart with AddPlot(..) 10. Create the context view (vtkContextView) 11. Set the render window on the context view with SetRenderWindow(..) 12. Set the interactor on the context view with SetInteractor(..) 13. Add the chart to the scene backing the context view with .GetScene().AddItem(..) The above is done in my subclasses (CompositeTransferFunctionEditor and ColorTransferFunctionEditor). Hope this can help somewhat. Elvis > > Thanks in advance, > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: transfer_functions_editor.py Type: text/x-python Size: 10872 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: vtk_widget.py Type: text/x-python Size: 10665 bytes Desc: not available URL: From david.gobbi at gmail.com Sun Jun 26 10:13:01 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Sun, 26 Jun 2016 08:13:01 -0600 Subject: [vtkusers] Handling "out" pointer callData parameters in events from Python In-Reply-To: References: Message-ID: On Sun, Jun 26, 2016 at 2:08 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > David Gobbi, I think you worked on calldata support for Python (?), do you > know if it's currently impossible to handle these events correctly from > Python? (since they expect an answer through a memory write). > > I find these events quite strange actually. An event to me is something > you fire and forget, not a request for information like these ones seems to > be. Anyone know why the API was built like this? > I suspect that vtkGenericOpenGLRenderWindow is the only class that expects values to be returned via the calldata pointer. This behavior is sufficiently strange that the Python wrappers will probably never support it. Instead of returning the information via the calldata pointer, you can call the following methods that were added to the class for this purpose: // Description: // Allow to update state within observer callback without changing // data argument and MTime. void SetIsDirect(int newValue); void SetSupportsOpenGL(int newValue); void SetIsCurrent(bool newValue); These methods were added in order to make it possible to use this class with Java, but they should work equally well with Python. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 10:30:57 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 16:30:57 +0200 Subject: [vtkusers] Handling "out" pointer callData parameters in events from Python In-Reply-To: References: Message-ID: 2016-06-26 16:13 GMT+02:00 David Gobbi : > On Sun, Jun 26, 2016 at 2:08 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: >> >> David Gobbi, I think you worked on calldata support for Python (?), do >> you know if it's currently impossible to handle these events correctly from >> Python? (since they expect an answer through a memory write). >> >> I find these events quite strange actually. An event to me is something >> you fire and forget, not a request for information like these ones seems to >> be. Anyone know why the API was built like this? >> > > I suspect that vtkGenericOpenGLRenderWindow is the only class that expects > values to be returned via the calldata pointer. This behavior is > sufficiently strange that the Python wrappers will probably never support > it. > > Instead of returning the information via the calldata pointer, you can > call the following methods that were added to the class for this purpose: > > // Description: > // Allow to update state within observer callback without changing > // data argument and MTime. > void SetIsDirect(int newValue); > void SetSupportsOpenGL(int newValue); > void SetIsCurrent(bool newValue); > > These methods were added in order to make it possible to use this class > with Java, but they should work equally well with Python. > Excellent, thanks! I actually browsed past them while looking at the code, but in a rush didn't realize that's precisely what they were for. Elvis > > - David > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Sun Jun 26 10:37:03 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Sun, 26 Jun 2016 16:37:03 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-26 13:06 GMT+02:00 Elvis Stansvik : > Hi, > > In my quest to create a PyQt5 widget based on QOpenGLWidget for > showing/interacting with VTK, I now have something that seems to work > (including the whole thing as a runnable example below). > > I do however have two problems (indicated by "FIXME:"s in the code below): > > 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when handling > the render window StartEvent (commented out below), similar to how > QVTKWidget2 does, I get a segmentation fault: > > (gdb) bt > #0 0x0000000000000000 in ?? () > #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () from > /usr/lib/libvtkRenderingOpenGL2.so.1 > #2 0x00007fffd8de8479 in ?? () from > /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 > #3 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #8 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #10 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from > /usr/lib/libpython3.5m.so.1.0 > #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, unsigned > long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 > #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 > #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from > /usr/lib/libvtkRenderingCore.so.1 > #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from > /usr/lib/libvtkRenderingOpenGL2.so.1 > #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from > /usr/lib/libvtkRenderingCore.so.1 > #17 0x00007fffdf3ee789 in ?? () from > /usr/lib/libvtkRenderingCorePython35D.so.1 > #18 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #23 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #25 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #28 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #33 0x00007ffff7a33aeb in PyEval_EvalCode () from > /usr/lib/libpython3.5m.so.1.0 > #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 > #35 0x00007ffff79ba5e9 in PyCFunction_Call () from > /usr/lib/libpython3.5m.so.1.0 > #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from > /usr/lib/libpython3.5m.so.1.0 > #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from > /usr/lib/libpython3.5m.so.1.0 > #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #42 0x00007ffff79730da in PyObject_Call () from > /usr/lib/libpython3.5m.so.1.0 > #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 > #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 > #45 0x0000000000400ae7 in main () > (gdb) > > Sorry for the lack of debugging symbols, but before I recompile VTK with > debugging symbols, I thought I'd ask if anyone has an idea what may be the > reason for the crash? I haven't seen any adverse effects from not calling > this function, but I suspect something is broken? (how can I test?) > > 2. I can't seem to find a way to properly implement the > WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent > render window events. E.g. (from below): > > def _onWindowIsCurrentEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowIsDirectEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowSupportsOpenGLEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > The callData is a bool* and the handler is expected to write a bool to the > pointed memory. I can't see that there's any way to do this from Python (is > it possible with ctypes somehow?). > Got an answer to 2 by David in my earlier thread about this (thanks!): There were setters I could use. So now only the OpenGLInitState segfault to figure out. Elvis > So far I haven't seen any adverse effects from not implementing these > three events correctly, but expect something to be broken..? > > Thankful for any advice on these two issues, and it would be great if > someone could try out the example, with the > > # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( > > line uncommented, to confirm the segfault I'm seeing. > > Cheers, > Elvis > > > from PyQt5.QtCore import Qt, QTimer, QEvent, QSize > from PyQt5.QtGui import QSurfaceFormat > from PyQt5.QtWidgets import QWidget, QOpenGLWidget > > from vtk import vtkGenericOpenGLRenderWindow > from vtk import vtkGenericRenderWindowInteractor > from vtk import vtkCommand > from vtk import vtkRenderer > > from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE > from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE > from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL > from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR > > > class VTKWidget(QOpenGLWidget): > > def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), > *args, **kwargs): > super().__init__(*args, **kwargs) > > # Request OpenGL 3.2 compatibility profile and enable > multi-sampling > surfaceFormat.setMajorVersion(3) > surfaceFormat.setMinorVersion(2) > surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) > surfaceFormat.setSamples(8) > self.setFormat(surfaceFormat) > > # Create render window > self.renderWindow = vtkGenericOpenGLRenderWindow() > self.renderWindow.SetSize(self.width(), self.height()) > self.renderWindow.SetPosition(self.x(), self.y()) > > self.renderWindow.AddObserver(vtkCommand.StartEvent, > self._onStartEvent) > self.renderWindow.AddObserver(vtkCommand.EndEvent, > self._onEndEvent) > self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, > self._onCursorChangedEvent) > self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, > self._onWindowMakeCurrentEvent) > self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, > self._onWindowIsCurrentEvent) > self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, > self._onWindowFrameEvent) > self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, > self._onWindowIsDirectEvent) > self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, > self._onWindowSupportsOpenGLEvent) > > # Create interactor > self.interactor = vtkGenericRenderWindowInteractor() > self.interactor.SetRenderWindow(self.renderWindow) > self.interactor.SetSize(self.width(), self.height()) > self.interactor.AddObserver(vtkCommand.CreateTimerEvent, > lambda *_: self._timer.start(10)) > self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, > lambda *_: self._timer.stop()) > self.interactor.Start() > > # Create renderer > self.renderer = vtkRenderer() > self.renderWindow.AddRenderer(self.renderer) > > # Timer for the interactor > self._timer = QTimer(self) > self._timer.timeout.connect(self.interactor.TimerEvent) > > # Some tracked input state > self._pressedButton = Qt.NoButton > self._lastMouseX = 0 > self._lastMouseY = 0 > self._lastModifiers = Qt.NoModifier > self._lastButtons = Qt.NoButton > self._wheelDelta = 0 > > # Finalize render window before we're destroyed > self._hidden = QWidget(self) > self._hidden.hide() > self._hidden.destroyed.connect(self.renderWindow.Finalize) > > # > # Handle VTK render window events > # > > def _onStartEvent(self, *_): > self.makeCurrent() > self.renderWindow.PushState() > # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( > > def _onEndEvent(self, *_): > self.renderWindow.PopState() > > def _onWindowMakeCurrentEvent(self, *_): > pass # Handled automatically by QOpenGLWidget > > def _onWindowIsCurrentEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowIsDirectEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowSupportsOpenGLEvent(self, sender, event, callData): > callData = True # FIXME: This won't work... > > def _onWindowFrameEvent(self, *_): > if self.renderWindow.GetSwapBuffers(): > self.update() > > def _onCursorChangedEvent(self): > > def showCursor(): > vtkCursor = self.renderWindow.GetCurrentCursor() > qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) > self.setCursor(qtCursor) > > # Defer until cursor has actually changed > QTimer.singleShot(0, showCursor) > > # > # Implement QOpenGLWidget functions > # > > def initializeGL(self): > self.renderWindow.OpenGLInitContext() > > def paintGL(self): > self.interactor.Render() > > def resizeGL(self, width, height): > self.renderWindow.SetSize(width, height) > self.interactor.SetSize(width, height) > self.interactor.ConfigureEvent() > > # > # Handle QWidget events > # > > def closeEvent(self, _): > self.renderWindow.Finalize() > > def sizeHint(self): > return QSize(400, 400) > > def moveEvent(self, event): > super().moveEvent(event) > self.renderWindow.SetPosition(self.x(), self.y()) > > def enterEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, chr(0), 0, > None) > self.interactor.EnterEvent() > > def leaveEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, chr(0), 0, > None) > self.interactor.LeaveEvent() > > def mousePressEvent(self, event): > ctrl, shift = self._modifiers(event) > repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), repeat, None) > > self._pressedButton = event.button() > > if self._pressedButton == Qt.LeftButton: > self.interactor.LeftButtonPressEvent() > elif self._pressedButton == Qt.RightButton: > self.interactor.RightButtonPressEvent() > elif self._pressedButton == Qt.MidButton: > self.interactor.MiddleButtonPressEvent() > > def mouseReleaseEvent(self, event): > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), 0, None) > > if self._pressedButton == Qt.LeftButton: > self.interactor.LeftButtonReleaseEvent() > elif self._pressedButton == Qt.RightButton: > self.interactor.RightButtonReleaseEvent() > elif self._pressedButton == Qt.MidButton: > self.interactor.MiddleButtonReleaseEvent() > > self._pressedButton = Qt.NoButton > > def mouseMoveEvent(self, event): > self._lastModifiers = event.modifiers() > self._lastButtons = event.buttons() > self._lastMouseX = event.x() > self._lastMouseY = event.y() > > ctrl, shift = self._modifiers(event) > self.interactor.SetEventInformationFlipY(event.x(), event.y(), > ctrl, shift, > chr(0), 0, None) > self.interactor.MouseMoveEvent() > > def keyPressEvent(self, event): > ctrl, shift = self._modifiers(event) > key = str(event.text()) if event.key() < 256 else chr(0) > keySym = VTKWidget._qtKeyToKeySymbol(event.key()) > > if shift and len(keySym) == 1 and keySym.isalpha(): > keySym = keySym.upper() > > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, key, 0, > keySym) > self.interactor.KeyPressEvent() > self.interactor.CharEvent() > > def keyReleaseEvent(self, event): > ctrl, shift = self._modifiers(event) > key = chr(event.key()) if event.key() < 256 else chr(0) > > self.interactor.SetEventInformationFlipY(self._lastMouseX, > self._lastMouseY, > ctrl, shift, key, 0, None) > self.interactor.KeyReleaseEvent() > > def wheelEvent(self, event): > self._wheelDelta += event.angleDelta().y() > > if self._wheelDelta >= 120: > self.interactor.MouseWheelForwardEvent() > self._wheelDelta = 0 > elif self._wheelDelta <= -120: > self.interactor.MouseWheelBackwardEvent() > self._wheelDelta = 0 > > def _modifiers(self, event): > ctrl = shift = False > > if hasattr(event, 'modifiers'): > if event.modifiers() & Qt.ShiftModifier: > shift = True > if event.modifiers() & Qt.ControlModifier: > ctrl = True > else: > if self._lastModifiers & Qt.ShiftModifier: > shift = True > if self._lastModifiers & Qt.ControlModifier: > ctrl = True > > return ctrl, shift > > @classmethod > def _qtKeyToKeySymbol(cls, key): > if key not in VTKWidget._keySymbols: > return None > return VTKWidget._keySymbols[key] > > # Maps VTK cursors to Qt cursors > _cursors = { > VTK_CURSOR_DEFAULT: Qt.ArrowCursor, > VTK_CURSOR_ARROW: Qt.ArrowCursor, > VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, > VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, > VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, > VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, > VTK_CURSOR_SIZENS: Qt.SizeVerCursor, > VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, > VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, > VTK_CURSOR_HAND: Qt.PointingHandCursor, > VTK_CURSOR_CROSSHAIR: Qt.CrossCursor > } > > # Maps Qt keys to VTK key symbols > _keySymbols = { > Qt.Key_Backspace: 'BackSpace', > Qt.Key_Tab: 'Tab', > Qt.Key_Backtab: 'Tab', > # Qt.Key_Clear : 'Clear', > Qt.Key_Return: 'Return', > Qt.Key_Enter: 'Return', > Qt.Key_Shift: 'Shift_L', > Qt.Key_Control: 'Control_L', > Qt.Key_Alt: 'Alt_L', > Qt.Key_Pause: 'Pause', > Qt.Key_CapsLock: 'Caps_Lock', > Qt.Key_Escape: 'Escape', > Qt.Key_Space: 'space', > # Qt.Key_Prior : 'Prior', > # Qt.Key_Next : 'Next', > Qt.Key_End: 'End', > Qt.Key_Home: 'Home', > Qt.Key_Left: 'Left', > Qt.Key_Up: 'Up', > Qt.Key_Right: 'Right', > Qt.Key_Down: 'Down', > Qt.Key_SysReq: 'Snapshot', > Qt.Key_Insert: 'Insert', > Qt.Key_Delete: 'Delete', > Qt.Key_Help: 'Help', > Qt.Key_0: '0', > Qt.Key_1: '1', > Qt.Key_2: '2', > Qt.Key_3: '3', > Qt.Key_4: '4', > Qt.Key_5: '5', > Qt.Key_6: '6', > Qt.Key_7: '7', > Qt.Key_8: '8', > Qt.Key_9: '9', > Qt.Key_A: 'a', > Qt.Key_B: 'b', > Qt.Key_C: 'c', > Qt.Key_D: 'd', > Qt.Key_E: 'e', > Qt.Key_F: 'f', > Qt.Key_G: 'g', > Qt.Key_H: 'h', > Qt.Key_I: 'i', > Qt.Key_J: 'j', > Qt.Key_K: 'k', > Qt.Key_L: 'l', > Qt.Key_M: 'm', > Qt.Key_N: 'n', > Qt.Key_O: 'o', > Qt.Key_P: 'p', > Qt.Key_Q: 'q', > Qt.Key_R: 'r', > Qt.Key_S: 's', > Qt.Key_T: 't', > Qt.Key_U: 'u', > Qt.Key_V: 'v', > Qt.Key_W: 'w', > Qt.Key_X: 'x', > Qt.Key_Y: 'y', > Qt.Key_Z: 'z', > Qt.Key_Asterisk: 'asterisk', > Qt.Key_Plus: 'plus', > Qt.Key_Minus: 'minus', > Qt.Key_Period: 'period', > Qt.Key_Slash: 'slash', > Qt.Key_F1: 'F1', > Qt.Key_F2: 'F2', > Qt.Key_F3: 'F3', > Qt.Key_F4: 'F4', > Qt.Key_F5: 'F5', > Qt.Key_F6: 'F6', > Qt.Key_F7: 'F7', > Qt.Key_F8: 'F8', > Qt.Key_F9: 'F9', > Qt.Key_F10: 'F10', > Qt.Key_F11: 'F11', > Qt.Key_F12: 'F12', > Qt.Key_F13: 'F13', > Qt.Key_F14: 'F14', > Qt.Key_F15: 'F15', > Qt.Key_F16: 'F16', > Qt.Key_F17: 'F17', > Qt.Key_F18: 'F18', > Qt.Key_F19: 'F19', > Qt.Key_F20: 'F20', > Qt.Key_F21: 'F21', > Qt.Key_F22: 'F22', > Qt.Key_F23: 'F23', > Qt.Key_F24: 'F24', > Qt.Key_NumLock: 'Num_Lock', > Qt.Key_ScrollLock: 'Scroll_Lock' > } > > def example(): > # > # Try out VTKWidget by showing a couple of cones > # > from sys import argv, exit > from PyQt5.QtWidgets import QApplication, QVBoxLayout > from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor > > app = QApplication(argv) > > layout = QVBoxLayout() > > for i in range(2): > widget = VTKWidget() > > coneSource = vtkConeSource() > coneSource.SetResolution(8) > > coneMapper = vtkPolyDataMapper() > coneMapper.SetInputConnection(coneSource.GetOutputPort()) > > coneActor = vtkActor() > coneActor.SetMapper(coneMapper) > > widget.renderer.AddActor(coneActor) > > layout.addWidget(widget) > > container = QWidget() > container.setLayout(layout) > container.show() > > exit(app.exec_()) > > > if __name__ == '__main__': > example() > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cervellone at gmail.com Sun Jun 26 15:59:13 2016 From: cervellone at gmail.com (j-P) Date: Sun, 26 Jun 2016 12:59:13 -0700 (MST) Subject: [vtkusers] VTK Displaying images shows just garbled pixels Message-ID: <1466971153717-5738925.post@n5.nabble.com> Hello all, I would like to use VTK to display some images but the code fails. The aim is to integrate the VTK code into a qt application. I downloaded the samplecode from the website and tried to play with it While the code using the inbuilt vtkImageViewer2 works (see code example 1), unfortunately the code in example 2 just shows garbled pixels. I know that in vtk the mapper and actor have to match but i cant figure out which to use in what order. Example 1 is just to exclude that the ITK to VTK bridge fails at some point Thank you for any help you can spare JP #==================BEGIN EXAMPLE 1================== #!/usr/bin/python from itk import ITKVtkGlue import vtk import itk itkType= itk.Image[itk.UC,2] def toVTK(f): toVtk = ITKVtkGlue.ImageToVTKImageFilter[itkType].New() toVtk.SetInput(f) toVtk.Update() return toVtk.GetOutput() def readSingleFile(filename="test.tif"): reader = itk.ImageFileReader[itkType].New() reader.SetFileName(filename) reader.Update() return reader.GetOutput() f = readSingleFile() viewer = vtk.vtkImageViewer2() viewer.SetInputData(toVTK(f)) viewer.GetRenderWindow().SetSize(400,400) viewer.GetRenderer().SetBackground(0.5,0.5,0.5) viewInt = vtk.vtkRenderWindowInteractor() viewer.SetupInteractor(viewInt) viewer.Render() viewInt.Start() #================END EXAMPLE 1========================== #=================BEGIN EXAMPLE 2====================== #!/usr/bin/env python # Modified from the code contributed by Eric E Monson from PyQt4 import QtCore, QtGui from PyQt4.QtGui import QApplication import vtk from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor import sys import itk from itk import ITKVtkGlue itkType = itk.Image[itk.UC,2] class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(603, 553) self.centralWidget = QtGui.QWidget(MainWindow) self.gridlayout = QtGui.QGridLayout(self.centralWidget) self.vtkWidget = QVTKRenderWindowInteractor(self.centralWidget) self.gridlayout.addWidget(self.vtkWidget, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralWidget) class SimpleView(QtGui.QMainWindow): def __init__(self, parent = None): QtGui.QMainWindow.__init__(self, parent) f = self.readSingleFile("test.tif", itkType) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ren = vtk.vtkRenderer() self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren) self.iren = self.ui.vtkWidget.GetRenderWindow().GetInteractor() # Create a mapper mapper = vtk.vtkImageSliceMapper()#vtk.vtkPolyDataMapper() mapper.SetInputData(self.toVTK(f))#SetInputConnection(source.GetOutputPort()) mapper.Update() # Create an actor actor = vtk.vtkImageActor() actor.SetMapper(mapper) actor.Update() self.ren.AddActor(actor) def toVTK(self, f): toVtk = ITKVtkGlue.ImageToVTKImageFilter[itkType].New() toVtk.SetInput(f) toVtk.Update() return toVtk.GetOutput() def readSingleFile(self, filename, itkType): reader = itk.ImageFileReader[itkType].New() reader.SetFileName(filename) reader.Update() return reader.GetOutput() def main(): app = QtGui.QApplication(sys.argv) window = SimpleView() window.show() window.iren.Initialize() # Need this line to actually show the render inside Qt sys.exit(app.exec_()) if __name__ == '__main__': main() -- View this message in context: http://vtk.1045678.n5.nabble.com/VTK-Displaying-images-shows-just-garbled-pixels-tp5738925.html Sent from the VTK - Users mailing list archive at Nabble.com. From arasakumaran at yahoo.com Mon Jun 27 01:51:49 2016 From: arasakumaran at yahoo.com (arasu) Date: Mon, 27 Jun 2016 05:51:49 +0000 (UTC) Subject: [vtkusers] Fw: Relationship between interactor/render window and VTKRenderWindowInteractor for VTK Charting In-Reply-To: <2136307302.1704615.1466939460597.JavaMail.yahoo@mail.yahoo.com> References: <2136307302.1704615.1466939460597.JavaMail.yahoo.ref@mail.yahoo.com> <2136307302.1704615.1466939460597.JavaMail.yahoo@mail.yahoo.com> Message-ID: <1936434943.1995667.1467006709900.JavaMail.yahoo@mail.yahoo.com> Thanks to Elvis Stansvik for responding to the request. ? The correction is as below - it is the view's renderwindow that needs to be set to my renderwindow, not the other way around as shown for the Qt widget in the documentation - specifically:? ? ? ? view->SetRenderWindow(GetRenderWindow());?? ? ? ? view->SetInteractor(GetInteractor());? ----- Forwarded Message ----- From: arasu To: "vtkusers at vtk.org" Sent: Sunday, June 26, 2016 4:41 PM Subject: Relationship between interactor/render window and VTKRenderWindowInteractor for VTK Charting The problem is similiar to the one reported by Elvis Stansvik earlier this month about creating and displaying Chart in own Window. I am using C++ on Windows and VTK7.0. I am not using QT. I have adapted the MFC version that comes with VTK to not be dependent on MFC. I am using the lines below (based on the documentation shows for QT ) ? ? ? ? SetRenderWindow(vtkWin32OpenGLRenderWindow::SafeDownCast(view->GetRenderWindow())); ? ? ? ? view->SetInteractor(GetInteractor()); I am able to get the chart to display on the Window I create in the program. However the Interactor does not work - i.e. mouse actions do not pan/zoom the chart. I have no such problem when using VTK for other visualizations -creating and connecting Mapper / Actor / Renderer / Interactor etc. and connecting the renderwindow to the renderer.? The visualization is shown in my window and the display responds to mouse and keyboard actions.? ? What do I need to do in order to do the same with VTK Charting ? The interacting seems to have been initialized and started as I can put a break in the program and step through the Interactor code for mouse events. Thanks in advance, -------------- next part -------------- An HTML attachment was scrubbed... URL: From arasakumaran at yahoo.com Mon Jun 27 01:59:58 2016 From: arasakumaran at yahoo.com (arasu) Date: Mon, 27 Jun 2016 05:59:58 +0000 (UTC) Subject: [vtkusers] initializing vtk array from std::vector for charting References: <1229748017.1975097.1467007198109.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <1229748017.1975097.1467007198109.JavaMail.yahoo@mail.yahoo.com> I have data that is stored in std::vector - one for the X axis and one for the y axis. How do I get this into vtkarray / vtkTable for plotting - other than iterate through the vector and setting values one by one (there is a lot of data ). ?my data is either std::vector or std::vector. ?? Is there a way to assign a pointer from my data to the vtkarray, or at least do a bulk copy of all the data rather than individually setting the values. Thanks in advance, -Arasu -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 02:29:24 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 08:29:24 +0200 Subject: [vtkusers] Fw: Relationship between interactor/render window and VTKRenderWindowInteractor for VTK Charting In-Reply-To: <1936434943.1995667.1467006709900.JavaMail.yahoo@mail.yahoo.com> References: <2136307302.1704615.1466939460597.JavaMail.yahoo.ref@mail.yahoo.com> <2136307302.1704615.1466939460597.JavaMail.yahoo@mail.yahoo.com> <1936434943.1995667.1467006709900.JavaMail.yahoo@mail.yahoo.com> Message-ID: Den 27 juni 2016 7:54 fm skrev "arasu via vtkusers" : > > Thanks to Elvis Stansvik for responding to the request. The correction is as below - it is the view's renderwindow that needs to be set to my renderwindow, not the other way around as shown for the Qt widget in the documentation - specifically: > view->SetRenderWindow(GetRenderWindow()); > view->SetInteractor(GetInteractor()); Glad it worked out. I don't know why the docs says otherwise. Perhaps it's old information. Elvis > > > > ----- Forwarded Message ----- > From: arasu > To: "vtkusers at vtk.org" > Sent: Sunday, June 26, 2016 4:41 PM > Subject: Relationship between interactor/render window and VTKRenderWindowInteractor for VTK Charting > > The problem is similiar to the one reported by Elvis Stansvik earlier this month about creating and displaying Chart in own Window. > > I am using C++ on Windows and VTK7.0. I am not using QT. I have adapted the MFC version that comes with VTK to not be dependent on MFC. I am using the lines below (based on the documentation shows for QT ) > SetRenderWindow(vtkWin32OpenGLRenderWindow::SafeDownCast(view->GetRenderWindow())); > view->SetInteractor(GetInteractor()); > > I am able to get the chart to display on the Window I create in the program. However the Interactor does not work - i.e. mouse actions do not pan/zoom the chart. > > I have no such problem when using VTK for other visualizations -creating and connecting Mapper / Actor / Renderer / Interactor etc. and connecting the renderwindow to the renderer. The visualization is shown in my window and the display responds to mouse and keyboard actions. What do I need to do in order to do the same with VTK Charting ? The interacting seems to have been initialized and started as I can put a break in the program and step through the Interactor code for mouse events. > > Thanks in advance, > > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 03:09:07 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 09:09:07 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-26 13:31 GMT+02:00 Elvis Stansvik : > 2016-06-26 13:06 GMT+02:00 Elvis Stansvik : > >> Hi, >> >> In my quest to create a PyQt5 widget based on QOpenGLWidget for >> showing/interacting with VTK, I now have something that seems to work >> (including the whole thing as a runnable example below). >> > > It was a little too early to say "seems to work": When trying to show one > of the volumes I need to render, I get > > (gui) [estan at pyret orexplore.gui]$ python -m orexplore.gui.main > enabling depth test > ERROR: In > /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, > line 1682 > vtkGenericOpenGLRenderWindow (0x308c3f0): Hardware does not support the > number of textures defined. > > Segmentation fault (core dumped) > (gui) [estan at pyret orexplore.gui]$ > > on my Sandybridge laptop :/ > > Anyone know if I'd be able to use the old OpenGL backend here? > I can now confirm that I'm getting the same error on my Haswell work laptop (which is using the OpenGL2 backend) :( Anyone know if there's a way to solve this or what I should look into? The volume I'm trying to render is not particularly big (2000x120x120, float), and it renders fine if I use a QGLWidget to back my VTK widget instead of QOpenGLWidget. So I'm suspecting it might have something to do with how I set up my QOpenGLWidget. What I'm doing to configure it is simply: # Request OpenGL 3.2 compatibility profile and enable multi-sampling surfaceFormat = QSurfaceFormat.defaultFormat() surfaceFormat.setMajorVersion(3) surfaceFormat.setMinorVersion(2) surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) surfaceFormat.setSamples(8) self.setFormat(surfaceFormat) The whole reason I'm trying to get QOpenGLWidget working is that QGLWidget does not have a setFormat in PyQt5, since it doesn't wrap functions marked "obsolete" in Qt, and this prevents me from enabling multi-sampling. Very grateful for any advice from experts on the OpenGL2 backend, as I really need to get this working and move on. I'm attaching my vtk_widget2.py, which shows how I set up rendering into the QOpenGLWidget. Rendering of the cone example at the bottom works, it's just when I'm trying volume rendering using vtkGPUVolumeRayCastMapper that I get the above error. Elvis > Elvis > > >> >> I do however have two problems (indicated by "FIXME:"s in the code below): >> >> 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when handling >> the render window StartEvent (commented out below), similar to how >> QVTKWidget2 does, I get a segmentation fault: >> >> (gdb) bt >> #0 0x0000000000000000 in ?? () >> #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () >> from /usr/lib/libvtkRenderingOpenGL2.so.1 >> #2 0x00007fffd8de8479 in ?? () from >> /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 >> #3 0x00007ffff79ba5e9 in PyCFunction_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #8 0x00007ffff79730da in PyObject_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #10 0x00007ffff79730da in PyObject_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from >> /usr/lib/libpython3.5m.so.1.0 >> #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, unsigned >> long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 >> #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 >> #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from >> /usr/lib/libvtkRenderingCore.so.1 >> #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from >> /usr/lib/libvtkRenderingOpenGL2.so.1 >> #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from >> /usr/lib/libvtkRenderingCore.so.1 >> #17 0x00007fffdf3ee789 in ?? () from >> /usr/lib/libvtkRenderingCorePython35D.so.1 >> #18 0x00007ffff79ba5e9 in PyCFunction_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #23 0x00007ffff79730da in PyObject_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #25 0x00007ffff79730da in PyObject_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #28 0x00007ffff79730da in PyObject_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #33 0x00007ffff7a33aeb in PyEval_EvalCode () from >> /usr/lib/libpython3.5m.so.1.0 >> #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #35 0x00007ffff79ba5e9 in PyCFunction_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >> /usr/lib/libpython3.5m.so.1.0 >> #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #42 0x00007ffff79730da in PyObject_Call () from >> /usr/lib/libpython3.5m.so.1.0 >> #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 >> #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 >> #45 0x0000000000400ae7 in main () >> (gdb) >> >> Sorry for the lack of debugging symbols, but before I recompile VTK with >> debugging symbols, I thought I'd ask if anyone has an idea what may be the >> reason for the crash? I haven't seen any adverse effects from not calling >> this function, but I suspect something is broken? (how can I test?) >> >> 2. I can't seem to find a way to properly implement the >> WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent >> render window events. E.g. (from below): >> >> def _onWindowIsCurrentEvent(self, sender, event, callData): >> callData = True # FIXME: This won't work... >> >> def _onWindowIsDirectEvent(self, sender, event, callData): >> callData = True # FIXME: This won't work... >> >> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >> callData = True # FIXME: This won't work... >> >> The callData is a bool* and the handler is expected to write a bool to >> the pointed memory. I can't see that there's any way to do this from Python >> (is it possible with ctypes somehow?). >> >> So far I haven't seen any adverse effects from not implementing these >> three events correctly, but expect something to be broken..? >> >> Thankful for any advice on these two issues, and it would be great if >> someone could try out the example, with the >> >> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >> >> line uncommented, to confirm the segfault I'm seeing. >> >> Cheers, >> Elvis >> >> >> from PyQt5.QtCore import Qt, QTimer, QEvent, QSize >> from PyQt5.QtGui import QSurfaceFormat >> from PyQt5.QtWidgets import QWidget, QOpenGLWidget >> >> from vtk import vtkGenericOpenGLRenderWindow >> from vtk import vtkGenericRenderWindowInteractor >> from vtk import vtkCommand >> from vtk import vtkRenderer >> >> from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE >> from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE >> from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL >> from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR >> >> >> class VTKWidget(QOpenGLWidget): >> >> def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), >> *args, **kwargs): >> super().__init__(*args, **kwargs) >> >> # Request OpenGL 3.2 compatibility profile and enable >> multi-sampling >> surfaceFormat.setMajorVersion(3) >> surfaceFormat.setMinorVersion(2) >> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >> surfaceFormat.setSamples(8) >> self.setFormat(surfaceFormat) >> >> # Create render window >> self.renderWindow = vtkGenericOpenGLRenderWindow() >> self.renderWindow.SetSize(self.width(), self.height()) >> self.renderWindow.SetPosition(self.x(), self.y()) >> >> self.renderWindow.AddObserver(vtkCommand.StartEvent, >> self._onStartEvent) >> self.renderWindow.AddObserver(vtkCommand.EndEvent, >> self._onEndEvent) >> self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, >> self._onCursorChangedEvent) >> self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, >> self._onWindowMakeCurrentEvent) >> self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, >> self._onWindowIsCurrentEvent) >> self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, >> self._onWindowFrameEvent) >> self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, >> self._onWindowIsDirectEvent) >> >> self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, >> self._onWindowSupportsOpenGLEvent) >> >> # Create interactor >> self.interactor = vtkGenericRenderWindowInteractor() >> self.interactor.SetRenderWindow(self.renderWindow) >> self.interactor.SetSize(self.width(), self.height()) >> self.interactor.AddObserver(vtkCommand.CreateTimerEvent, >> lambda *_: self._timer.start(10)) >> self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, >> lambda *_: self._timer.stop()) >> self.interactor.Start() >> >> # Create renderer >> self.renderer = vtkRenderer() >> self.renderWindow.AddRenderer(self.renderer) >> >> # Timer for the interactor >> self._timer = QTimer(self) >> self._timer.timeout.connect(self.interactor.TimerEvent) >> >> # Some tracked input state >> self._pressedButton = Qt.NoButton >> self._lastMouseX = 0 >> self._lastMouseY = 0 >> self._lastModifiers = Qt.NoModifier >> self._lastButtons = Qt.NoButton >> self._wheelDelta = 0 >> >> # Finalize render window before we're destroyed >> self._hidden = QWidget(self) >> self._hidden.hide() >> self._hidden.destroyed.connect(self.renderWindow.Finalize) >> >> # >> # Handle VTK render window events >> # >> >> def _onStartEvent(self, *_): >> self.makeCurrent() >> self.renderWindow.PushState() >> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >> >> def _onEndEvent(self, *_): >> self.renderWindow.PopState() >> >> def _onWindowMakeCurrentEvent(self, *_): >> pass # Handled automatically by QOpenGLWidget >> >> def _onWindowIsCurrentEvent(self, sender, event, callData): >> callData = True # FIXME: This won't work... >> >> def _onWindowIsDirectEvent(self, sender, event, callData): >> callData = True # FIXME: This won't work... >> >> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >> callData = True # FIXME: This won't work... >> >> def _onWindowFrameEvent(self, *_): >> if self.renderWindow.GetSwapBuffers(): >> self.update() >> >> def _onCursorChangedEvent(self): >> >> def showCursor(): >> vtkCursor = self.renderWindow.GetCurrentCursor() >> qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) >> self.setCursor(qtCursor) >> >> # Defer until cursor has actually changed >> QTimer.singleShot(0, showCursor) >> >> # >> # Implement QOpenGLWidget functions >> # >> >> def initializeGL(self): >> self.renderWindow.OpenGLInitContext() >> >> def paintGL(self): >> self.interactor.Render() >> >> def resizeGL(self, width, height): >> self.renderWindow.SetSize(width, height) >> self.interactor.SetSize(width, height) >> self.interactor.ConfigureEvent() >> >> # >> # Handle QWidget events >> # >> >> def closeEvent(self, _): >> self.renderWindow.Finalize() >> >> def sizeHint(self): >> return QSize(400, 400) >> >> def moveEvent(self, event): >> super().moveEvent(event) >> self.renderWindow.SetPosition(self.x(), self.y()) >> >> def enterEvent(self, event): >> ctrl, shift = self._modifiers(event) >> self.interactor.SetEventInformationFlipY(self._lastMouseX, >> self._lastMouseY, >> ctrl, shift, chr(0), 0, >> None) >> self.interactor.EnterEvent() >> >> def leaveEvent(self, event): >> ctrl, shift = self._modifiers(event) >> self.interactor.SetEventInformationFlipY(self._lastMouseX, >> self._lastMouseY, >> ctrl, shift, chr(0), 0, >> None) >> self.interactor.LeaveEvent() >> >> def mousePressEvent(self, event): >> ctrl, shift = self._modifiers(event) >> repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 >> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >> ctrl, shift, >> chr(0), repeat, None) >> >> self._pressedButton = event.button() >> >> if self._pressedButton == Qt.LeftButton: >> self.interactor.LeftButtonPressEvent() >> elif self._pressedButton == Qt.RightButton: >> self.interactor.RightButtonPressEvent() >> elif self._pressedButton == Qt.MidButton: >> self.interactor.MiddleButtonPressEvent() >> >> def mouseReleaseEvent(self, event): >> ctrl, shift = self._modifiers(event) >> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >> ctrl, shift, >> chr(0), 0, None) >> >> if self._pressedButton == Qt.LeftButton: >> self.interactor.LeftButtonReleaseEvent() >> elif self._pressedButton == Qt.RightButton: >> self.interactor.RightButtonReleaseEvent() >> elif self._pressedButton == Qt.MidButton: >> self.interactor.MiddleButtonReleaseEvent() >> >> self._pressedButton = Qt.NoButton >> >> def mouseMoveEvent(self, event): >> self._lastModifiers = event.modifiers() >> self._lastButtons = event.buttons() >> self._lastMouseX = event.x() >> self._lastMouseY = event.y() >> >> ctrl, shift = self._modifiers(event) >> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >> ctrl, shift, >> chr(0), 0, None) >> self.interactor.MouseMoveEvent() >> >> def keyPressEvent(self, event): >> ctrl, shift = self._modifiers(event) >> key = str(event.text()) if event.key() < 256 else chr(0) >> keySym = VTKWidget._qtKeyToKeySymbol(event.key()) >> >> if shift and len(keySym) == 1 and keySym.isalpha(): >> keySym = keySym.upper() >> >> self.interactor.SetEventInformationFlipY(self._lastMouseX, >> self._lastMouseY, >> ctrl, shift, key, 0, >> keySym) >> self.interactor.KeyPressEvent() >> self.interactor.CharEvent() >> >> def keyReleaseEvent(self, event): >> ctrl, shift = self._modifiers(event) >> key = chr(event.key()) if event.key() < 256 else chr(0) >> >> self.interactor.SetEventInformationFlipY(self._lastMouseX, >> self._lastMouseY, >> ctrl, shift, key, 0, >> None) >> self.interactor.KeyReleaseEvent() >> >> def wheelEvent(self, event): >> self._wheelDelta += event.angleDelta().y() >> >> if self._wheelDelta >= 120: >> self.interactor.MouseWheelForwardEvent() >> self._wheelDelta = 0 >> elif self._wheelDelta <= -120: >> self.interactor.MouseWheelBackwardEvent() >> self._wheelDelta = 0 >> >> def _modifiers(self, event): >> ctrl = shift = False >> >> if hasattr(event, 'modifiers'): >> if event.modifiers() & Qt.ShiftModifier: >> shift = True >> if event.modifiers() & Qt.ControlModifier: >> ctrl = True >> else: >> if self._lastModifiers & Qt.ShiftModifier: >> shift = True >> if self._lastModifiers & Qt.ControlModifier: >> ctrl = True >> >> return ctrl, shift >> >> @classmethod >> def _qtKeyToKeySymbol(cls, key): >> if key not in VTKWidget._keySymbols: >> return None >> return VTKWidget._keySymbols[key] >> >> # Maps VTK cursors to Qt cursors >> _cursors = { >> VTK_CURSOR_DEFAULT: Qt.ArrowCursor, >> VTK_CURSOR_ARROW: Qt.ArrowCursor, >> VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, >> VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, >> VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, >> VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, >> VTK_CURSOR_SIZENS: Qt.SizeVerCursor, >> VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, >> VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, >> VTK_CURSOR_HAND: Qt.PointingHandCursor, >> VTK_CURSOR_CROSSHAIR: Qt.CrossCursor >> } >> >> # Maps Qt keys to VTK key symbols >> _keySymbols = { >> Qt.Key_Backspace: 'BackSpace', >> Qt.Key_Tab: 'Tab', >> Qt.Key_Backtab: 'Tab', >> # Qt.Key_Clear : 'Clear', >> Qt.Key_Return: 'Return', >> Qt.Key_Enter: 'Return', >> Qt.Key_Shift: 'Shift_L', >> Qt.Key_Control: 'Control_L', >> Qt.Key_Alt: 'Alt_L', >> Qt.Key_Pause: 'Pause', >> Qt.Key_CapsLock: 'Caps_Lock', >> Qt.Key_Escape: 'Escape', >> Qt.Key_Space: 'space', >> # Qt.Key_Prior : 'Prior', >> # Qt.Key_Next : 'Next', >> Qt.Key_End: 'End', >> Qt.Key_Home: 'Home', >> Qt.Key_Left: 'Left', >> Qt.Key_Up: 'Up', >> Qt.Key_Right: 'Right', >> Qt.Key_Down: 'Down', >> Qt.Key_SysReq: 'Snapshot', >> Qt.Key_Insert: 'Insert', >> Qt.Key_Delete: 'Delete', >> Qt.Key_Help: 'Help', >> Qt.Key_0: '0', >> Qt.Key_1: '1', >> Qt.Key_2: '2', >> Qt.Key_3: '3', >> Qt.Key_4: '4', >> Qt.Key_5: '5', >> Qt.Key_6: '6', >> Qt.Key_7: '7', >> Qt.Key_8: '8', >> Qt.Key_9: '9', >> Qt.Key_A: 'a', >> Qt.Key_B: 'b', >> Qt.Key_C: 'c', >> Qt.Key_D: 'd', >> Qt.Key_E: 'e', >> Qt.Key_F: 'f', >> Qt.Key_G: 'g', >> Qt.Key_H: 'h', >> Qt.Key_I: 'i', >> Qt.Key_J: 'j', >> Qt.Key_K: 'k', >> Qt.Key_L: 'l', >> Qt.Key_M: 'm', >> Qt.Key_N: 'n', >> Qt.Key_O: 'o', >> Qt.Key_P: 'p', >> Qt.Key_Q: 'q', >> Qt.Key_R: 'r', >> Qt.Key_S: 's', >> Qt.Key_T: 't', >> Qt.Key_U: 'u', >> Qt.Key_V: 'v', >> Qt.Key_W: 'w', >> Qt.Key_X: 'x', >> Qt.Key_Y: 'y', >> Qt.Key_Z: 'z', >> Qt.Key_Asterisk: 'asterisk', >> Qt.Key_Plus: 'plus', >> Qt.Key_Minus: 'minus', >> Qt.Key_Period: 'period', >> Qt.Key_Slash: 'slash', >> Qt.Key_F1: 'F1', >> Qt.Key_F2: 'F2', >> Qt.Key_F3: 'F3', >> Qt.Key_F4: 'F4', >> Qt.Key_F5: 'F5', >> Qt.Key_F6: 'F6', >> Qt.Key_F7: 'F7', >> Qt.Key_F8: 'F8', >> Qt.Key_F9: 'F9', >> Qt.Key_F10: 'F10', >> Qt.Key_F11: 'F11', >> Qt.Key_F12: 'F12', >> Qt.Key_F13: 'F13', >> Qt.Key_F14: 'F14', >> Qt.Key_F15: 'F15', >> Qt.Key_F16: 'F16', >> Qt.Key_F17: 'F17', >> Qt.Key_F18: 'F18', >> Qt.Key_F19: 'F19', >> Qt.Key_F20: 'F20', >> Qt.Key_F21: 'F21', >> Qt.Key_F22: 'F22', >> Qt.Key_F23: 'F23', >> Qt.Key_F24: 'F24', >> Qt.Key_NumLock: 'Num_Lock', >> Qt.Key_ScrollLock: 'Scroll_Lock' >> } >> >> def example(): >> # >> # Try out VTKWidget by showing a couple of cones >> # >> from sys import argv, exit >> from PyQt5.QtWidgets import QApplication, QVBoxLayout >> from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor >> >> app = QApplication(argv) >> >> layout = QVBoxLayout() >> >> for i in range(2): >> widget = VTKWidget() >> >> coneSource = vtkConeSource() >> coneSource.SetResolution(8) >> >> coneMapper = vtkPolyDataMapper() >> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >> >> coneActor = vtkActor() >> coneActor.SetMapper(coneMapper) >> >> widget.renderer.AddActor(coneActor) >> >> layout.addWidget(widget) >> >> container = QWidget() >> container.setLayout(layout) >> container.show() >> >> exit(app.exec_()) >> >> >> if __name__ == '__main__': >> example() >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 03:18:47 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 09:18:47 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-27 9:09 GMT+02:00 Elvis Stansvik : > 2016-06-26 13:31 GMT+02:00 Elvis Stansvik : > >> 2016-06-26 13:06 GMT+02:00 Elvis Stansvik : >> >>> Hi, >>> >>> In my quest to create a PyQt5 widget based on QOpenGLWidget for >>> showing/interacting with VTK, I now have something that seems to work >>> (including the whole thing as a runnable example below). >>> >> >> It was a little too early to say "seems to work": When trying to show one >> of the volumes I need to render, I get >> >> (gui) [estan at pyret orexplore.gui]$ python -m orexplore.gui.main >> enabling depth test >> ERROR: In >> /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, >> line 1682 >> vtkGenericOpenGLRenderWindow (0x308c3f0): Hardware does not support the >> number of textures defined. >> > Searching around for this error, the only thing I could find was this old thread from sept 2014 on the vtk-developers list: http://public.kitware.com/pipermail/vtk-developers/2014-September/015357.html The poster speaks of some tests that were failing with that error back then. Ken replied that he thought there might be some leak in one of the texture resources in the OpenGL2 backend. @Ben: Could that still be the case, and the reason for my error? Elvis >> Segmentation fault (core dumped) >> (gui) [estan at pyret orexplore.gui]$ >> >> on my Sandybridge laptop :/ >> >> Anyone know if I'd be able to use the old OpenGL backend here? >> > > I can now confirm that I'm getting the same error on my Haswell work > laptop (which is using the OpenGL2 backend) :( Anyone know if there's a way > to solve this or what I should look into? > > The volume I'm trying to render is not particularly big (2000x120x120, > float), and it renders fine if I use a QGLWidget to back my VTK widget > instead of QOpenGLWidget. So I'm suspecting it might have something to do > with how I set up my QOpenGLWidget. > > What I'm doing to configure it is simply: > > # Request OpenGL 3.2 compatibility profile and enable > multi-sampling > surfaceFormat = QSurfaceFormat.defaultFormat() > surfaceFormat.setMajorVersion(3) > surfaceFormat.setMinorVersion(2) > surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) > surfaceFormat.setSamples(8) > self.setFormat(surfaceFormat) > > The whole reason I'm trying to get QOpenGLWidget working is that QGLWidget > does not have a setFormat in PyQt5, since it doesn't wrap functions marked > "obsolete" in Qt, and this prevents me from enabling multi-sampling. > > Very grateful for any advice from experts on the OpenGL2 backend, as I > really need to get this working and move on. > > I'm attaching my vtk_widget2.py, which shows how I set up rendering into > the QOpenGLWidget. Rendering of the cone example at the bottom works, it's > just when I'm trying volume rendering using vtkGPUVolumeRayCastMapper that > I get the above error. > > Elvis > > >> Elvis >> >> >>> >>> I do however have two problems (indicated by "FIXME:"s in the code >>> below): >>> >>> 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when >>> handling the render window StartEvent (commented out below), similar to how >>> QVTKWidget2 does, I get a segmentation fault: >>> >>> (gdb) bt >>> #0 0x0000000000000000 in ?? () >>> #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () >>> from /usr/lib/libvtkRenderingOpenGL2.so.1 >>> #2 0x00007fffd8de8479 in ?? () from >>> /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 >>> #3 0x00007ffff79ba5e9 in PyCFunction_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #8 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #10 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, unsigned >>> long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 >>> #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 >>> #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from >>> /usr/lib/libvtkRenderingCore.so.1 >>> #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from >>> /usr/lib/libvtkRenderingOpenGL2.so.1 >>> #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from >>> /usr/lib/libvtkRenderingCore.so.1 >>> #17 0x00007fffdf3ee789 in ?? () from >>> /usr/lib/libvtkRenderingCorePython35D.so.1 >>> #18 0x00007ffff79ba5e9 in PyCFunction_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #23 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #25 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #28 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #33 0x00007ffff7a33aeb in PyEval_EvalCode () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #35 0x00007ffff79ba5e9 in PyCFunction_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #42 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 >>> #45 0x0000000000400ae7 in main () >>> (gdb) >>> >>> Sorry for the lack of debugging symbols, but before I recompile VTK with >>> debugging symbols, I thought I'd ask if anyone has an idea what may be the >>> reason for the crash? I haven't seen any adverse effects from not calling >>> this function, but I suspect something is broken? (how can I test?) >>> >>> 2. I can't seem to find a way to properly implement the >>> WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent >>> render window events. E.g. (from below): >>> >>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowIsDirectEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> The callData is a bool* and the handler is expected to write a bool to >>> the pointed memory. I can't see that there's any way to do this from Python >>> (is it possible with ctypes somehow?). >>> >>> So far I haven't seen any adverse effects from not implementing these >>> three events correctly, but expect something to be broken..? >>> >>> Thankful for any advice on these two issues, and it would be great if >>> someone could try out the example, with the >>> >>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>> >>> line uncommented, to confirm the segfault I'm seeing. >>> >>> Cheers, >>> Elvis >>> >>> >>> from PyQt5.QtCore import Qt, QTimer, QEvent, QSize >>> from PyQt5.QtGui import QSurfaceFormat >>> from PyQt5.QtWidgets import QWidget, QOpenGLWidget >>> >>> from vtk import vtkGenericOpenGLRenderWindow >>> from vtk import vtkGenericRenderWindowInteractor >>> from vtk import vtkCommand >>> from vtk import vtkRenderer >>> >>> from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE >>> from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE >>> from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL >>> from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR >>> >>> >>> class VTKWidget(QOpenGLWidget): >>> >>> def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), >>> *args, **kwargs): >>> super().__init__(*args, **kwargs) >>> >>> # Request OpenGL 3.2 compatibility profile and enable >>> multi-sampling >>> surfaceFormat.setMajorVersion(3) >>> surfaceFormat.setMinorVersion(2) >>> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >>> surfaceFormat.setSamples(8) >>> self.setFormat(surfaceFormat) >>> >>> # Create render window >>> self.renderWindow = vtkGenericOpenGLRenderWindow() >>> self.renderWindow.SetSize(self.width(), self.height()) >>> self.renderWindow.SetPosition(self.x(), self.y()) >>> >>> self.renderWindow.AddObserver(vtkCommand.StartEvent, >>> self._onStartEvent) >>> self.renderWindow.AddObserver(vtkCommand.EndEvent, >>> self._onEndEvent) >>> self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, >>> self._onCursorChangedEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, >>> self._onWindowMakeCurrentEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, >>> self._onWindowIsCurrentEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, >>> self._onWindowFrameEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, >>> self._onWindowIsDirectEvent) >>> >>> self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, >>> self._onWindowSupportsOpenGLEvent) >>> >>> # Create interactor >>> self.interactor = vtkGenericRenderWindowInteractor() >>> self.interactor.SetRenderWindow(self.renderWindow) >>> self.interactor.SetSize(self.width(), self.height()) >>> self.interactor.AddObserver(vtkCommand.CreateTimerEvent, >>> lambda *_: self._timer.start(10)) >>> self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, >>> lambda *_: self._timer.stop()) >>> self.interactor.Start() >>> >>> # Create renderer >>> self.renderer = vtkRenderer() >>> self.renderWindow.AddRenderer(self.renderer) >>> >>> # Timer for the interactor >>> self._timer = QTimer(self) >>> self._timer.timeout.connect(self.interactor.TimerEvent) >>> >>> # Some tracked input state >>> self._pressedButton = Qt.NoButton >>> self._lastMouseX = 0 >>> self._lastMouseY = 0 >>> self._lastModifiers = Qt.NoModifier >>> self._lastButtons = Qt.NoButton >>> self._wheelDelta = 0 >>> >>> # Finalize render window before we're destroyed >>> self._hidden = QWidget(self) >>> self._hidden.hide() >>> self._hidden.destroyed.connect(self.renderWindow.Finalize) >>> >>> # >>> # Handle VTK render window events >>> # >>> >>> def _onStartEvent(self, *_): >>> self.makeCurrent() >>> self.renderWindow.PushState() >>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>> >>> def _onEndEvent(self, *_): >>> self.renderWindow.PopState() >>> >>> def _onWindowMakeCurrentEvent(self, *_): >>> pass # Handled automatically by QOpenGLWidget >>> >>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowIsDirectEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowFrameEvent(self, *_): >>> if self.renderWindow.GetSwapBuffers(): >>> self.update() >>> >>> def _onCursorChangedEvent(self): >>> >>> def showCursor(): >>> vtkCursor = self.renderWindow.GetCurrentCursor() >>> qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) >>> self.setCursor(qtCursor) >>> >>> # Defer until cursor has actually changed >>> QTimer.singleShot(0, showCursor) >>> >>> # >>> # Implement QOpenGLWidget functions >>> # >>> >>> def initializeGL(self): >>> self.renderWindow.OpenGLInitContext() >>> >>> def paintGL(self): >>> self.interactor.Render() >>> >>> def resizeGL(self, width, height): >>> self.renderWindow.SetSize(width, height) >>> self.interactor.SetSize(width, height) >>> self.interactor.ConfigureEvent() >>> >>> # >>> # Handle QWidget events >>> # >>> >>> def closeEvent(self, _): >>> self.renderWindow.Finalize() >>> >>> def sizeHint(self): >>> return QSize(400, 400) >>> >>> def moveEvent(self, event): >>> super().moveEvent(event) >>> self.renderWindow.SetPosition(self.x(), self.y()) >>> >>> def enterEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, chr(0), 0, >>> None) >>> self.interactor.EnterEvent() >>> >>> def leaveEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, chr(0), 0, >>> None) >>> self.interactor.LeaveEvent() >>> >>> def mousePressEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 >>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>> ctrl, shift, >>> chr(0), repeat, None) >>> >>> self._pressedButton = event.button() >>> >>> if self._pressedButton == Qt.LeftButton: >>> self.interactor.LeftButtonPressEvent() >>> elif self._pressedButton == Qt.RightButton: >>> self.interactor.RightButtonPressEvent() >>> elif self._pressedButton == Qt.MidButton: >>> self.interactor.MiddleButtonPressEvent() >>> >>> def mouseReleaseEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>> ctrl, shift, >>> chr(0), 0, None) >>> >>> if self._pressedButton == Qt.LeftButton: >>> self.interactor.LeftButtonReleaseEvent() >>> elif self._pressedButton == Qt.RightButton: >>> self.interactor.RightButtonReleaseEvent() >>> elif self._pressedButton == Qt.MidButton: >>> self.interactor.MiddleButtonReleaseEvent() >>> >>> self._pressedButton = Qt.NoButton >>> >>> def mouseMoveEvent(self, event): >>> self._lastModifiers = event.modifiers() >>> self._lastButtons = event.buttons() >>> self._lastMouseX = event.x() >>> self._lastMouseY = event.y() >>> >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>> ctrl, shift, >>> chr(0), 0, None) >>> self.interactor.MouseMoveEvent() >>> >>> def keyPressEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> key = str(event.text()) if event.key() < 256 else chr(0) >>> keySym = VTKWidget._qtKeyToKeySymbol(event.key()) >>> >>> if shift and len(keySym) == 1 and keySym.isalpha(): >>> keySym = keySym.upper() >>> >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, key, 0, >>> keySym) >>> self.interactor.KeyPressEvent() >>> self.interactor.CharEvent() >>> >>> def keyReleaseEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> key = chr(event.key()) if event.key() < 256 else chr(0) >>> >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, key, 0, >>> None) >>> self.interactor.KeyReleaseEvent() >>> >>> def wheelEvent(self, event): >>> self._wheelDelta += event.angleDelta().y() >>> >>> if self._wheelDelta >= 120: >>> self.interactor.MouseWheelForwardEvent() >>> self._wheelDelta = 0 >>> elif self._wheelDelta <= -120: >>> self.interactor.MouseWheelBackwardEvent() >>> self._wheelDelta = 0 >>> >>> def _modifiers(self, event): >>> ctrl = shift = False >>> >>> if hasattr(event, 'modifiers'): >>> if event.modifiers() & Qt.ShiftModifier: >>> shift = True >>> if event.modifiers() & Qt.ControlModifier: >>> ctrl = True >>> else: >>> if self._lastModifiers & Qt.ShiftModifier: >>> shift = True >>> if self._lastModifiers & Qt.ControlModifier: >>> ctrl = True >>> >>> return ctrl, shift >>> >>> @classmethod >>> def _qtKeyToKeySymbol(cls, key): >>> if key not in VTKWidget._keySymbols: >>> return None >>> return VTKWidget._keySymbols[key] >>> >>> # Maps VTK cursors to Qt cursors >>> _cursors = { >>> VTK_CURSOR_DEFAULT: Qt.ArrowCursor, >>> VTK_CURSOR_ARROW: Qt.ArrowCursor, >>> VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, >>> VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, >>> VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, >>> VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, >>> VTK_CURSOR_SIZENS: Qt.SizeVerCursor, >>> VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, >>> VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, >>> VTK_CURSOR_HAND: Qt.PointingHandCursor, >>> VTK_CURSOR_CROSSHAIR: Qt.CrossCursor >>> } >>> >>> # Maps Qt keys to VTK key symbols >>> _keySymbols = { >>> Qt.Key_Backspace: 'BackSpace', >>> Qt.Key_Tab: 'Tab', >>> Qt.Key_Backtab: 'Tab', >>> # Qt.Key_Clear : 'Clear', >>> Qt.Key_Return: 'Return', >>> Qt.Key_Enter: 'Return', >>> Qt.Key_Shift: 'Shift_L', >>> Qt.Key_Control: 'Control_L', >>> Qt.Key_Alt: 'Alt_L', >>> Qt.Key_Pause: 'Pause', >>> Qt.Key_CapsLock: 'Caps_Lock', >>> Qt.Key_Escape: 'Escape', >>> Qt.Key_Space: 'space', >>> # Qt.Key_Prior : 'Prior', >>> # Qt.Key_Next : 'Next', >>> Qt.Key_End: 'End', >>> Qt.Key_Home: 'Home', >>> Qt.Key_Left: 'Left', >>> Qt.Key_Up: 'Up', >>> Qt.Key_Right: 'Right', >>> Qt.Key_Down: 'Down', >>> Qt.Key_SysReq: 'Snapshot', >>> Qt.Key_Insert: 'Insert', >>> Qt.Key_Delete: 'Delete', >>> Qt.Key_Help: 'Help', >>> Qt.Key_0: '0', >>> Qt.Key_1: '1', >>> Qt.Key_2: '2', >>> Qt.Key_3: '3', >>> Qt.Key_4: '4', >>> Qt.Key_5: '5', >>> Qt.Key_6: '6', >>> Qt.Key_7: '7', >>> Qt.Key_8: '8', >>> Qt.Key_9: '9', >>> Qt.Key_A: 'a', >>> Qt.Key_B: 'b', >>> Qt.Key_C: 'c', >>> Qt.Key_D: 'd', >>> Qt.Key_E: 'e', >>> Qt.Key_F: 'f', >>> Qt.Key_G: 'g', >>> Qt.Key_H: 'h', >>> Qt.Key_I: 'i', >>> Qt.Key_J: 'j', >>> Qt.Key_K: 'k', >>> Qt.Key_L: 'l', >>> Qt.Key_M: 'm', >>> Qt.Key_N: 'n', >>> Qt.Key_O: 'o', >>> Qt.Key_P: 'p', >>> Qt.Key_Q: 'q', >>> Qt.Key_R: 'r', >>> Qt.Key_S: 's', >>> Qt.Key_T: 't', >>> Qt.Key_U: 'u', >>> Qt.Key_V: 'v', >>> Qt.Key_W: 'w', >>> Qt.Key_X: 'x', >>> Qt.Key_Y: 'y', >>> Qt.Key_Z: 'z', >>> Qt.Key_Asterisk: 'asterisk', >>> Qt.Key_Plus: 'plus', >>> Qt.Key_Minus: 'minus', >>> Qt.Key_Period: 'period', >>> Qt.Key_Slash: 'slash', >>> Qt.Key_F1: 'F1', >>> Qt.Key_F2: 'F2', >>> Qt.Key_F3: 'F3', >>> Qt.Key_F4: 'F4', >>> Qt.Key_F5: 'F5', >>> Qt.Key_F6: 'F6', >>> Qt.Key_F7: 'F7', >>> Qt.Key_F8: 'F8', >>> Qt.Key_F9: 'F9', >>> Qt.Key_F10: 'F10', >>> Qt.Key_F11: 'F11', >>> Qt.Key_F12: 'F12', >>> Qt.Key_F13: 'F13', >>> Qt.Key_F14: 'F14', >>> Qt.Key_F15: 'F15', >>> Qt.Key_F16: 'F16', >>> Qt.Key_F17: 'F17', >>> Qt.Key_F18: 'F18', >>> Qt.Key_F19: 'F19', >>> Qt.Key_F20: 'F20', >>> Qt.Key_F21: 'F21', >>> Qt.Key_F22: 'F22', >>> Qt.Key_F23: 'F23', >>> Qt.Key_F24: 'F24', >>> Qt.Key_NumLock: 'Num_Lock', >>> Qt.Key_ScrollLock: 'Scroll_Lock' >>> } >>> >>> def example(): >>> # >>> # Try out VTKWidget by showing a couple of cones >>> # >>> from sys import argv, exit >>> from PyQt5.QtWidgets import QApplication, QVBoxLayout >>> from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor >>> >>> app = QApplication(argv) >>> >>> layout = QVBoxLayout() >>> >>> for i in range(2): >>> widget = VTKWidget() >>> >>> coneSource = vtkConeSource() >>> coneSource.SetResolution(8) >>> >>> coneMapper = vtkPolyDataMapper() >>> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>> >>> coneActor = vtkActor() >>> coneActor.SetMapper(coneMapper) >>> >>> widget.renderer.AddActor(coneActor) >>> >>> layout.addWidget(widget) >>> >>> container = QWidget() >>> container.setLayout(layout) >>> container.show() >>> >>> exit(app.exec_()) >>> >>> >>> if __name__ == '__main__': >>> example() >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi.charrier at gmail.com Mon Jun 27 03:22:40 2016 From: remi.charrier at gmail.com (Remi Charrier) Date: Mon, 27 Jun 2016 09:22:40 +0200 Subject: [vtkusers] Projected shadow rendering in a vtkRenderWindow Message-ID: Dear vtk users community, I started 3 weeks ago a new project with vtk, I just register to this mailing list to get answers to some of my questions. Let me know if I am doing anything wrong in the use of this mailing list. My development environment is : - Visual Studio 2013 - vtk7.0 - qt5.7 My computer has a NVidia TITAN X graphic card. Here is my problem: - I managed to create a vtkRenderWindow that allows me to display different 3D meshes - I am using Stereo Rendering (Anaglyph mode) - I would like to project the shadows of my different elements on the others elements. To do so I tried many different things, but did not manage to find anything that seems to work. Here are what I tried: - vtkEDLshading - I got it running but it does not do what I expected and no projected shadows appear - vtkShadowMapBakerPass (as described in http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Shadows) but I have compilation errors on vtkShadowMapBakerPass::OCCLUDER(), it seems this class has change or I missed something: "error C2039: 'OCCLUDER' : is not a member of 'vtkShadowMapBakerPass'" - Then I tried to only use basic functions associated to the renderer or the actors: m_Renderer->UseShadowsOn(); m_cylTipActor->GetProperty()->ShadingOn(); But once again no visible result... If someone can tell me where the correct information to display projected shadows with VTK 7.0 can be found, I can then investigate and come back to you with my code if I am still having problems. Thanks in advance, R?mi (glad to come back to vtk after an 8 years break) Garanti sans virus. www.avast.com <#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2> -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 03:48:52 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 09:48:52 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-27 9:09 GMT+02:00 Elvis Stansvik : > 2016-06-26 13:31 GMT+02:00 Elvis Stansvik : > >> 2016-06-26 13:06 GMT+02:00 Elvis Stansvik : >> >>> Hi, >>> >>> In my quest to create a PyQt5 widget based on QOpenGLWidget for >>> showing/interacting with VTK, I now have something that seems to work >>> (including the whole thing as a runnable example below). >>> >> >> It was a little too early to say "seems to work": When trying to show one >> of the volumes I need to render, I get >> >> (gui) [estan at pyret orexplore.gui]$ python -m orexplore.gui.main >> enabling depth test >> ERROR: In >> /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, >> line 1682 >> vtkGenericOpenGLRenderWindow (0x308c3f0): Hardware does not support the >> number of textures defined. >> >> Segmentation fault (core dumped) >> (gui) [estan at pyret orexplore.gui]$ >> >> on my Sandybridge laptop :/ >> >> Anyone know if I'd be able to use the old OpenGL backend here? >> > > I can now confirm that I'm getting the same error on my Haswell work > laptop (which is using the OpenGL2 backend) :( Anyone know if there's a way > to solve this or what I should look into? > > The volume I'm trying to render is not particularly big (2000x120x120, > float), and it renders fine if I use a QGLWidget to back my VTK widget > instead of QOpenGLWidget. So I'm suspecting it might have something to do > with how I set up my QOpenGLWidget. > I tried printing the number of texture units in my StartEvent handler with print(self.renderWindow.GetTextureUnitManager().GetNumberOfTextureUnits()) and it print 0, so I think something must definitely be wrong with how I initialize things? Elvis > > What I'm doing to configure it is simply: > > # Request OpenGL 3.2 compatibility profile and enable > multi-sampling > surfaceFormat = QSurfaceFormat.defaultFormat() > surfaceFormat.setMajorVersion(3) > surfaceFormat.setMinorVersion(2) > surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) > surfaceFormat.setSamples(8) > self.setFormat(surfaceFormat) > > The whole reason I'm trying to get QOpenGLWidget working is that QGLWidget > does not have a setFormat in PyQt5, since it doesn't wrap functions marked > "obsolete" in Qt, and this prevents me from enabling multi-sampling. > > Very grateful for any advice from experts on the OpenGL2 backend, as I > really need to get this working and move on. > > I'm attaching my vtk_widget2.py, which shows how I set up rendering into > the QOpenGLWidget. Rendering of the cone example at the bottom works, it's > just when I'm trying volume rendering using vtkGPUVolumeRayCastMapper that > I get the above error. > > Elvis > > >> Elvis >> >> >>> >>> I do however have two problems (indicated by "FIXME:"s in the code >>> below): >>> >>> 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when >>> handling the render window StartEvent (commented out below), similar to how >>> QVTKWidget2 does, I get a segmentation fault: >>> >>> (gdb) bt >>> #0 0x0000000000000000 in ?? () >>> #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () >>> from /usr/lib/libvtkRenderingOpenGL2.so.1 >>> #2 0x00007fffd8de8479 in ?? () from >>> /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 >>> #3 0x00007ffff79ba5e9 in PyCFunction_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #8 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #10 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, unsigned >>> long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 >>> #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 >>> #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from >>> /usr/lib/libvtkRenderingCore.so.1 >>> #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from >>> /usr/lib/libvtkRenderingOpenGL2.so.1 >>> #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from >>> /usr/lib/libvtkRenderingCore.so.1 >>> #17 0x00007fffdf3ee789 in ?? () from >>> /usr/lib/libvtkRenderingCorePython35D.so.1 >>> #18 0x00007ffff79ba5e9 in PyCFunction_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #23 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #25 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #28 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #33 0x00007ffff7a33aeb in PyEval_EvalCode () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #35 0x00007ffff79ba5e9 in PyCFunction_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #42 0x00007ffff79730da in PyObject_Call () from >>> /usr/lib/libpython3.5m.so.1.0 >>> #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>> #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 >>> #45 0x0000000000400ae7 in main () >>> (gdb) >>> >>> Sorry for the lack of debugging symbols, but before I recompile VTK with >>> debugging symbols, I thought I'd ask if anyone has an idea what may be the >>> reason for the crash? I haven't seen any adverse effects from not calling >>> this function, but I suspect something is broken? (how can I test?) >>> >>> 2. I can't seem to find a way to properly implement the >>> WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent >>> render window events. E.g. (from below): >>> >>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowIsDirectEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> The callData is a bool* and the handler is expected to write a bool to >>> the pointed memory. I can't see that there's any way to do this from Python >>> (is it possible with ctypes somehow?). >>> >>> So far I haven't seen any adverse effects from not implementing these >>> three events correctly, but expect something to be broken..? >>> >>> Thankful for any advice on these two issues, and it would be great if >>> someone could try out the example, with the >>> >>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>> >>> line uncommented, to confirm the segfault I'm seeing. >>> >>> Cheers, >>> Elvis >>> >>> >>> from PyQt5.QtCore import Qt, QTimer, QEvent, QSize >>> from PyQt5.QtGui import QSurfaceFormat >>> from PyQt5.QtWidgets import QWidget, QOpenGLWidget >>> >>> from vtk import vtkGenericOpenGLRenderWindow >>> from vtk import vtkGenericRenderWindowInteractor >>> from vtk import vtkCommand >>> from vtk import vtkRenderer >>> >>> from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE >>> from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE >>> from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL >>> from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR >>> >>> >>> class VTKWidget(QOpenGLWidget): >>> >>> def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), >>> *args, **kwargs): >>> super().__init__(*args, **kwargs) >>> >>> # Request OpenGL 3.2 compatibility profile and enable >>> multi-sampling >>> surfaceFormat.setMajorVersion(3) >>> surfaceFormat.setMinorVersion(2) >>> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >>> surfaceFormat.setSamples(8) >>> self.setFormat(surfaceFormat) >>> >>> # Create render window >>> self.renderWindow = vtkGenericOpenGLRenderWindow() >>> self.renderWindow.SetSize(self.width(), self.height()) >>> self.renderWindow.SetPosition(self.x(), self.y()) >>> >>> self.renderWindow.AddObserver(vtkCommand.StartEvent, >>> self._onStartEvent) >>> self.renderWindow.AddObserver(vtkCommand.EndEvent, >>> self._onEndEvent) >>> self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, >>> self._onCursorChangedEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, >>> self._onWindowMakeCurrentEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, >>> self._onWindowIsCurrentEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, >>> self._onWindowFrameEvent) >>> self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, >>> self._onWindowIsDirectEvent) >>> >>> self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, >>> self._onWindowSupportsOpenGLEvent) >>> >>> # Create interactor >>> self.interactor = vtkGenericRenderWindowInteractor() >>> self.interactor.SetRenderWindow(self.renderWindow) >>> self.interactor.SetSize(self.width(), self.height()) >>> self.interactor.AddObserver(vtkCommand.CreateTimerEvent, >>> lambda *_: self._timer.start(10)) >>> self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, >>> lambda *_: self._timer.stop()) >>> self.interactor.Start() >>> >>> # Create renderer >>> self.renderer = vtkRenderer() >>> self.renderWindow.AddRenderer(self.renderer) >>> >>> # Timer for the interactor >>> self._timer = QTimer(self) >>> self._timer.timeout.connect(self.interactor.TimerEvent) >>> >>> # Some tracked input state >>> self._pressedButton = Qt.NoButton >>> self._lastMouseX = 0 >>> self._lastMouseY = 0 >>> self._lastModifiers = Qt.NoModifier >>> self._lastButtons = Qt.NoButton >>> self._wheelDelta = 0 >>> >>> # Finalize render window before we're destroyed >>> self._hidden = QWidget(self) >>> self._hidden.hide() >>> self._hidden.destroyed.connect(self.renderWindow.Finalize) >>> >>> # >>> # Handle VTK render window events >>> # >>> >>> def _onStartEvent(self, *_): >>> self.makeCurrent() >>> self.renderWindow.PushState() >>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>> >>> def _onEndEvent(self, *_): >>> self.renderWindow.PopState() >>> >>> def _onWindowMakeCurrentEvent(self, *_): >>> pass # Handled automatically by QOpenGLWidget >>> >>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowIsDirectEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>> callData = True # FIXME: This won't work... >>> >>> def _onWindowFrameEvent(self, *_): >>> if self.renderWindow.GetSwapBuffers(): >>> self.update() >>> >>> def _onCursorChangedEvent(self): >>> >>> def showCursor(): >>> vtkCursor = self.renderWindow.GetCurrentCursor() >>> qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) >>> self.setCursor(qtCursor) >>> >>> # Defer until cursor has actually changed >>> QTimer.singleShot(0, showCursor) >>> >>> # >>> # Implement QOpenGLWidget functions >>> # >>> >>> def initializeGL(self): >>> self.renderWindow.OpenGLInitContext() >>> >>> def paintGL(self): >>> self.interactor.Render() >>> >>> def resizeGL(self, width, height): >>> self.renderWindow.SetSize(width, height) >>> self.interactor.SetSize(width, height) >>> self.interactor.ConfigureEvent() >>> >>> # >>> # Handle QWidget events >>> # >>> >>> def closeEvent(self, _): >>> self.renderWindow.Finalize() >>> >>> def sizeHint(self): >>> return QSize(400, 400) >>> >>> def moveEvent(self, event): >>> super().moveEvent(event) >>> self.renderWindow.SetPosition(self.x(), self.y()) >>> >>> def enterEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, chr(0), 0, >>> None) >>> self.interactor.EnterEvent() >>> >>> def leaveEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, chr(0), 0, >>> None) >>> self.interactor.LeaveEvent() >>> >>> def mousePressEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 >>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>> ctrl, shift, >>> chr(0), repeat, None) >>> >>> self._pressedButton = event.button() >>> >>> if self._pressedButton == Qt.LeftButton: >>> self.interactor.LeftButtonPressEvent() >>> elif self._pressedButton == Qt.RightButton: >>> self.interactor.RightButtonPressEvent() >>> elif self._pressedButton == Qt.MidButton: >>> self.interactor.MiddleButtonPressEvent() >>> >>> def mouseReleaseEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>> ctrl, shift, >>> chr(0), 0, None) >>> >>> if self._pressedButton == Qt.LeftButton: >>> self.interactor.LeftButtonReleaseEvent() >>> elif self._pressedButton == Qt.RightButton: >>> self.interactor.RightButtonReleaseEvent() >>> elif self._pressedButton == Qt.MidButton: >>> self.interactor.MiddleButtonReleaseEvent() >>> >>> self._pressedButton = Qt.NoButton >>> >>> def mouseMoveEvent(self, event): >>> self._lastModifiers = event.modifiers() >>> self._lastButtons = event.buttons() >>> self._lastMouseX = event.x() >>> self._lastMouseY = event.y() >>> >>> ctrl, shift = self._modifiers(event) >>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>> ctrl, shift, >>> chr(0), 0, None) >>> self.interactor.MouseMoveEvent() >>> >>> def keyPressEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> key = str(event.text()) if event.key() < 256 else chr(0) >>> keySym = VTKWidget._qtKeyToKeySymbol(event.key()) >>> >>> if shift and len(keySym) == 1 and keySym.isalpha(): >>> keySym = keySym.upper() >>> >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, key, 0, >>> keySym) >>> self.interactor.KeyPressEvent() >>> self.interactor.CharEvent() >>> >>> def keyReleaseEvent(self, event): >>> ctrl, shift = self._modifiers(event) >>> key = chr(event.key()) if event.key() < 256 else chr(0) >>> >>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>> self._lastMouseY, >>> ctrl, shift, key, 0, >>> None) >>> self.interactor.KeyReleaseEvent() >>> >>> def wheelEvent(self, event): >>> self._wheelDelta += event.angleDelta().y() >>> >>> if self._wheelDelta >= 120: >>> self.interactor.MouseWheelForwardEvent() >>> self._wheelDelta = 0 >>> elif self._wheelDelta <= -120: >>> self.interactor.MouseWheelBackwardEvent() >>> self._wheelDelta = 0 >>> >>> def _modifiers(self, event): >>> ctrl = shift = False >>> >>> if hasattr(event, 'modifiers'): >>> if event.modifiers() & Qt.ShiftModifier: >>> shift = True >>> if event.modifiers() & Qt.ControlModifier: >>> ctrl = True >>> else: >>> if self._lastModifiers & Qt.ShiftModifier: >>> shift = True >>> if self._lastModifiers & Qt.ControlModifier: >>> ctrl = True >>> >>> return ctrl, shift >>> >>> @classmethod >>> def _qtKeyToKeySymbol(cls, key): >>> if key not in VTKWidget._keySymbols: >>> return None >>> return VTKWidget._keySymbols[key] >>> >>> # Maps VTK cursors to Qt cursors >>> _cursors = { >>> VTK_CURSOR_DEFAULT: Qt.ArrowCursor, >>> VTK_CURSOR_ARROW: Qt.ArrowCursor, >>> VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, >>> VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, >>> VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, >>> VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, >>> VTK_CURSOR_SIZENS: Qt.SizeVerCursor, >>> VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, >>> VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, >>> VTK_CURSOR_HAND: Qt.PointingHandCursor, >>> VTK_CURSOR_CROSSHAIR: Qt.CrossCursor >>> } >>> >>> # Maps Qt keys to VTK key symbols >>> _keySymbols = { >>> Qt.Key_Backspace: 'BackSpace', >>> Qt.Key_Tab: 'Tab', >>> Qt.Key_Backtab: 'Tab', >>> # Qt.Key_Clear : 'Clear', >>> Qt.Key_Return: 'Return', >>> Qt.Key_Enter: 'Return', >>> Qt.Key_Shift: 'Shift_L', >>> Qt.Key_Control: 'Control_L', >>> Qt.Key_Alt: 'Alt_L', >>> Qt.Key_Pause: 'Pause', >>> Qt.Key_CapsLock: 'Caps_Lock', >>> Qt.Key_Escape: 'Escape', >>> Qt.Key_Space: 'space', >>> # Qt.Key_Prior : 'Prior', >>> # Qt.Key_Next : 'Next', >>> Qt.Key_End: 'End', >>> Qt.Key_Home: 'Home', >>> Qt.Key_Left: 'Left', >>> Qt.Key_Up: 'Up', >>> Qt.Key_Right: 'Right', >>> Qt.Key_Down: 'Down', >>> Qt.Key_SysReq: 'Snapshot', >>> Qt.Key_Insert: 'Insert', >>> Qt.Key_Delete: 'Delete', >>> Qt.Key_Help: 'Help', >>> Qt.Key_0: '0', >>> Qt.Key_1: '1', >>> Qt.Key_2: '2', >>> Qt.Key_3: '3', >>> Qt.Key_4: '4', >>> Qt.Key_5: '5', >>> Qt.Key_6: '6', >>> Qt.Key_7: '7', >>> Qt.Key_8: '8', >>> Qt.Key_9: '9', >>> Qt.Key_A: 'a', >>> Qt.Key_B: 'b', >>> Qt.Key_C: 'c', >>> Qt.Key_D: 'd', >>> Qt.Key_E: 'e', >>> Qt.Key_F: 'f', >>> Qt.Key_G: 'g', >>> Qt.Key_H: 'h', >>> Qt.Key_I: 'i', >>> Qt.Key_J: 'j', >>> Qt.Key_K: 'k', >>> Qt.Key_L: 'l', >>> Qt.Key_M: 'm', >>> Qt.Key_N: 'n', >>> Qt.Key_O: 'o', >>> Qt.Key_P: 'p', >>> Qt.Key_Q: 'q', >>> Qt.Key_R: 'r', >>> Qt.Key_S: 's', >>> Qt.Key_T: 't', >>> Qt.Key_U: 'u', >>> Qt.Key_V: 'v', >>> Qt.Key_W: 'w', >>> Qt.Key_X: 'x', >>> Qt.Key_Y: 'y', >>> Qt.Key_Z: 'z', >>> Qt.Key_Asterisk: 'asterisk', >>> Qt.Key_Plus: 'plus', >>> Qt.Key_Minus: 'minus', >>> Qt.Key_Period: 'period', >>> Qt.Key_Slash: 'slash', >>> Qt.Key_F1: 'F1', >>> Qt.Key_F2: 'F2', >>> Qt.Key_F3: 'F3', >>> Qt.Key_F4: 'F4', >>> Qt.Key_F5: 'F5', >>> Qt.Key_F6: 'F6', >>> Qt.Key_F7: 'F7', >>> Qt.Key_F8: 'F8', >>> Qt.Key_F9: 'F9', >>> Qt.Key_F10: 'F10', >>> Qt.Key_F11: 'F11', >>> Qt.Key_F12: 'F12', >>> Qt.Key_F13: 'F13', >>> Qt.Key_F14: 'F14', >>> Qt.Key_F15: 'F15', >>> Qt.Key_F16: 'F16', >>> Qt.Key_F17: 'F17', >>> Qt.Key_F18: 'F18', >>> Qt.Key_F19: 'F19', >>> Qt.Key_F20: 'F20', >>> Qt.Key_F21: 'F21', >>> Qt.Key_F22: 'F22', >>> Qt.Key_F23: 'F23', >>> Qt.Key_F24: 'F24', >>> Qt.Key_NumLock: 'Num_Lock', >>> Qt.Key_ScrollLock: 'Scroll_Lock' >>> } >>> >>> def example(): >>> # >>> # Try out VTKWidget by showing a couple of cones >>> # >>> from sys import argv, exit >>> from PyQt5.QtWidgets import QApplication, QVBoxLayout >>> from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor >>> >>> app = QApplication(argv) >>> >>> layout = QVBoxLayout() >>> >>> for i in range(2): >>> widget = VTKWidget() >>> >>> coneSource = vtkConeSource() >>> coneSource.SetResolution(8) >>> >>> coneMapper = vtkPolyDataMapper() >>> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>> >>> coneActor = vtkActor() >>> coneActor.SetMapper(coneMapper) >>> >>> widget.renderer.AddActor(coneActor) >>> >>> layout.addWidget(widget) >>> >>> container = QWidget() >>> container.setLayout(layout) >>> container.show() >>> >>> exit(app.exec_()) >>> >>> >>> if __name__ == '__main__': >>> example() >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 05:08:52 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 11:08:52 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-27 9:48 GMT+02:00 Elvis Stansvik : > 2016-06-27 9:09 GMT+02:00 Elvis Stansvik : > >> 2016-06-26 13:31 GMT+02:00 Elvis Stansvik : >> >>> 2016-06-26 13:06 GMT+02:00 Elvis Stansvik >>> : >>> >>>> Hi, >>>> >>>> In my quest to create a PyQt5 widget based on QOpenGLWidget for >>>> showing/interacting with VTK, I now have something that seems to work >>>> (including the whole thing as a runnable example below). >>>> >>> >>> It was a little too early to say "seems to work": When trying to show >>> one of the volumes I need to render, I get >>> >>> (gui) [estan at pyret orexplore.gui]$ python -m orexplore.gui.main >>> enabling depth test >>> ERROR: In >>> /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, >>> line 1682 >>> vtkGenericOpenGLRenderWindow (0x308c3f0): Hardware does not support the >>> number of textures defined. >>> >>> Segmentation fault (core dumped) >>> (gui) [estan at pyret orexplore.gui]$ >>> >>> on my Sandybridge laptop :/ >>> >>> Anyone know if I'd be able to use the old OpenGL backend here? >>> >> >> I can now confirm that I'm getting the same error on my Haswell work >> laptop (which is using the OpenGL2 backend) :( Anyone know if there's a way >> to solve this or what I should look into? >> >> The volume I'm trying to render is not particularly big (2000x120x120, >> float), and it renders fine if I use a QGLWidget to back my VTK widget >> instead of QOpenGLWidget. So I'm suspecting it might have something to do >> with how I set up my QOpenGLWidget. >> > > I tried printing the number of texture units in my StartEvent handler with > > > print(self.renderWindow.GetTextureUnitManager().GetNumberOfTextureUnits()) > > and it print 0, so I think something must definitely be wrong with how I > initialize things? > I've now tried from C++, with the QVTKWidget3 class from this StackOverflow poster: http://stackoverflow.com/a/26946040/252857 which was the inspiration for my own QOpenGLWidget-based PyQt5 widget, and I: - Get the same crash on OpenGLInitState as I mentioned in the start of this thread - If I comment the call to OpenGLInitState, I instead get the following crash in VTK when paintGL is called: (gdb) bt #0 0x0000000000000000 in ?? () #1 0x00007ffff7692efd in vtkOpenGLRenderWindow::ActivateTexture(vtkTextureObject*) () from /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 #2 0x00007ffff76d72c8 in vtkTextureObject::Create3DFromRaw(unsigned int, unsigned int, unsigned int, int, int, void*) () from /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 #3 0x00007ffff7ba8485 in vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::LoadVolume(vtkRenderer*, vtkImageData*, vtkVolumeProperty*, vtkDataArray*, int) () from /opt/VTK-7.0.0/lib/libvtkRenderingVolumeOpenGL2-7.0.so.1 #4 0x00007ffff7bb123d in vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer*, vtkVolume*) () from /opt/VTK-7.0.0/lib/libvtkRenderingVolumeOpenGL2-7.0.so.1 #5 0x00007ffff5ac1615 in vtkGPUVolumeRayCastMapper::Render(vtkRenderer*, vtkVolume*) () from /opt/VTK-7.0.0/lib/libvtkRenderingVolume-7.0.so.1 #6 0x00007ffff5361331 in vtkVolume::RenderVolumetricGeometry(vtkViewport*) () from /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 #7 0x00007ffff7694376 in vtkOpenGLRenderer::UpdateGeometry() () from /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 #8 0x00007ffff7694030 in vtkOpenGLRenderer::DeviceRender() () from /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 #9 0x00007ffff5341017 in vtkRenderer::Render() () from /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 #10 0x00007ffff533d4c5 in vtkRendererCollection::Render() () from /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 #11 0x00007ffff534705e in vtkRenderWindow::DoStereoRender() () from /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 #12 0x00007ffff534923b in vtkRenderWindow::Render() () from /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 #13 0x00007ffff7693031 in vtkOpenGLRenderWindow::Render() () from /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 #14 0x00007ffff534ca09 in vtkRenderWindowInteractor::Render() () from /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 #15 0x00000000004079dd in QVTKWidget3::paintGL() () #16 0x00007ffff6e1fdad in QOpenGLWidgetPrivate::invokeUserPaint (this=0x6c77f0) at kernel/qopenglwidget.cpp:812 #17 0x00007ffff6e00f88 in QWidget::event (this=0x7fffffffdba0, event=0x7fffffffd080) at kernel/qwidget.cpp:9044 #18 0x00007ffff6dbe05c in QApplicationPrivate::notify_helper (this=this at entry=0x643990, receiver=receiver at entry=0x7fffffffdba0, e=e at entry =0x7fffffffd080) at kernel/qapplication.cpp:3716 #19 0x00007ffff6dc3516 in QApplication::notify (this=0x7fffffffdb90, receiver=0x7fffffffdba0, e=0x7fffffffd080) at kernel/qapplication.cpp:3499 #20 0x00007ffff64cb62b in QCoreApplication::notifyInternal (this=0x7fffffffdb90, receiver=receiver at entry=0x7fffffffdba0, event=event at entry=0x7fffffffd080) at kernel/qcoreapplication.cpp:965 #21 0x00007ffff6df9a79 in QCoreApplication::sendSpontaneousEvent (event=0x7fffffffd080, receiver=) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227 #22 QWidgetPrivate::sendPaintEvent (this=this at entry=0x6c77f0, toBePainted=...) at kernel/qwidget.cpp:5625 #23 0x00007ffff6dfa0c1 in QWidgetPrivate::drawWidget (this=0x6c77f0, pdev=0xcc8ea0, rgn=..., offset=..., flags=flags at entry=5, sharedPainter=sharedPainter at entry=0x0, backingStore=0x808d20) at kernel/qwidget.cpp:5565 #24 0x00007ffff6dcb8aa in QWidgetBackingStore::doSync (this=this at entry=0x808d20) at kernel/qwidgetbackingstore.cpp:1226 #25 0x00007ffff6dcc0a2 in QWidgetBackingStore::sync (this=0x808d20, exposedWidget=0x7fffffffdba0, exposedRegion=...) at kernel/qwidgetbackingstore.cpp:954 #26 0x00007ffff6e1da43 in QWidgetWindow::event (this=0x6b3a30, event=0x7fffffffd7d0) at kernel/qwidgetwindow.cpp:255 #27 0x00007ffff6dbe05c in QApplicationPrivate::notify_helper (this=this at entry=0x643990, receiver=receiver at entry=0x6b3a30, e=e at entry =0x7fffffffd7d0) at kernel/qapplication.cpp:3716 #28 0x00007ffff6dc3516 in QApplication::notify (this=0x7fffffffdb90, receiver=0x6b3a30, e=0x7fffffffd7d0) at kernel/qapplication.cpp:3499 #29 0x00007ffff64cb62b in QCoreApplication::notifyInternal (this=0x7fffffffdb90, receiver=receiver at entry=0x6b3a30, event=event at entry =0x7fffffffd7d0) at kernel/qcoreapplication.cpp:965 #30 0x00007ffff680e4ec in QCoreApplication::sendSpontaneousEvent (event=0x7fffffffd7d0, receiver=0x6b3a30) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227 #31 QGuiApplicationPrivate::processExposeEvent (e=0xc55c10) at kernel/qguiapplication.cpp:2663 #32 0x00007ffff680f25d in QGuiApplicationPrivate::processWindowSystemEvent (e=e at entry=0xc55c10) at kernel/qguiapplication.cpp:1658 #33 0x00007ffff67f2f38 in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at kernel/qwindowsysteminterface.cpp:625 #34 0x00007ffff7ec0070 in userEventSourceDispatch (source=) at eventdispatchers/qeventdispatcher_glib.cpp:70 #35 0x00007ffff0643127 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #36 0x00007ffff0643380 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #37 0x00007ffff064342c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #38 0x00007ffff6521a7f in QEventDispatcherGlib::processEvents (this=0x6966d0, flags=...) at kernel/qeventdispatcher_glib.cpp:418 #39 0x00007ffff64c8dea in QEventLoop::exec (this=this at entry=0x7fffffffda90, flags=..., flags at entry=...) at kernel/qeventloop.cpp:204 #40 0x00007ffff64d0e8c in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1229 #41 0x00000000004066e1 in main () I noticed the crash is in ActivateTexture. Could this be due to the same texture unit problem I saw when using my Python widget? Elvis > Elvis > > >> >> What I'm doing to configure it is simply: >> >> # Request OpenGL 3.2 compatibility profile and enable >> multi-sampling >> surfaceFormat = QSurfaceFormat.defaultFormat() >> surfaceFormat.setMajorVersion(3) >> surfaceFormat.setMinorVersion(2) >> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >> surfaceFormat.setSamples(8) >> self.setFormat(surfaceFormat) >> >> The whole reason I'm trying to get QOpenGLWidget working is that >> QGLWidget does not have a setFormat in PyQt5, since it doesn't wrap >> functions marked "obsolete" in Qt, and this prevents me from enabling >> multi-sampling. >> >> Very grateful for any advice from experts on the OpenGL2 backend, as I >> really need to get this working and move on. >> >> I'm attaching my vtk_widget2.py, which shows how I set up rendering into >> the QOpenGLWidget. Rendering of the cone example at the bottom works, it's >> just when I'm trying volume rendering using vtkGPUVolumeRayCastMapper that >> I get the above error. >> >> Elvis >> >> >>> Elvis >>> >>> >>>> >>>> I do however have two problems (indicated by "FIXME:"s in the code >>>> below): >>>> >>>> 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when >>>> handling the render window StartEvent (commented out below), similar to how >>>> QVTKWidget2 does, I get a segmentation fault: >>>> >>>> (gdb) bt >>>> #0 0x0000000000000000 in ?? () >>>> #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () >>>> from /usr/lib/libvtkRenderingOpenGL2.so.1 >>>> #2 0x00007fffd8de8479 in ?? () from >>>> /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 >>>> #3 0x00007ffff79ba5e9 in PyCFunction_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #8 0x00007ffff79730da in PyObject_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #10 0x00007ffff79730da in PyObject_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, >>>> unsigned long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 >>>> #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 >>>> #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from >>>> /usr/lib/libvtkRenderingCore.so.1 >>>> #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from >>>> /usr/lib/libvtkRenderingOpenGL2.so.1 >>>> #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from >>>> /usr/lib/libvtkRenderingCore.so.1 >>>> #17 0x00007fffdf3ee789 in ?? () from >>>> /usr/lib/libvtkRenderingCorePython35D.so.1 >>>> #18 0x00007ffff79ba5e9 in PyCFunction_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #23 0x00007ffff79730da in PyObject_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #25 0x00007ffff79730da in PyObject_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #28 0x00007ffff79730da in PyObject_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #33 0x00007ffff7a33aeb in PyEval_EvalCode () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #35 0x00007ffff79ba5e9 in PyCFunction_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #42 0x00007ffff79730da in PyObject_Call () from >>>> /usr/lib/libpython3.5m.so.1.0 >>>> #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>> #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 >>>> #45 0x0000000000400ae7 in main () >>>> (gdb) >>>> >>>> Sorry for the lack of debugging symbols, but before I recompile VTK >>>> with debugging symbols, I thought I'd ask if anyone has an idea what may be >>>> the reason for the crash? I haven't seen any adverse effects from not >>>> calling this function, but I suspect something is broken? (how can I test?) >>>> >>>> 2. I can't seem to find a way to properly implement the >>>> WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent >>>> render window events. E.g. (from below): >>>> >>>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>>> callData = True # FIXME: This won't work... >>>> >>>> def _onWindowIsDirectEvent(self, sender, event, callData): >>>> callData = True # FIXME: This won't work... >>>> >>>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>>> callData = True # FIXME: This won't work... >>>> >>>> The callData is a bool* and the handler is expected to write a bool to >>>> the pointed memory. I can't see that there's any way to do this from Python >>>> (is it possible with ctypes somehow?). >>>> >>>> So far I haven't seen any adverse effects from not implementing these >>>> three events correctly, but expect something to be broken..? >>>> >>>> Thankful for any advice on these two issues, and it would be great if >>>> someone could try out the example, with the >>>> >>>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>>> >>>> line uncommented, to confirm the segfault I'm seeing. >>>> >>>> Cheers, >>>> Elvis >>>> >>>> >>>> from PyQt5.QtCore import Qt, QTimer, QEvent, QSize >>>> from PyQt5.QtGui import QSurfaceFormat >>>> from PyQt5.QtWidgets import QWidget, QOpenGLWidget >>>> >>>> from vtk import vtkGenericOpenGLRenderWindow >>>> from vtk import vtkGenericRenderWindowInteractor >>>> from vtk import vtkCommand >>>> from vtk import vtkRenderer >>>> >>>> from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE >>>> from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE >>>> from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, VTK_CURSOR_SIZEALL >>>> from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR >>>> >>>> >>>> class VTKWidget(QOpenGLWidget): >>>> >>>> def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), >>>> *args, **kwargs): >>>> super().__init__(*args, **kwargs) >>>> >>>> # Request OpenGL 3.2 compatibility profile and enable >>>> multi-sampling >>>> surfaceFormat.setMajorVersion(3) >>>> surfaceFormat.setMinorVersion(2) >>>> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >>>> surfaceFormat.setSamples(8) >>>> self.setFormat(surfaceFormat) >>>> >>>> # Create render window >>>> self.renderWindow = vtkGenericOpenGLRenderWindow() >>>> self.renderWindow.SetSize(self.width(), self.height()) >>>> self.renderWindow.SetPosition(self.x(), self.y()) >>>> >>>> self.renderWindow.AddObserver(vtkCommand.StartEvent, >>>> self._onStartEvent) >>>> self.renderWindow.AddObserver(vtkCommand.EndEvent, >>>> self._onEndEvent) >>>> self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, >>>> self._onCursorChangedEvent) >>>> self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, >>>> self._onWindowMakeCurrentEvent) >>>> self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, >>>> self._onWindowIsCurrentEvent) >>>> self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, >>>> self._onWindowFrameEvent) >>>> self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, >>>> self._onWindowIsDirectEvent) >>>> >>>> self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, >>>> self._onWindowSupportsOpenGLEvent) >>>> >>>> # Create interactor >>>> self.interactor = vtkGenericRenderWindowInteractor() >>>> self.interactor.SetRenderWindow(self.renderWindow) >>>> self.interactor.SetSize(self.width(), self.height()) >>>> self.interactor.AddObserver(vtkCommand.CreateTimerEvent, >>>> lambda *_: self._timer.start(10)) >>>> self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, >>>> lambda *_: self._timer.stop()) >>>> self.interactor.Start() >>>> >>>> # Create renderer >>>> self.renderer = vtkRenderer() >>>> self.renderWindow.AddRenderer(self.renderer) >>>> >>>> # Timer for the interactor >>>> self._timer = QTimer(self) >>>> self._timer.timeout.connect(self.interactor.TimerEvent) >>>> >>>> # Some tracked input state >>>> self._pressedButton = Qt.NoButton >>>> self._lastMouseX = 0 >>>> self._lastMouseY = 0 >>>> self._lastModifiers = Qt.NoModifier >>>> self._lastButtons = Qt.NoButton >>>> self._wheelDelta = 0 >>>> >>>> # Finalize render window before we're destroyed >>>> self._hidden = QWidget(self) >>>> self._hidden.hide() >>>> self._hidden.destroyed.connect(self.renderWindow.Finalize) >>>> >>>> # >>>> # Handle VTK render window events >>>> # >>>> >>>> def _onStartEvent(self, *_): >>>> self.makeCurrent() >>>> self.renderWindow.PushState() >>>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>>> >>>> def _onEndEvent(self, *_): >>>> self.renderWindow.PopState() >>>> >>>> def _onWindowMakeCurrentEvent(self, *_): >>>> pass # Handled automatically by QOpenGLWidget >>>> >>>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>>> callData = True # FIXME: This won't work... >>>> >>>> def _onWindowIsDirectEvent(self, sender, event, callData): >>>> callData = True # FIXME: This won't work... >>>> >>>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>>> callData = True # FIXME: This won't work... >>>> >>>> def _onWindowFrameEvent(self, *_): >>>> if self.renderWindow.GetSwapBuffers(): >>>> self.update() >>>> >>>> def _onCursorChangedEvent(self): >>>> >>>> def showCursor(): >>>> vtkCursor = self.renderWindow.GetCurrentCursor() >>>> qtCursor = VTKWidget._cursors.get(vtkCursor, Qt.ArrowCursor) >>>> self.setCursor(qtCursor) >>>> >>>> # Defer until cursor has actually changed >>>> QTimer.singleShot(0, showCursor) >>>> >>>> # >>>> # Implement QOpenGLWidget functions >>>> # >>>> >>>> def initializeGL(self): >>>> self.renderWindow.OpenGLInitContext() >>>> >>>> def paintGL(self): >>>> self.interactor.Render() >>>> >>>> def resizeGL(self, width, height): >>>> self.renderWindow.SetSize(width, height) >>>> self.interactor.SetSize(width, height) >>>> self.interactor.ConfigureEvent() >>>> >>>> # >>>> # Handle QWidget events >>>> # >>>> >>>> def closeEvent(self, _): >>>> self.renderWindow.Finalize() >>>> >>>> def sizeHint(self): >>>> return QSize(400, 400) >>>> >>>> def moveEvent(self, event): >>>> super().moveEvent(event) >>>> self.renderWindow.SetPosition(self.x(), self.y()) >>>> >>>> def enterEvent(self, event): >>>> ctrl, shift = self._modifiers(event) >>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>> self._lastMouseY, >>>> ctrl, shift, chr(0), >>>> 0, None) >>>> self.interactor.EnterEvent() >>>> >>>> def leaveEvent(self, event): >>>> ctrl, shift = self._modifiers(event) >>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>> self._lastMouseY, >>>> ctrl, shift, chr(0), >>>> 0, None) >>>> self.interactor.LeaveEvent() >>>> >>>> def mousePressEvent(self, event): >>>> ctrl, shift = self._modifiers(event) >>>> repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 >>>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>>> ctrl, shift, >>>> chr(0), repeat, None) >>>> >>>> self._pressedButton = event.button() >>>> >>>> if self._pressedButton == Qt.LeftButton: >>>> self.interactor.LeftButtonPressEvent() >>>> elif self._pressedButton == Qt.RightButton: >>>> self.interactor.RightButtonPressEvent() >>>> elif self._pressedButton == Qt.MidButton: >>>> self.interactor.MiddleButtonPressEvent() >>>> >>>> def mouseReleaseEvent(self, event): >>>> ctrl, shift = self._modifiers(event) >>>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>>> ctrl, shift, >>>> chr(0), 0, None) >>>> >>>> if self._pressedButton == Qt.LeftButton: >>>> self.interactor.LeftButtonReleaseEvent() >>>> elif self._pressedButton == Qt.RightButton: >>>> self.interactor.RightButtonReleaseEvent() >>>> elif self._pressedButton == Qt.MidButton: >>>> self.interactor.MiddleButtonReleaseEvent() >>>> >>>> self._pressedButton = Qt.NoButton >>>> >>>> def mouseMoveEvent(self, event): >>>> self._lastModifiers = event.modifiers() >>>> self._lastButtons = event.buttons() >>>> self._lastMouseX = event.x() >>>> self._lastMouseY = event.y() >>>> >>>> ctrl, shift = self._modifiers(event) >>>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>>> ctrl, shift, >>>> chr(0), 0, None) >>>> self.interactor.MouseMoveEvent() >>>> >>>> def keyPressEvent(self, event): >>>> ctrl, shift = self._modifiers(event) >>>> key = str(event.text()) if event.key() < 256 else chr(0) >>>> keySym = VTKWidget._qtKeyToKeySymbol(event.key()) >>>> >>>> if shift and len(keySym) == 1 and keySym.isalpha(): >>>> keySym = keySym.upper() >>>> >>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>> self._lastMouseY, >>>> ctrl, shift, key, 0, >>>> keySym) >>>> self.interactor.KeyPressEvent() >>>> self.interactor.CharEvent() >>>> >>>> def keyReleaseEvent(self, event): >>>> ctrl, shift = self._modifiers(event) >>>> key = chr(event.key()) if event.key() < 256 else chr(0) >>>> >>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>> self._lastMouseY, >>>> ctrl, shift, key, 0, >>>> None) >>>> self.interactor.KeyReleaseEvent() >>>> >>>> def wheelEvent(self, event): >>>> self._wheelDelta += event.angleDelta().y() >>>> >>>> if self._wheelDelta >= 120: >>>> self.interactor.MouseWheelForwardEvent() >>>> self._wheelDelta = 0 >>>> elif self._wheelDelta <= -120: >>>> self.interactor.MouseWheelBackwardEvent() >>>> self._wheelDelta = 0 >>>> >>>> def _modifiers(self, event): >>>> ctrl = shift = False >>>> >>>> if hasattr(event, 'modifiers'): >>>> if event.modifiers() & Qt.ShiftModifier: >>>> shift = True >>>> if event.modifiers() & Qt.ControlModifier: >>>> ctrl = True >>>> else: >>>> if self._lastModifiers & Qt.ShiftModifier: >>>> shift = True >>>> if self._lastModifiers & Qt.ControlModifier: >>>> ctrl = True >>>> >>>> return ctrl, shift >>>> >>>> @classmethod >>>> def _qtKeyToKeySymbol(cls, key): >>>> if key not in VTKWidget._keySymbols: >>>> return None >>>> return VTKWidget._keySymbols[key] >>>> >>>> # Maps VTK cursors to Qt cursors >>>> _cursors = { >>>> VTK_CURSOR_DEFAULT: Qt.ArrowCursor, >>>> VTK_CURSOR_ARROW: Qt.ArrowCursor, >>>> VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, >>>> VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, >>>> VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, >>>> VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, >>>> VTK_CURSOR_SIZENS: Qt.SizeVerCursor, >>>> VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, >>>> VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, >>>> VTK_CURSOR_HAND: Qt.PointingHandCursor, >>>> VTK_CURSOR_CROSSHAIR: Qt.CrossCursor >>>> } >>>> >>>> # Maps Qt keys to VTK key symbols >>>> _keySymbols = { >>>> Qt.Key_Backspace: 'BackSpace', >>>> Qt.Key_Tab: 'Tab', >>>> Qt.Key_Backtab: 'Tab', >>>> # Qt.Key_Clear : 'Clear', >>>> Qt.Key_Return: 'Return', >>>> Qt.Key_Enter: 'Return', >>>> Qt.Key_Shift: 'Shift_L', >>>> Qt.Key_Control: 'Control_L', >>>> Qt.Key_Alt: 'Alt_L', >>>> Qt.Key_Pause: 'Pause', >>>> Qt.Key_CapsLock: 'Caps_Lock', >>>> Qt.Key_Escape: 'Escape', >>>> Qt.Key_Space: 'space', >>>> # Qt.Key_Prior : 'Prior', >>>> # Qt.Key_Next : 'Next', >>>> Qt.Key_End: 'End', >>>> Qt.Key_Home: 'Home', >>>> Qt.Key_Left: 'Left', >>>> Qt.Key_Up: 'Up', >>>> Qt.Key_Right: 'Right', >>>> Qt.Key_Down: 'Down', >>>> Qt.Key_SysReq: 'Snapshot', >>>> Qt.Key_Insert: 'Insert', >>>> Qt.Key_Delete: 'Delete', >>>> Qt.Key_Help: 'Help', >>>> Qt.Key_0: '0', >>>> Qt.Key_1: '1', >>>> Qt.Key_2: '2', >>>> Qt.Key_3: '3', >>>> Qt.Key_4: '4', >>>> Qt.Key_5: '5', >>>> Qt.Key_6: '6', >>>> Qt.Key_7: '7', >>>> Qt.Key_8: '8', >>>> Qt.Key_9: '9', >>>> Qt.Key_A: 'a', >>>> Qt.Key_B: 'b', >>>> Qt.Key_C: 'c', >>>> Qt.Key_D: 'd', >>>> Qt.Key_E: 'e', >>>> Qt.Key_F: 'f', >>>> Qt.Key_G: 'g', >>>> Qt.Key_H: 'h', >>>> Qt.Key_I: 'i', >>>> Qt.Key_J: 'j', >>>> Qt.Key_K: 'k', >>>> Qt.Key_L: 'l', >>>> Qt.Key_M: 'm', >>>> Qt.Key_N: 'n', >>>> Qt.Key_O: 'o', >>>> Qt.Key_P: 'p', >>>> Qt.Key_Q: 'q', >>>> Qt.Key_R: 'r', >>>> Qt.Key_S: 's', >>>> Qt.Key_T: 't', >>>> Qt.Key_U: 'u', >>>> Qt.Key_V: 'v', >>>> Qt.Key_W: 'w', >>>> Qt.Key_X: 'x', >>>> Qt.Key_Y: 'y', >>>> Qt.Key_Z: 'z', >>>> Qt.Key_Asterisk: 'asterisk', >>>> Qt.Key_Plus: 'plus', >>>> Qt.Key_Minus: 'minus', >>>> Qt.Key_Period: 'period', >>>> Qt.Key_Slash: 'slash', >>>> Qt.Key_F1: 'F1', >>>> Qt.Key_F2: 'F2', >>>> Qt.Key_F3: 'F3', >>>> Qt.Key_F4: 'F4', >>>> Qt.Key_F5: 'F5', >>>> Qt.Key_F6: 'F6', >>>> Qt.Key_F7: 'F7', >>>> Qt.Key_F8: 'F8', >>>> Qt.Key_F9: 'F9', >>>> Qt.Key_F10: 'F10', >>>> Qt.Key_F11: 'F11', >>>> Qt.Key_F12: 'F12', >>>> Qt.Key_F13: 'F13', >>>> Qt.Key_F14: 'F14', >>>> Qt.Key_F15: 'F15', >>>> Qt.Key_F16: 'F16', >>>> Qt.Key_F17: 'F17', >>>> Qt.Key_F18: 'F18', >>>> Qt.Key_F19: 'F19', >>>> Qt.Key_F20: 'F20', >>>> Qt.Key_F21: 'F21', >>>> Qt.Key_F22: 'F22', >>>> Qt.Key_F23: 'F23', >>>> Qt.Key_F24: 'F24', >>>> Qt.Key_NumLock: 'Num_Lock', >>>> Qt.Key_ScrollLock: 'Scroll_Lock' >>>> } >>>> >>>> def example(): >>>> # >>>> # Try out VTKWidget by showing a couple of cones >>>> # >>>> from sys import argv, exit >>>> from PyQt5.QtWidgets import QApplication, QVBoxLayout >>>> from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor >>>> >>>> app = QApplication(argv) >>>> >>>> layout = QVBoxLayout() >>>> >>>> for i in range(2): >>>> widget = VTKWidget() >>>> >>>> coneSource = vtkConeSource() >>>> coneSource.SetResolution(8) >>>> >>>> coneMapper = vtkPolyDataMapper() >>>> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>>> >>>> coneActor = vtkActor() >>>> coneActor.SetMapper(coneMapper) >>>> >>>> widget.renderer.AddActor(coneActor) >>>> >>>> layout.addWidget(widget) >>>> >>>> container = QWidget() >>>> container.setLayout(layout) >>>> container.show() >>>> >>>> exit(app.exec_()) >>>> >>>> >>>> if __name__ == '__main__': >>>> example() >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.edmunds at icr.ac.uk Mon Jun 27 06:22:35 2016 From: david.edmunds at icr.ac.uk (Dave Edmunds) Date: Mon, 27 Jun 2016 03:22:35 -0700 (MST) Subject: [vtkusers] QVTKWidget on Mac Retina displays Message-ID: <1467022955133-5738934.post@n5.nabble.com> Hi all, I am using Qt 5.5 and VTK 6.3. When I render using a QVTKWidget, on an external monitor everything looks great, but on my Macbook Pro retina display, my application is only rendered to the lower left quadrant of the screen. This is presumably because of the retina display treating each real pixel as a 2x2 block. Simon provided a workaround in this post: http://public.kitware.com/pipermail/vtkusers/2015-February/090117.html Unfortunately, I can't make use of the Objective C commands he used. Has this been fixed, or does anyone know a pure C++ workaround for this issue? Kind regards, Dave -- View this message in context: http://vtk.1045678.n5.nabble.com/QVTKWidget-on-Mac-Retina-displays-tp5738934.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Mon Jun 27 06:36:22 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 12:36:22 +0200 Subject: [vtkusers] Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events In-Reply-To: References: Message-ID: 2016-06-27 11:08 GMT+02:00 Elvis Stansvik : > 2016-06-27 9:48 GMT+02:00 Elvis Stansvik : > >> 2016-06-27 9:09 GMT+02:00 Elvis Stansvik : >> >>> 2016-06-26 13:31 GMT+02:00 Elvis Stansvik >>> : >>> >>>> 2016-06-26 13:06 GMT+02:00 Elvis Stansvik >>> >: >>>> >>>>> Hi, >>>>> >>>>> In my quest to create a PyQt5 widget based on QOpenGLWidget for >>>>> showing/interacting with VTK, I now have something that seems to work >>>>> (including the whole thing as a runnable example below). >>>>> >>>> >>>> It was a little too early to say "seems to work": When trying to show >>>> one of the volumes I need to render, I get >>>> >>>> (gui) [estan at pyret orexplore.gui]$ python -m orexplore.gui.main >>>> enabling depth test >>>> ERROR: In >>>> /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, >>>> line 1682 >>>> vtkGenericOpenGLRenderWindow (0x308c3f0): Hardware does not support the >>>> number of textures defined. >>>> >>>> Segmentation fault (core dumped) >>>> (gui) [estan at pyret orexplore.gui]$ >>>> >>>> on my Sandybridge laptop :/ >>>> >>>> Anyone know if I'd be able to use the old OpenGL backend here? >>>> >>> >>> I can now confirm that I'm getting the same error on my Haswell work >>> laptop (which is using the OpenGL2 backend) :( Anyone know if there's a way >>> to solve this or what I should look into? >>> >>> The volume I'm trying to render is not particularly big (2000x120x120, >>> float), and it renders fine if I use a QGLWidget to back my VTK widget >>> instead of QOpenGLWidget. So I'm suspecting it might have something to do >>> with how I set up my QOpenGLWidget. >>> >> >> I tried printing the number of texture units in my StartEvent handler with >> >> >> print(self.renderWindow.GetTextureUnitManager().GetNumberOfTextureUnits()) >> >> and it print 0, so I think something must definitely be wrong with how I >> initialize things? >> > > I've now tried from C++, with the QVTKWidget3 class from this > StackOverflow poster: > > http://stackoverflow.com/a/26946040/252857 > > which was the inspiration for my own QOpenGLWidget-based PyQt5 widget, and > I: > > - Get the same crash on OpenGLInitState as I mentioned in the start of > this thread > > - If I comment the call to OpenGLInitState, I instead get the following > crash in VTK when paintGL is called: > > (gdb) bt > #0 0x0000000000000000 in ?? () > #1 0x00007ffff7692efd in > vtkOpenGLRenderWindow::ActivateTexture(vtkTextureObject*) () from > /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 > #2 0x00007ffff76d72c8 in vtkTextureObject::Create3DFromRaw(unsigned int, > unsigned int, unsigned int, int, int, void*) () > from /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 > #3 0x00007ffff7ba8485 in > vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::LoadVolume(vtkRenderer*, > vtkImageData*, vtkVolumeProperty*, vtkDataArray*, int) () > from /opt/VTK-7.0.0/lib/libvtkRenderingVolumeOpenGL2-7.0.so.1 > #4 0x00007ffff7bb123d in > vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer*, vtkVolume*) () > from /opt/VTK-7.0.0/lib/libvtkRenderingVolumeOpenGL2-7.0.so.1 > #5 0x00007ffff5ac1615 in vtkGPUVolumeRayCastMapper::Render(vtkRenderer*, > vtkVolume*) () from /opt/VTK-7.0.0/lib/libvtkRenderingVolume-7.0.so.1 > #6 0x00007ffff5361331 in > vtkVolume::RenderVolumetricGeometry(vtkViewport*) () from > /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 > #7 0x00007ffff7694376 in vtkOpenGLRenderer::UpdateGeometry() () from > /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 > #8 0x00007ffff7694030 in vtkOpenGLRenderer::DeviceRender() () from > /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 > #9 0x00007ffff5341017 in vtkRenderer::Render() () from > /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 > #10 0x00007ffff533d4c5 in vtkRendererCollection::Render() () from > /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 > #11 0x00007ffff534705e in vtkRenderWindow::DoStereoRender() () from > /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 > #12 0x00007ffff534923b in vtkRenderWindow::Render() () from > /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 > #13 0x00007ffff7693031 in vtkOpenGLRenderWindow::Render() () from > /opt/VTK-7.0.0/lib/libvtkRenderingOpenGL2-7.0.so.1 > #14 0x00007ffff534ca09 in vtkRenderWindowInteractor::Render() () from > /opt/VTK-7.0.0/lib/libvtkRenderingCore-7.0.so.1 > #15 0x00000000004079dd in QVTKWidget3::paintGL() () > #16 0x00007ffff6e1fdad in QOpenGLWidgetPrivate::invokeUserPaint > (this=0x6c77f0) at kernel/qopenglwidget.cpp:812 > #17 0x00007ffff6e00f88 in QWidget::event (this=0x7fffffffdba0, > event=0x7fffffffd080) at kernel/qwidget.cpp:9044 > #18 0x00007ffff6dbe05c in QApplicationPrivate::notify_helper > (this=this at entry=0x643990, receiver=receiver at entry=0x7fffffffdba0, > e=e at entry=0x7fffffffd080) > at kernel/qapplication.cpp:3716 > #19 0x00007ffff6dc3516 in QApplication::notify (this=0x7fffffffdb90, > receiver=0x7fffffffdba0, e=0x7fffffffd080) at kernel/qapplication.cpp:3499 > #20 0x00007ffff64cb62b in QCoreApplication::notifyInternal > (this=0x7fffffffdb90, receiver=receiver at entry=0x7fffffffdba0, > event=event at entry=0x7fffffffd080) > at kernel/qcoreapplication.cpp:965 > #21 0x00007ffff6df9a79 in QCoreApplication::sendSpontaneousEvent > (event=0x7fffffffd080, receiver=) > at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227 > #22 QWidgetPrivate::sendPaintEvent (this=this at entry=0x6c77f0, > toBePainted=...) at kernel/qwidget.cpp:5625 > #23 0x00007ffff6dfa0c1 in QWidgetPrivate::drawWidget (this=0x6c77f0, > pdev=0xcc8ea0, rgn=..., offset=..., flags=flags at entry=5, > sharedPainter=sharedPainter at entry=0x0, backingStore=0x808d20) at > kernel/qwidget.cpp:5565 > #24 0x00007ffff6dcb8aa in QWidgetBackingStore::doSync (this=this at entry=0x808d20) > at kernel/qwidgetbackingstore.cpp:1226 > #25 0x00007ffff6dcc0a2 in QWidgetBackingStore::sync (this=0x808d20, > exposedWidget=0x7fffffffdba0, exposedRegion=...) at > kernel/qwidgetbackingstore.cpp:954 > #26 0x00007ffff6e1da43 in QWidgetWindow::event (this=0x6b3a30, > event=0x7fffffffd7d0) at kernel/qwidgetwindow.cpp:255 > #27 0x00007ffff6dbe05c in QApplicationPrivate::notify_helper > (this=this at entry=0x643990, receiver=receiver at entry=0x6b3a30, e=e at entry > =0x7fffffffd7d0) > at kernel/qapplication.cpp:3716 > #28 0x00007ffff6dc3516 in QApplication::notify (this=0x7fffffffdb90, > receiver=0x6b3a30, e=0x7fffffffd7d0) at kernel/qapplication.cpp:3499 > #29 0x00007ffff64cb62b in QCoreApplication::notifyInternal > (this=0x7fffffffdb90, receiver=receiver at entry=0x6b3a30, event=event at entry > =0x7fffffffd7d0) > at kernel/qcoreapplication.cpp:965 > #30 0x00007ffff680e4ec in QCoreApplication::sendSpontaneousEvent > (event=0x7fffffffd7d0, receiver=0x6b3a30) > at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227 > #31 QGuiApplicationPrivate::processExposeEvent (e=0xc55c10) at > kernel/qguiapplication.cpp:2663 > #32 0x00007ffff680f25d in QGuiApplicationPrivate::processWindowSystemEvent > (e=e at entry=0xc55c10) at kernel/qguiapplication.cpp:1658 > #33 0x00007ffff67f2f38 in QWindowSystemInterface::sendWindowSystemEvents > (flags=...) at kernel/qwindowsysteminterface.cpp:625 > #34 0x00007ffff7ec0070 in userEventSourceDispatch (source=) > at eventdispatchers/qeventdispatcher_glib.cpp:70 > #35 0x00007ffff0643127 in g_main_context_dispatch () from > /lib/x86_64-linux-gnu/libglib-2.0.so.0 > #36 0x00007ffff0643380 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 > #37 0x00007ffff064342c in g_main_context_iteration () from > /lib/x86_64-linux-gnu/libglib-2.0.so.0 > #38 0x00007ffff6521a7f in QEventDispatcherGlib::processEvents > (this=0x6966d0, flags=...) at kernel/qeventdispatcher_glib.cpp:418 > #39 0x00007ffff64c8dea in QEventLoop::exec (this=this at entry=0x7fffffffda90, > flags=..., flags at entry=...) at kernel/qeventloop.cpp:204 > #40 0x00007ffff64d0e8c in QCoreApplication::exec () at > kernel/qcoreapplication.cpp:1229 > #41 0x00000000004066e1 in main () > > I noticed the crash is in ActivateTexture. Could this be due to the same > texture unit problem I saw when using my Python widget? > I've now made a minimal C++ test case. It uses the QVTKWidget3 class from [1] http://stackoverflow.com/a/26946040/252857 , but exhibits the same crashing behavior as my (similar) Python widget. The test case can be downloaded via https://dl.dropboxusercontent.com/u/22350696/test_vtkwidget3.tar.bz2 and includes a test volume. Build and run the test case with mkdir build cd build cmake .. make ./TestVTKWidget3 ../volume.vtk By default, the test case uses a plain render window, and works fine. But if you uncomment # Uncomment to try out QVTKWidget3 # add_definitions(-DUSE_QVTKWIDGET3) in CMakeLists.txt and rebuild, it will instead use QVTKWidget3 from the above StackOverflow. In this mode the test case either: - Crashes in vtkOpenGLRenderWindow::ActivateTexture, if the OpenGLInitState call in QVTKWidget3 is commented - Crashes in OpenGLInitState if it is uncommented I would be very grateful if someone could run this test case and see if they can reproduce (preferably on Intel graphics). Elvis > Elvis > > >> Elvis >> >> >>> >>> What I'm doing to configure it is simply: >>> >>> # Request OpenGL 3.2 compatibility profile and enable >>> multi-sampling >>> surfaceFormat = QSurfaceFormat.defaultFormat() >>> surfaceFormat.setMajorVersion(3) >>> surfaceFormat.setMinorVersion(2) >>> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >>> surfaceFormat.setSamples(8) >>> self.setFormat(surfaceFormat) >>> >>> The whole reason I'm trying to get QOpenGLWidget working is that >>> QGLWidget does not have a setFormat in PyQt5, since it doesn't wrap >>> functions marked "obsolete" in Qt, and this prevents me from enabling >>> multi-sampling. >>> >>> Very grateful for any advice from experts on the OpenGL2 backend, as I >>> really need to get this working and move on. >>> >>> I'm attaching my vtk_widget2.py, which shows how I set up rendering into >>> the QOpenGLWidget. Rendering of the cone example at the bottom works, it's >>> just when I'm trying volume rendering using vtkGPUVolumeRayCastMapper that >>> I get the above error. >>> >>> Elvis >>> >>> >>>> Elvis >>>> >>>> >>>>> >>>>> I do however have two problems (indicated by "FIXME:"s in the code >>>>> below): >>>>> >>>>> 1. When I try to call vtkOpenGLRenderWindow.OpenGLInitState when >>>>> handling the render window StartEvent (commented out below), similar to how >>>>> QVTKWidget2 does, I get a segmentation fault: >>>>> >>>>> (gdb) bt >>>>> #0 0x0000000000000000 in ?? () >>>>> #1 0x00007fffd8ad13b9 in vtkOpenGLRenderWindow::OpenGLInitState() () >>>>> from /usr/lib/libvtkRenderingOpenGL2.so.1 >>>>> #2 0x00007fffd8de8479 in ?? () from >>>>> /usr/lib/libvtkRenderingOpenGL2Python35D.so.1 >>>>> #3 0x00007ffff79ba5e9 in PyCFunction_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #4 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #5 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #6 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #7 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #8 0x00007ffff79730da in PyObject_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #9 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #10 0x00007ffff79730da in PyObject_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #11 0x00007ffff7a2a457 in PyEval_CallObjectWithKeywords () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #12 0x00007fffe8d905a0 in vtkPythonCommand::Execute(vtkObject*, >>>>> unsigned long, void*) () from /usr/lib/libvtkWrappingPython35Core.so.1 >>>>> #13 0x00007fffe89ac196 in ?? () from /usr/lib/libvtkCommonCore.so.1 >>>>> #14 0x00007fffdf022a0f in vtkRenderWindow::Render() () from >>>>> /usr/lib/libvtkRenderingCore.so.1 >>>>> #15 0x00007fffd8ad4461 in vtkOpenGLRenderWindow::Render() () from >>>>> /usr/lib/libvtkRenderingOpenGL2.so.1 >>>>> #16 0x00007fffdf027498 in vtkRenderWindowInteractor::Start() () from >>>>> /usr/lib/libvtkRenderingCore.so.1 >>>>> #17 0x00007fffdf3ee789 in ?? () from >>>>> /usr/lib/libvtkRenderingCorePython35D.so.1 >>>>> #18 0x00007ffff79ba5e9 in PyCFunction_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #19 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #20 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #21 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #22 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #23 0x00007ffff79730da in PyObject_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #24 0x00007ffff7989d64 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #25 0x00007ffff79730da in PyObject_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #26 0x00007ffff79cfa10 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #27 0x00007ffff79cdde6 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #28 0x00007ffff79730da in PyObject_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #29 0x00007ffff7a2c4bc in PyEval_EvalFrameEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #30 0x00007ffff7a32942 in PyEval_EvalFrameEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #31 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #32 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #33 0x00007ffff7a33aeb in PyEval_EvalCode () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #34 0x00007ffff7a2802d in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #35 0x00007ffff79ba5e9 in PyCFunction_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #36 0x00007ffff7a325f1 in PyEval_EvalFrameEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #37 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #38 0x00007ffff7a306e0 in PyEval_EvalFrameEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #39 0x00007ffff7a339e2 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #40 0x00007ffff7a33ac3 in PyEval_EvalCodeEx () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #41 0x00007ffff799db98 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #42 0x00007ffff79730da in PyObject_Call () from >>>>> /usr/lib/libpython3.5m.so.1.0 >>>>> #43 0x00007ffff7a6af01 in ?? () from /usr/lib/libpython3.5m.so.1.0 >>>>> #44 0x00007ffff7a6b7dc in Py_Main () from /usr/lib/libpython3.5m.so.1.0 >>>>> #45 0x0000000000400ae7 in main () >>>>> (gdb) >>>>> >>>>> Sorry for the lack of debugging symbols, but before I recompile VTK >>>>> with debugging symbols, I thought I'd ask if anyone has an idea what may be >>>>> the reason for the crash? I haven't seen any adverse effects from not >>>>> calling this function, but I suspect something is broken? (how can I test?) >>>>> >>>>> 2. I can't seem to find a way to properly implement the >>>>> WindowIsCurrentEvent, WindowIsDirectEvent and WindowSupportsOpenGLEvent >>>>> render window events. E.g. (from below): >>>>> >>>>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>>>> callData = True # FIXME: This won't work... >>>>> >>>>> def _onWindowIsDirectEvent(self, sender, event, callData): >>>>> callData = True # FIXME: This won't work... >>>>> >>>>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>>>> callData = True # FIXME: This won't work... >>>>> >>>>> The callData is a bool* and the handler is expected to write a bool to >>>>> the pointed memory. I can't see that there's any way to do this from Python >>>>> (is it possible with ctypes somehow?). >>>>> >>>>> So far I haven't seen any adverse effects from not implementing these >>>>> three events correctly, but expect something to be broken..? >>>>> >>>>> Thankful for any advice on these two issues, and it would be great if >>>>> someone could try out the example, with the >>>>> >>>>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>>>> >>>>> line uncommented, to confirm the segfault I'm seeing. >>>>> >>>>> Cheers, >>>>> Elvis >>>>> >>>>> >>>>> from PyQt5.QtCore import Qt, QTimer, QEvent, QSize >>>>> from PyQt5.QtGui import QSurfaceFormat >>>>> from PyQt5.QtWidgets import QWidget, QOpenGLWidget >>>>> >>>>> from vtk import vtkGenericOpenGLRenderWindow >>>>> from vtk import vtkGenericRenderWindowInteractor >>>>> from vtk import vtkCommand >>>>> from vtk import vtkRenderer >>>>> >>>>> from vtk import VTK_CURSOR_DEFAULT, VTK_CURSOR_ARROW, VTK_CURSOR_SIZENE >>>>> from vtk import VTK_CURSOR_SIZENW, VTK_CURSOR_SIZESW, VTK_CURSOR_SIZESE >>>>> from vtk import VTK_CURSOR_SIZENS, VTK_CURSOR_SIZEWE, >>>>> VTK_CURSOR_SIZEALL >>>>> from vtk import VTK_CURSOR_HAND, VTK_CURSOR_CROSSHAIR >>>>> >>>>> >>>>> class VTKWidget(QOpenGLWidget): >>>>> >>>>> def __init__(self, surfaceFormat=QSurfaceFormat.defaultFormat(), >>>>> *args, **kwargs): >>>>> super().__init__(*args, **kwargs) >>>>> >>>>> # Request OpenGL 3.2 compatibility profile and enable >>>>> multi-sampling >>>>> surfaceFormat.setMajorVersion(3) >>>>> surfaceFormat.setMinorVersion(2) >>>>> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >>>>> surfaceFormat.setSamples(8) >>>>> self.setFormat(surfaceFormat) >>>>> >>>>> # Create render window >>>>> self.renderWindow = vtkGenericOpenGLRenderWindow() >>>>> self.renderWindow.SetSize(self.width(), self.height()) >>>>> self.renderWindow.SetPosition(self.x(), self.y()) >>>>> >>>>> self.renderWindow.AddObserver(vtkCommand.StartEvent, >>>>> self._onStartEvent) >>>>> self.renderWindow.AddObserver(vtkCommand.EndEvent, >>>>> self._onEndEvent) >>>>> self.renderWindow.AddObserver(vtkCommand.CursorChangedEvent, >>>>> self._onCursorChangedEvent) >>>>> >>>>> self.renderWindow.AddObserver(vtkCommand.WindowMakeCurrentEvent, >>>>> self._onWindowMakeCurrentEvent) >>>>> self.renderWindow.AddObserver(vtkCommand.WindowIsCurrentEvent, >>>>> self._onWindowIsCurrentEvent) >>>>> self.renderWindow.AddObserver(vtkCommand.WindowFrameEvent, >>>>> self._onWindowFrameEvent) >>>>> self.renderWindow.AddObserver(vtkCommand.WindowIsDirectEvent, >>>>> self._onWindowIsDirectEvent) >>>>> >>>>> self.renderWindow.AddObserver(vtkCommand.WindowSupportsOpenGLEvent, >>>>> >>>>> self._onWindowSupportsOpenGLEvent) >>>>> >>>>> # Create interactor >>>>> self.interactor = vtkGenericRenderWindowInteractor() >>>>> self.interactor.SetRenderWindow(self.renderWindow) >>>>> self.interactor.SetSize(self.width(), self.height()) >>>>> self.interactor.AddObserver(vtkCommand.CreateTimerEvent, >>>>> lambda *_: self._timer.start(10)) >>>>> self.interactor.AddObserver(vtkCommand.DestroyTimerEvent, >>>>> lambda *_: self._timer.stop()) >>>>> self.interactor.Start() >>>>> >>>>> # Create renderer >>>>> self.renderer = vtkRenderer() >>>>> self.renderWindow.AddRenderer(self.renderer) >>>>> >>>>> # Timer for the interactor >>>>> self._timer = QTimer(self) >>>>> self._timer.timeout.connect(self.interactor.TimerEvent) >>>>> >>>>> # Some tracked input state >>>>> self._pressedButton = Qt.NoButton >>>>> self._lastMouseX = 0 >>>>> self._lastMouseY = 0 >>>>> self._lastModifiers = Qt.NoModifier >>>>> self._lastButtons = Qt.NoButton >>>>> self._wheelDelta = 0 >>>>> >>>>> # Finalize render window before we're destroyed >>>>> self._hidden = QWidget(self) >>>>> self._hidden.hide() >>>>> self._hidden.destroyed.connect(self.renderWindow.Finalize) >>>>> >>>>> # >>>>> # Handle VTK render window events >>>>> # >>>>> >>>>> def _onStartEvent(self, *_): >>>>> self.makeCurrent() >>>>> self.renderWindow.PushState() >>>>> # self.renderWindow.OpenGLInitState() # FIXME: Segfaults :( >>>>> >>>>> def _onEndEvent(self, *_): >>>>> self.renderWindow.PopState() >>>>> >>>>> def _onWindowMakeCurrentEvent(self, *_): >>>>> pass # Handled automatically by QOpenGLWidget >>>>> >>>>> def _onWindowIsCurrentEvent(self, sender, event, callData): >>>>> callData = True # FIXME: This won't work... >>>>> >>>>> def _onWindowIsDirectEvent(self, sender, event, callData): >>>>> callData = True # FIXME: This won't work... >>>>> >>>>> def _onWindowSupportsOpenGLEvent(self, sender, event, callData): >>>>> callData = True # FIXME: This won't work... >>>>> >>>>> def _onWindowFrameEvent(self, *_): >>>>> if self.renderWindow.GetSwapBuffers(): >>>>> self.update() >>>>> >>>>> def _onCursorChangedEvent(self): >>>>> >>>>> def showCursor(): >>>>> vtkCursor = self.renderWindow.GetCurrentCursor() >>>>> qtCursor = VTKWidget._cursors.get(vtkCursor, >>>>> Qt.ArrowCursor) >>>>> self.setCursor(qtCursor) >>>>> >>>>> # Defer until cursor has actually changed >>>>> QTimer.singleShot(0, showCursor) >>>>> >>>>> # >>>>> # Implement QOpenGLWidget functions >>>>> # >>>>> >>>>> def initializeGL(self): >>>>> self.renderWindow.OpenGLInitContext() >>>>> >>>>> def paintGL(self): >>>>> self.interactor.Render() >>>>> >>>>> def resizeGL(self, width, height): >>>>> self.renderWindow.SetSize(width, height) >>>>> self.interactor.SetSize(width, height) >>>>> self.interactor.ConfigureEvent() >>>>> >>>>> # >>>>> # Handle QWidget events >>>>> # >>>>> >>>>> def closeEvent(self, _): >>>>> self.renderWindow.Finalize() >>>>> >>>>> def sizeHint(self): >>>>> return QSize(400, 400) >>>>> >>>>> def moveEvent(self, event): >>>>> super().moveEvent(event) >>>>> self.renderWindow.SetPosition(self.x(), self.y()) >>>>> >>>>> def enterEvent(self, event): >>>>> ctrl, shift = self._modifiers(event) >>>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>>> self._lastMouseY, >>>>> ctrl, shift, chr(0), >>>>> 0, None) >>>>> self.interactor.EnterEvent() >>>>> >>>>> def leaveEvent(self, event): >>>>> ctrl, shift = self._modifiers(event) >>>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>>> self._lastMouseY, >>>>> ctrl, shift, chr(0), >>>>> 0, None) >>>>> self.interactor.LeaveEvent() >>>>> >>>>> def mousePressEvent(self, event): >>>>> ctrl, shift = self._modifiers(event) >>>>> repeat = 1 if event.type() == QEvent.MouseButtonDblClick else 0 >>>>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>>>> ctrl, shift, >>>>> chr(0), repeat, None) >>>>> >>>>> self._pressedButton = event.button() >>>>> >>>>> if self._pressedButton == Qt.LeftButton: >>>>> self.interactor.LeftButtonPressEvent() >>>>> elif self._pressedButton == Qt.RightButton: >>>>> self.interactor.RightButtonPressEvent() >>>>> elif self._pressedButton == Qt.MidButton: >>>>> self.interactor.MiddleButtonPressEvent() >>>>> >>>>> def mouseReleaseEvent(self, event): >>>>> ctrl, shift = self._modifiers(event) >>>>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>>>> ctrl, shift, >>>>> chr(0), 0, None) >>>>> >>>>> if self._pressedButton == Qt.LeftButton: >>>>> self.interactor.LeftButtonReleaseEvent() >>>>> elif self._pressedButton == Qt.RightButton: >>>>> self.interactor.RightButtonReleaseEvent() >>>>> elif self._pressedButton == Qt.MidButton: >>>>> self.interactor.MiddleButtonReleaseEvent() >>>>> >>>>> self._pressedButton = Qt.NoButton >>>>> >>>>> def mouseMoveEvent(self, event): >>>>> self._lastModifiers = event.modifiers() >>>>> self._lastButtons = event.buttons() >>>>> self._lastMouseX = event.x() >>>>> self._lastMouseY = event.y() >>>>> >>>>> ctrl, shift = self._modifiers(event) >>>>> self.interactor.SetEventInformationFlipY(event.x(), event.y(), >>>>> ctrl, shift, >>>>> chr(0), 0, None) >>>>> self.interactor.MouseMoveEvent() >>>>> >>>>> def keyPressEvent(self, event): >>>>> ctrl, shift = self._modifiers(event) >>>>> key = str(event.text()) if event.key() < 256 else chr(0) >>>>> keySym = VTKWidget._qtKeyToKeySymbol(event.key()) >>>>> >>>>> if shift and len(keySym) == 1 and keySym.isalpha(): >>>>> keySym = keySym.upper() >>>>> >>>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>>> self._lastMouseY, >>>>> ctrl, shift, key, 0, >>>>> keySym) >>>>> self.interactor.KeyPressEvent() >>>>> self.interactor.CharEvent() >>>>> >>>>> def keyReleaseEvent(self, event): >>>>> ctrl, shift = self._modifiers(event) >>>>> key = chr(event.key()) if event.key() < 256 else chr(0) >>>>> >>>>> self.interactor.SetEventInformationFlipY(self._lastMouseX, >>>>> self._lastMouseY, >>>>> ctrl, shift, key, 0, >>>>> None) >>>>> self.interactor.KeyReleaseEvent() >>>>> >>>>> def wheelEvent(self, event): >>>>> self._wheelDelta += event.angleDelta().y() >>>>> >>>>> if self._wheelDelta >= 120: >>>>> self.interactor.MouseWheelForwardEvent() >>>>> self._wheelDelta = 0 >>>>> elif self._wheelDelta <= -120: >>>>> self.interactor.MouseWheelBackwardEvent() >>>>> self._wheelDelta = 0 >>>>> >>>>> def _modifiers(self, event): >>>>> ctrl = shift = False >>>>> >>>>> if hasattr(event, 'modifiers'): >>>>> if event.modifiers() & Qt.ShiftModifier: >>>>> shift = True >>>>> if event.modifiers() & Qt.ControlModifier: >>>>> ctrl = True >>>>> else: >>>>> if self._lastModifiers & Qt.ShiftModifier: >>>>> shift = True >>>>> if self._lastModifiers & Qt.ControlModifier: >>>>> ctrl = True >>>>> >>>>> return ctrl, shift >>>>> >>>>> @classmethod >>>>> def _qtKeyToKeySymbol(cls, key): >>>>> if key not in VTKWidget._keySymbols: >>>>> return None >>>>> return VTKWidget._keySymbols[key] >>>>> >>>>> # Maps VTK cursors to Qt cursors >>>>> _cursors = { >>>>> VTK_CURSOR_DEFAULT: Qt.ArrowCursor, >>>>> VTK_CURSOR_ARROW: Qt.ArrowCursor, >>>>> VTK_CURSOR_SIZENE: Qt.SizeBDiagCursor, >>>>> VTK_CURSOR_SIZENW: Qt.SizeFDiagCursor, >>>>> VTK_CURSOR_SIZESW: Qt.SizeBDiagCursor, >>>>> VTK_CURSOR_SIZESE: Qt.SizeFDiagCursor, >>>>> VTK_CURSOR_SIZENS: Qt.SizeVerCursor, >>>>> VTK_CURSOR_SIZEWE: Qt.SizeHorCursor, >>>>> VTK_CURSOR_SIZEALL: Qt.SizeAllCursor, >>>>> VTK_CURSOR_HAND: Qt.PointingHandCursor, >>>>> VTK_CURSOR_CROSSHAIR: Qt.CrossCursor >>>>> } >>>>> >>>>> # Maps Qt keys to VTK key symbols >>>>> _keySymbols = { >>>>> Qt.Key_Backspace: 'BackSpace', >>>>> Qt.Key_Tab: 'Tab', >>>>> Qt.Key_Backtab: 'Tab', >>>>> # Qt.Key_Clear : 'Clear', >>>>> Qt.Key_Return: 'Return', >>>>> Qt.Key_Enter: 'Return', >>>>> Qt.Key_Shift: 'Shift_L', >>>>> Qt.Key_Control: 'Control_L', >>>>> Qt.Key_Alt: 'Alt_L', >>>>> Qt.Key_Pause: 'Pause', >>>>> Qt.Key_CapsLock: 'Caps_Lock', >>>>> Qt.Key_Escape: 'Escape', >>>>> Qt.Key_Space: 'space', >>>>> # Qt.Key_Prior : 'Prior', >>>>> # Qt.Key_Next : 'Next', >>>>> Qt.Key_End: 'End', >>>>> Qt.Key_Home: 'Home', >>>>> Qt.Key_Left: 'Left', >>>>> Qt.Key_Up: 'Up', >>>>> Qt.Key_Right: 'Right', >>>>> Qt.Key_Down: 'Down', >>>>> Qt.Key_SysReq: 'Snapshot', >>>>> Qt.Key_Insert: 'Insert', >>>>> Qt.Key_Delete: 'Delete', >>>>> Qt.Key_Help: 'Help', >>>>> Qt.Key_0: '0', >>>>> Qt.Key_1: '1', >>>>> Qt.Key_2: '2', >>>>> Qt.Key_3: '3', >>>>> Qt.Key_4: '4', >>>>> Qt.Key_5: '5', >>>>> Qt.Key_6: '6', >>>>> Qt.Key_7: '7', >>>>> Qt.Key_8: '8', >>>>> Qt.Key_9: '9', >>>>> Qt.Key_A: 'a', >>>>> Qt.Key_B: 'b', >>>>> Qt.Key_C: 'c', >>>>> Qt.Key_D: 'd', >>>>> Qt.Key_E: 'e', >>>>> Qt.Key_F: 'f', >>>>> Qt.Key_G: 'g', >>>>> Qt.Key_H: 'h', >>>>> Qt.Key_I: 'i', >>>>> Qt.Key_J: 'j', >>>>> Qt.Key_K: 'k', >>>>> Qt.Key_L: 'l', >>>>> Qt.Key_M: 'm', >>>>> Qt.Key_N: 'n', >>>>> Qt.Key_O: 'o', >>>>> Qt.Key_P: 'p', >>>>> Qt.Key_Q: 'q', >>>>> Qt.Key_R: 'r', >>>>> Qt.Key_S: 's', >>>>> Qt.Key_T: 't', >>>>> Qt.Key_U: 'u', >>>>> Qt.Key_V: 'v', >>>>> Qt.Key_W: 'w', >>>>> Qt.Key_X: 'x', >>>>> Qt.Key_Y: 'y', >>>>> Qt.Key_Z: 'z', >>>>> Qt.Key_Asterisk: 'asterisk', >>>>> Qt.Key_Plus: 'plus', >>>>> Qt.Key_Minus: 'minus', >>>>> Qt.Key_Period: 'period', >>>>> Qt.Key_Slash: 'slash', >>>>> Qt.Key_F1: 'F1', >>>>> Qt.Key_F2: 'F2', >>>>> Qt.Key_F3: 'F3', >>>>> Qt.Key_F4: 'F4', >>>>> Qt.Key_F5: 'F5', >>>>> Qt.Key_F6: 'F6', >>>>> Qt.Key_F7: 'F7', >>>>> Qt.Key_F8: 'F8', >>>>> Qt.Key_F9: 'F9', >>>>> Qt.Key_F10: 'F10', >>>>> Qt.Key_F11: 'F11', >>>>> Qt.Key_F12: 'F12', >>>>> Qt.Key_F13: 'F13', >>>>> Qt.Key_F14: 'F14', >>>>> Qt.Key_F15: 'F15', >>>>> Qt.Key_F16: 'F16', >>>>> Qt.Key_F17: 'F17', >>>>> Qt.Key_F18: 'F18', >>>>> Qt.Key_F19: 'F19', >>>>> Qt.Key_F20: 'F20', >>>>> Qt.Key_F21: 'F21', >>>>> Qt.Key_F22: 'F22', >>>>> Qt.Key_F23: 'F23', >>>>> Qt.Key_F24: 'F24', >>>>> Qt.Key_NumLock: 'Num_Lock', >>>>> Qt.Key_ScrollLock: 'Scroll_Lock' >>>>> } >>>>> >>>>> def example(): >>>>> # >>>>> # Try out VTKWidget by showing a couple of cones >>>>> # >>>>> from sys import argv, exit >>>>> from PyQt5.QtWidgets import QApplication, QVBoxLayout >>>>> from vtk import vtkConeSource, vtkPolyDataMapper, vtkActor >>>>> >>>>> app = QApplication(argv) >>>>> >>>>> layout = QVBoxLayout() >>>>> >>>>> for i in range(2): >>>>> widget = VTKWidget() >>>>> >>>>> coneSource = vtkConeSource() >>>>> coneSource.SetResolution(8) >>>>> >>>>> coneMapper = vtkPolyDataMapper() >>>>> coneMapper.SetInputConnection(coneSource.GetOutputPort()) >>>>> >>>>> coneActor = vtkActor() >>>>> coneActor.SetMapper(coneMapper) >>>>> >>>>> widget.renderer.AddActor(coneActor) >>>>> >>>>> layout.addWidget(widget) >>>>> >>>>> container = QWidget() >>>>> container.setLayout(layout) >>>>> container.show() >>>>> >>>>> exit(app.exec_()) >>>>> >>>>> >>>>> if __name__ == '__main__': >>>>> example() >>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From myk321 at gmail.com Mon Jun 27 07:43:35 2016 From: myk321 at gmail.com (Michael Arnold) Date: Mon, 27 Jun 2016 19:43:35 +0800 Subject: [vtkusers] Fwd: vtkCubeAxesActor positions text labels incorrectly on axis In-Reply-To: References: Message-ID: Thanks Dave, It looks like mantis user registration is down, so I'll put the defect logging task into my diary for later: "User registration is currently disabled due to recent spam attacks. For now please report your problem to a relevant project user mailing list instead." With the correction below, the problem is now limited to axes with 10 elements. I've attached some screen-shots showing axes with 9 elements (ok), 10 element (problem), 11 elements (ok), 12 elements (ok). The 10 element problem I have highlighted with a red circle - where the expectation is that the label position should be back from the end of the axis, like it is for the 12 element example. I'll try and see if I can get the paraview code to work. Kind regards, Michael On Fri, Jun 24, 2016 at 7:50 PM, David Lonie wrote: > Hi Michael, > > Looking at our change log, it doesn't appear that the vtkCubeAxesActor has > seen many significant changes since 6.1, so I doubt a newer version would > work any differently. I'm not aware of anyone currently working on this > class, but I do know that there is a replacement in development in > ParaView, vtkGridAxes3DActor: > > > https://github.com/Kitware/ParaView/blob/master/ParaViewCore/VTKExtensions/Default/vtkGridAxes3DActor.h > > There's been talk of moving it into VTK, but I'm not aware of any firm > plans at this point. > > In the meantime, feel free to file a bug report / feature request for this > so it doesn't get lost. > > Dave > > On Fri, Jun 24, 2016 at 7:12 AM, Michael Arnold wrote: > >> Sorry - my bad: >> cubeAxesActor->SetXAxisRange(0.0, Labels.size() * 1.0); >> needs to be: >> cubeAxesActor->SetXAxisRange(1.0, Labels.size() * 1.0); >> >> Michael >> >> >> ----------------------------------------------------------------------------------------- >> >> Problem: for axis labels created using vtkCubeAxesActor, if we have more >> than 10 text labels, the labels and the data don't line-up, because the >> labels are positioned incorrectly on the axis. >> >> What are we Getting in more Detail: >> (a) If we have 9 data points (<10) we get 9 label points, with the last >> label at the end of the axis. So the labels can be 1,2,3,4,5,6,7,8,9, >> which lines-up nicely with the data: all is good in the world. >> (b) If we have 10 data points, we get get 6 labels points with the last >> label one at the end of the axis. We compute a label skip factor of 2. We >> start at the beginning of the axis. We label 1,3,5,7,9,11 <- what category >> is this last label?? We only have 10 data points! So the last data label >> does not line-up with its data. >> (c) If we have 11 data points, we again get 6 label points with the last >> label positioned a short distance back from the end of the axis. Again we >> compute a label skip factor of 2. We begin to label at the beginning of >> the axis. So we get 1,3,5,7,9,11. Ok, because we had 11 data-points, but >> now we land-up with the label for the last data element being back from the >> end of the axis i.e. the data label does not line-up with its data. >> >> What we want: >> (a) VTK seems to make a quite reasonable assumption to limit the number of >> labels to less than 10, so lets stick with that. >> (b) VTK works fine with data sets with 9 or fewer elements, so lets focus >> on data-sets with 10 or more data-points. >> (c) We need to handle data-sets with an even count of elements slightly >> differently from data-sets with an odd count of elements. (For a more >> generic handling this would be if the count of the elements is divisible by >> the skip factor, but for the moment lets stick to a skip factor of 2 and >> thus even or odd element counts). >> (d) For a data-set with an odd count of elements (lets say 11) we can >> easily imagine the handling to be: >> Smallest at the start (e.g. 1) >> Biggest at the end (eg. 11) >> Then fill-in the labels using the skip factor (2 in this case), so we get >> something like 1,3,5,7,9,11 >> (e) For a data-set with an even count of elements (lets say 10), we need to >> have a gap between the last label and the end of the axis. The end of the >> axis seems most logical place for this gap, so the last label point is back >> a bit from the end of the axis. So: >> Smallest at the start (e.g. 1) >> Then fill in the labels using the skip factor, so something like 1,3,5,7,9 >> and we happily land-up with a label of 9 being a bit back from the end of >> the axis. >> >> So what was the difference between what we want and what we are getting? >> The problem is not about the calculation of the number of labels - that is >> fine. >> The problem is the positioning of the labels on the axis - is the last >> label at the end of the axis or bit back from the end? >> Today, for data-sets with an even number of elements, we are getting the >> last label at the end of the axis. This is incorrect because for an even >> number of elements, we want the last label to be positioned back from the >> end of axis. >> Today, for data-sets with odd number of elements, we are getting the last >> label positioned with a gap before the end of the axis. Again this is >> incorrect, because the label should be positioned at the end of the axis. >> >> Questions: >> I'm using an old'ish version of VTK 6.1 - has this issue been fixed in a >> newer version? >> Am I misunderstanding something or can I raise a defect for this? >> >> Some Code: >> >> vtkSmartPointer cubeAxesActor = >> vtkSmartPointer::New(); >> cubeAxesActor->SetBounds(outputPolyData->GetBounds()); >> cubeAxesActor->SetCamera(Renderer->GetActiveCamera()); >> cubeAxesActor->GetTitleTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White >> cubeAxesActor->GetLabelTextProperty(0)->SetColor(1.0, 1.0, 1.0); //White >> cubeAxesActor->SetXTitle("X-Axis"); >> cubeAxesActor->GetXAxesGridlinesProperty()->SetColor(1.0, 1.0, 1.0); >> //White >> >> cubeAxesActor->DrawXGridlinesOn(); >> cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST); >> cubeAxesActor->SetFlyModeToOuterEdges(); //Place the axes on the >> outer edges of the cube >> >> //Set the labels on the x-axis >> vtkSmartPointer XAxisLabels = >> vtkSmartPointer::New(); >> std::vector Labels = ResultsServer->GetXLabels(); //Get a >> list of axis labels >> if (!Labels.empty()) { >> >> int32_t SkipFactor = (Labels.size() / 10) + 1; >> int32_t Counter = 0; >> >> //Evenly divisble >> for (auto LabelsIt = std::begin(Labels); LabelsIt != std::end(Labels); >> ++LabelsIt) >> if (Counter++ % SkipFactor == 0) >> XAxisLabels->InsertNextValue(LabelsIt->c_str()); >> >> cubeAxesActor->SetXAxisRange(0.0, Labels.size() * 1.0); >> cubeAxesActor->GetLabelTextProperty(0)->SetFontSize(20); >> cubeAxesActor->GetLabelTextProperty(0)->SetOrientation(90.0); >> cubeAxesActor->SetAxisLabels(0, XAxisLabels); >> >> Labels.clear(); >> } >> >> Kind regards, >> Michael >> >> >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 10element_problem.png Type: image/png Size: 11083 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 11elements_ok.png Type: image/png Size: 6118 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 12elements_ok.png Type: image/png Size: 13933 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 9elements_ok.png Type: image/png Size: 6173 bytes Desc: not available URL: From david.lonie at kitware.com Mon Jun 27 08:41:33 2016 From: david.lonie at kitware.com (David Lonie) Date: Mon, 27 Jun 2016 08:41:33 -0400 Subject: [vtkusers] initializing vtk array from std::vector for charting In-Reply-To: <1229748017.1975097.1467007198109.JavaMail.yahoo@mail.yahoo.com> References: <1229748017.1975097.1467007198109.JavaMail.yahoo.ref@mail.yahoo.com> <1229748017.1975097.1467007198109.JavaMail.yahoo@mail.yahoo.com> Message-ID: See vtkDoubleArray::SetArray http://www.vtk.org/doc/nightly/html/classvtkAOSDataArrayTemplate.html#a7f9c5547ac008ac745e6f8295ff869a6 vtkUnsignedShortArray has a similar method. HTH, Dave On Mon, Jun 27, 2016 at 1:59 AM, arasu via vtkusers wrote: > I have data that is stored in std::vector - one for the X axis and one for > the y axis. How do I get this into vtkarray / vtkTable for plotting - other > than iterate through the vector and setting values one by one (there is a > lot of data ). my data is either std::vector or > std::vector. > > Is there a way to assign a pointer from my data to the vtkarray, or at > least do a bulk copy of all the data rather than individually setting the > values. > > Thanks in advance, > > -Arasu > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lonie at kitware.com Mon Jun 27 09:02:12 2016 From: david.lonie at kitware.com (David Lonie) Date: Mon, 27 Jun 2016 09:02:12 -0400 Subject: [vtkusers] GL2PSExporter issue In-Reply-To: References: Message-ID: I can confirm that GL2PS is not supported in VTK 7.0 on the OpenGL2 backend. It should be working on the master branch for both backends, though. It is for me: >>> import vtk >>> a = vtk.vtkGL2PSExporter() >>> print a.GetClassName() vtkOpenGLGL2PSExporter If it's failing to locate the override class ("vtkOpenGLGL2PSExporter"), that means that the IOExportOpenGL2 module is missing. Double check that Module_vtkIOExportOpenGL2 is enabled in the new build against master. Build in a clean directory and verify that there's a libvtkIOExportOpenGL2 library in [buildDir]/lib afterwards. HTH, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfaieghi at westerneng.ca Mon Jun 27 08:47:09 2016 From: mfaieghi at westerneng.ca (Reza Faieghi) Date: Mon, 27 Jun 2016 08:47:09 -0400 Subject: [vtkusers] Writing CMake file for VTK+CUDA project Message-ID: ?Hello, I am trying to write a CMake file for my project which involves using CUDA and VTK. I generate the code for VS12 but during compilation I receive couple of errors. In order to find the problem, I have separated my code into distinct CUDA and VTK sections and ran them as two different VS Solutions and they work fine. However, when I combine VTK and CUDA in a same CMake file it fails. Apparently there has been some limitations in using VTK and CUDA together in a CMake file as mentioned here . However, there are some implementations that use these two together properly (I have been able to properly run the github-rep code in my computer but when I try to apply the same method of CMake coding for my project, it fails.). Here are the CMake code that I use to generate CUDA + VTK: cmake_minimum_required(VERSION 2.8) project(Test) find_package(VTK REQUIRED) include(${VTK_USE_FILE}) find_package(CUDA REQUIRED) if (CUDA_FOUND) message("CUDA found!") else() message("CUDA not found, doing something alternatively") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_FORCE_INLINES") set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --gpu-architecture sm_20) CUDA_ADD_EXECUTABLE(Test source.cu) target_link_libraries( Test ${VTK_LIBRARIES} ) I am using CUDA 7.5, VTK 7.0.0 and CMake 3.6.0. Here is the source.cu. It is basically combination of VTK Hello World example (Rendering a Cylinder) and vectorAdd.cu in CUDA samples and both are working separately. #include #include #include "vtkCylinderSource.h" #include "vtkPolyDataMapper.h" #include "vtkActor.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkProperty.h" #include "vtkCamera.h" #include "vtkSmartPointer.h" /** * CUDA Kernel Device code * * Computes the vector addition of A and B into C. The 3 vectors have the same * number of elements numElements. */ __global__ void vectorAdd(const float *A, const float *B, float *C, int numElements) { int i = blockDim.x * blockIdx.x + threadIdx.x; if (i < numElements) { C[i] = A[i] + B[i]; } } /** * Host main routine */ int main(void) { // Error code to check return values for CUDA calls cudaError_t err = cudaSuccess; // Print the vector length to be used, and compute its size int numElements = 50000; size_t size = numElements * sizeof(float); printf("[Vector addition of %d elements]\n", numElements); // Allocate the host input vector A float *h_A = (float *)malloc(size); // Allocate the host input vector B float *h_B = (float *)malloc(size); // Allocate the host output vector C float *h_C = (float *)malloc(size); // Verify that allocations succeeded if (h_A == NULL || h_B == NULL || h_C == NULL) { fprintf(stderr, "Failed to allocate host vectors!\n"); exit(EXIT_FAILURE); } // Initialize the host input vectors for (int i = 0; i < numElements; ++i) { h_A[i] = rand()/(float)RAND_MAX; h_B[i] = rand()/(float)RAND_MAX; } // Allocate the device input vector A float *d_A = NULL; err = cudaMalloc((void **)&d_A, size); if (err != cudaSuccess) { fprintf(stderr, "Failed to allocate device vector A (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } // Allocate the device input vector B float *d_B = NULL; err = cudaMalloc((void **)&d_B, size); if (err != cudaSuccess) { fprintf(stderr, "Failed to allocate device vector B (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } // Allocate the device output vector C float *d_C = NULL; err = cudaMalloc((void **)&d_C, size); if (err != cudaSuccess) { fprintf(stderr, "Failed to allocate device vector C (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } // Copy the host input vectors A and B in host memory to the device input vectors in // device memory printf("Copy input data from the host memory to the CUDA device\n"); err = cudaMemcpy(d_A, h_A, size, cudaMemcpyHostToDevice); if (err != cudaSuccess) { fprintf(stderr, "Failed to copy vector A from host to device (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } err = cudaMemcpy(d_B, h_B, size, cudaMemcpyHostToDevice); if (err != cudaSuccess) { fprintf(stderr, "Failed to copy vector B from host to device (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } // Launch the Vector Add CUDA Kernel int threadsPerBlock = 256; int blocksPerGrid =(numElements + threadsPerBlock - 1) / threadsPerBlock; printf("CUDA kernel launch with %d blocks of %d threads\n", blocksPerGrid, threadsPerBlock); vectorAdd<<>>(d_A, d_B, d_C, numElements); err = cudaGetLastError(); if (err != cudaSuccess) { fprintf(stderr, "Failed to launch vectorAdd kernel (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } // Copy the device result vector in device memory to the host result vector // in host memory. printf("Copy output data from the CUDA device to the host memory\n"); err = cudaMemcpy(h_C, d_C, size, cudaMemcpyDeviceToHost); if (err != cudaSuccess) { fprintf(stderr, "Failed to copy vector C from device to host (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } // Verify that the result vector is correct for (int i = 0; i < numElements; ++i) { if (fabs(h_A[i] + h_B[i] - h_C[i]) > 1e-5) { fprintf(stderr, "Result verification failed at element %d!\n", i); exit(EXIT_FAILURE); } } printf("Test PASSED\n"); // Free device global memory err = cudaFree(d_A); if (err != cudaSuccess) { fprintf(stderr, "Failed to free device vector A (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } err = cudaFree(d_B); if (err != cudaSuccess) { fprintf(stderr, "Failed to free device vector B (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } err = cudaFree(d_C); if (err != cudaSuccess) { fprintf(stderr, "Failed to free device vector C (error code %s)!\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } // Free host memory free(h_A); free(h_B); free(h_C); // Reset the device and exit // cudaDeviceReset causes the driver to clean up all state. While // not mandatory in normal operation, it is good practice. It is also // needed to ensure correct operation when the application is being // profiled. Calling cudaDeviceReset causes all profile data to be // flushed before the application exits err = cudaDeviceReset(); if (err != cudaSuccess) { fprintf(stderr, "Failed to deinitialize the device! error=%s\n", cudaGetErrorString(err)); exit(EXIT_FAILURE); } printf("Done\n"); // This creates a polygonal cylinder model with eight circumferential facets // (i.e, in practice an octagonal prism). vtkSmartPointer cylinder = vtkSmartPointer::New(); cylinder->SetResolution(8); // The mapper is responsible for pushing the geometry into the graphics library. // It may also do color mapping, if scalars or other attributes are defined. vtkSmartPointer cylinderMapper = vtkSmartPointer::New(); cylinderMapper->SetInputConnection(cylinder->GetOutputPort()); // The actor is a grouping mechanism: besides the geometry (mapper), it // also has a property, transformation matrix, and/or texture map. // Here we set its color and rotate it around the X and Y axes. vtkSmartPointer cylinderActor = vtkSmartPointer::New(); cylinderActor->SetMapper(cylinderMapper); cylinderActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784); cylinderActor->RotateX(30.0); cylinderActor->RotateY(-45.0); // The renderer generates the image // which is then displayed on the render window. // It can be thought of as a scene to which the actor is added vtkSmartPointer renderer = vtkSmartPointer::New(); renderer->AddActor(cylinderActor); renderer->SetBackground(0.1, 0.2, 0.4); // Zoom in a little by accessing the camera and invoking its "Zoom" method. renderer->ResetCamera(); renderer->GetActiveCamera()->Zoom(1.5); // The render window is the actual GUI window // that appears on the computer screen vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->SetSize(200, 200); renderWindow->AddRenderer(renderer); // The render window interactor captures mouse events // and will perform appropriate camera or actor manipulation // depending on the nature of the events. vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); // This starts the event loop and as a side effect causes an initial render. renderWindowInteractor->Start(); return 0; } After the code is generated by CMake, the first error that I am getting during building the project is: Error MSB6006: "cmd.exe" exited with code 1. C:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets I have fixed this by changing the build customization to CUDA and moving the .cu file into VS project directory. Then, another compilation error occurs and I do not know how to fix this. error LNK1104: cannot open file 'C:\Users\Reza\Desktop\cuda_vtk_testing\build\CMakeFiles\Test.dir\Debug\Test_generated_vectorAdd.cu.obj' C:\Users\Reza\Desktop\cuda_vtk_testing\build\LINK Test Generally, how do we write a CMake code when we want to combine CUDA and VTK? What are my mistakes that VS12 cannot find includes of VTK in my codes? Best Regards, Reza? -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 09:55:43 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 15:55:43 +0200 Subject: [vtkusers] Notification after interaction with vtkComposite(TransferFunction|ControlPoints)Item In-Reply-To: References: Message-ID: 2016-06-22 12:23 GMT+02:00 Elvis Stansvik : > 2016-06-22 11:07 GMT+02:00 Elvis Stansvik : > >> 2016-06-22 10:36 GMT+02:00 Elvis Stansvik : >> >>> 2016-06-21 16:02 GMT+02:00 Elvis Stansvik >>> : >>> >>>> Hi all, >>>> >>>> I'm using a vtkCompositeTransferFunctionItem + >>>> vtkCompositeControlPointsItem in a vtkChartXY to modify the transfer >>>> functions used for some volume rendering. >>>> >>>> Is there some event from one of these items I can observe that will >>>> fire once interaction has occurred? I know I can observe the ModifiedEvent >>>> of the vtkCompositeTransferFunctionItem, but when dragging points around, >>>> it will fire on each mouse move. I need to be notified only once the >>>> interaction has stopped. >>>> >>> >>> Looking at the code, I noticed that vtkControlPointsItem seem to emit >>> vtkCommand::StartInteractionEvent and vtkCommand::EndInteractionEvent >>> (though I'm not sure...), and since vtkCompositeControlPointsItem >>> indirectly inherits vtkControlPointsItem, I tried to observe >>> vtkCommand::EndInteractionEvent with >>> >>> self._pointsItem.AddObserver(vtkCommand.EndInteractionEvent, >>> lambda *_: print('interaction >>> ended')) >>> >>> where self._pointsItem is my vtkCompositeControlPointsItem. >>> >>> But it seems the event is not emitted when I interact with the points. >>> >>> Any ideas here? Surely there must be some way of being notified when >>> interaction with the color transfer functions has ended? My use case is >>> that I don't want to issue a re-render of my volume each time the mouse >>> moves when dragging a point around. Only when dragging finally stops do I >>> want to re-render. >>> >>> Any advice is much appriciated. >>> >> >> After some more experimentation, trying to observe various events on the >> items, the chart, the context view and the context scene, I've realized I >> can observe >> >> vtkCommand.LeftButtonReleaseEvent >> vtkCommand.RightButtonReleaseEvent >> vtkCommand.MiddleButtonReleaseEvent >> >> on the context scene. This will work as a workaround, but seems overly >> liberal and complicated. Is there no single event on the composite control >> points item or the composite transfer function item I could observe? >> > > Although I realized now that this approach won't work, since for some > reason, by the time I get the vtkCommand.MiddleButtonReleaseEvent, the > point has not yet been deleted. So still looking for a proper solution. > Noone knows how this can be done? I noticed that ParaView also has this behavior (that the rendering is updated on each mouse move when dragging a point in the transfer function). For me, this will be too heavy :/ Only once mouse movement stops do I want to re-render. But I can't seem to find a way to do this when using these VTK-bundled transfer function editing widgets. Elvis > > Elvis > > >> > >> Elvis >> >> >>> Elvis >>> >>> >>>> Thanks in advance, >>>> Elvis >>>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lekiam87 at gmail.com Mon Jun 27 10:23:50 2016 From: lekiam87 at gmail.com (Maikel) Date: Mon, 27 Jun 2016 07:23:50 -0700 (MST) Subject: [vtkusers] Crop irregular region in volumen rendering Message-ID: <1467037430579-5738941.post@n5.nabble.com> Hello to everyone, i need crop a volume rendering like Osirix Viewer, selecting one region using freehand -- View this message in context: http://vtk.1045678.n5.nabble.com/Crop-irregular-region-in-volumen-rendering-tp5738941.html Sent from the VTK - Users mailing list archive at Nabble.com. From chuck.atkins at kitware.com Mon Jun 27 14:20:45 2016 From: chuck.atkins at kitware.com (Chuck Atkins) Date: Mon, 27 Jun 2016 14:20:45 -0400 Subject: [vtkusers] Writing CMake file for VTK+CUDA project In-Reply-To: References: Message-ID: Hi Reza, > find_package(CUDA REQUIRED) > if (CUDA_FOUND) > message("CUDA found!") > else() > message("CUDA not found, doing something alternatively") > endif() > The if(CUDA_FOUND) is redundant since the REQUIRED argument to find_package will generate a fatal error if not found. If you want to be able to have two different configurations, one found and one not found, then just remove the REQUIRED from find_package(CUDA). > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} > Rather than explicitly force the CXX flags, there's more compiler agnostic ways to address this: -std=c++11 > instead of forcing the flag, let CMake do the work for you. Just set the CXX_STANDARD=11 property on the resulting target and CMake will know how to set the correct flag. > -D_FORCE_INLINES > Use add_definitions(-D_FORCE_INLINES). The end effect is the same but it does a better job of propagating target usage requirements under the hood. CUDA_ADD_EXECUTABLE(Test source.cu) > Ideally you should keep the host and device code seperate. That way the CUDA compiler is only used for actual CUDA code and your host compiler deals with the rest. > I am using CUDA 7.5, VTK 7.0.0 and CMake 3.6.0. Here is the source.cu. It > is basically combination of VTK Hello World example (Rendering a Cylinder) > and vectorAdd.cu in CUDA samples and both are working separately. > > What are my mistakes that VS12 cannot find includes of VTK in my codes > You're missing a call to CUDA_INCLUDE_DIRECTORIES to pass them to the separate CUDA compiler > Generally, how do we write a CMake code when we want to combine CUDA and > VTK? > Putting it all together, we get: cmake_minimum_required(VERSION 3.3) project(Test) find_package(VTK REQUIRED) include(${VTK_USE_FILE}) find_package(CUDA REQUIRED) add_definitions(-D_FORCE_INLINES) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --gpu-architecture sm_20) // The following is ONLY necessary if your CDA code is actually including VTK CUDA_INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS}) CUDA_ADD_EXECUTABLE(Test cylinder.cxx vectorAdd.cu) target_link_libraries(Test ${VTK_LIBRARIES}) set_target_properties(Test PROPERTIES CXX_STANDARD 11) Hope that helps, - Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Mon Jun 27 15:43:56 2016 From: ken.martin at kitware.com (Ken Martin) Date: Mon, 27 Jun 2016 15:43:56 -0400 Subject: [vtkusers] Projected shadow rendering in a vtkRenderWindow In-Reply-To: References: Message-ID: For both the old and new OpenGL backends there are tests built into VTK using shadows. See VTK/Rendering/OpenGL2/Testing/Cxx/TestShadowMapPass.cxx or if building the old backend VTK/Rendering/OpenGL/Testing/Cxx/TestShadowMapPass.cxx. I have do not know if those will work in conjunction with the stereo technique you are using but those examples should give you some ideas. Thanks Ken On Mon, Jun 27, 2016 at 3:22 AM, Remi Charrier wrote: > Dear vtk users community, > > I started 3 weeks ago a new project with vtk, I just register to this > mailing list to get answers to some of my questions. Let me know if I am > doing anything wrong in the use of this mailing list. > > My development environment is : > - Visual Studio 2013 > - vtk7.0 > - qt5.7 > My computer has a NVidia TITAN X graphic card. > > Here is my problem: > - I managed to create a vtkRenderWindow that allows me to display > different 3D meshes > - I am using Stereo Rendering (Anaglyph mode) > - I would like to project the shadows of my different elements on the > others elements. > > To do so I tried many different things, but did not manage to find > anything that seems to work. > Here are what I tried: > - vtkEDLshading - I got it running but it does not do what I expected and > no projected shadows appear > - vtkShadowMapBakerPass (as described in > http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Shadows) but I > have compilation errors on vtkShadowMapBakerPass::OCCLUDER(), it seems > this class has change or I missed something: "error C2039: 'OCCLUDER' : > is not a member of 'vtkShadowMapBakerPass'" > - Then I tried to only use basic functions associated to the renderer or > the actors: m_Renderer->UseShadowsOn(); m_cylTipActor->GetProperty()->ShadingOn(); > But once again no visible result... > > If someone can tell me where the correct information to display projected > shadows with VTK 7.0 can be found, I can then investigate and come back to > you with my code if I am still having problems. > > Thanks in advance, > R?mi (glad to come back to vtk after an 8 years break) > > > > Garanti > sans virus. www.avast.com > > <#m_8386774261481987078_DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 15:44:14 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 21:44:14 +0200 Subject: [vtkusers] CMake best practice for using VTK? Message-ID: I'm using the trio find_package(VTK REQUIRED) include(${VTK_USE_FILE}) target_link_libraries(myapp ${VTK_LIBRARIES}) in my CMakeLists.txt, to find and link against VTK, like is done in the VTK examples. This results in the final link command: /usr/bin/g++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DvtkFiltersFlowPaths_AUTOINIT="1(vtkFiltersParallelFlowPaths)" -DvtkIOExodus_AUTOINIT="1(vtkIOParallelExodus)" -DvtkIOGeometry_AUTOINIT="1(vtkIOMPIParallel)" -DvtkIOImage_AUTOINIT="1(vtkIOMPIImage)" -DvtkIOParallel_AUTOINIT="1(vtkIOMPIParallel)" -DvtkIOSQL_AUTOINIT="2(vtkIOMySQL,vtkIOPostgreSQL)" -DvtkRenderingContext2D_AUTOINIT="1(vtkRenderingContextOpenGL)" -DvtkRenderingCore_AUTOINIT="3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL)" -DvtkRenderingFreeType_AUTOINIT="2(vtkRenderingFreeTypeFontConfig,vtkRenderingMatplotlib)" -DvtkRenderingLIC_AUTOINIT="1(vtkRenderingParallelLIC)" -DvtkRenderingVolume_AUTOINIT="1(vtkRenderingVolumeOpenGL)" -Isrc -I/home/estan/Projekt/orexplore/dev/src/gui/src -I/usr/include/vtk -I/usr/include/python3.5m -I/usr/include/freetype2 -I/usr/include/libxml2 -isystem /usr/include/qt -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtCore -isystem /usr/lib/qt/mkspecs/linux-g++ -O3 -DNDEBUG -fPIC -std=gnu++11 -MMD -MT src/CMakeFiles/gui.dir/gui_automoc.cpp.o -MF src/CMakeFiles/gui.dir/gui_automoc.cpp.o.d -o src/CMakeFiles/gui.dir/gui_automoc.cpp.o -c src/gui_automoc.cpp [6/6 0.0/sec] : && /usr/bin/g++ -O3 -DNDEBUG src/CMakeFiles/gui.dir/main.cpp.o src/CMakeFiles/gui.dir/MainWindow.cpp.o src/CMakeFiles/gui.dir/gui_automoc.cpp.o -o src/gui /usr/lib/ libpython3.5m.so /usr/lib/libvtkInfovisBoostGraphAlgorithms.so.1 /usr/lib/libvtkTestingRendering.so.1 /usr/lib64/libz.so /usr/lib64/libjpeg.so /usr/lib64/libpng.so /usr/lib64/libtiff.so /usr/lib/libvtkFiltersParallelFlowPaths.so.1 /usr/lib/libvtkFiltersFlowPaths.so.1 /usr/lib/libvtkRenderingLOD.so.1 /usr/lib64/libfreetype.so /usr/lib/libvtkWrappingTools.a /usr/lib/libvtkIOMINC.so.1 /usr/lib/libvtkglew.so.1 /usr/lib64/libjsoncpp.so /usr/lib/libvtkRenderingQt.so.1 /usr/lib/libvtkFiltersTexture.so.1 /usr/lib/libvtkViewsContext2D.so.1 /usr/lib64/libgl2ps.so /usr/lib/libvtkFiltersParallelMPI.so.1 /usr/lib/libvtkViewsGeovis.so.1 /usr/lib/libvtkGeovisCore.so.1 /usr/lib64/libexpat.so /usr/lib/libvtkproj4.so.1 /usr/lib64/libxml2.so /usr/lib/libvtkIOMPIParallel.so.1 /usr/lib/libvtkIOParallel.so.1 /usr/lib/libvtkIONetCDF.so.1 /usr/lib/libvtkRenderingParallelLIC.so.1 /usr/lib/libvtkRenderingLIC.so.1 /usr/lib/libvtkIOMySQL.so.1 /usr/lib/libvtkGUISupportQtWebkit.so.1 /usr/lib/libvtkDomainsChemistry.so.1 /usr/lib/libvtkRenderingFreeTypeFontConfig.so.1 /usr/lib/libvtkIOImport.so.1 /usr/lib/libvtkFiltersReebGraph.so.1 /usr/lib/libvtkFiltersProgrammable.so.1 /usr/lib/libvtkIOParallelExodus.so.1 /usr/lib/libvtkIOExodus.so.1 /usr/lib/libvtkIOFFMPEG.so.1 /usr/lib/libvtkIOMovie.so.1 /usr/lib64/libtheoraenc.so /usr/lib64/libtheoradec.so /usr/lib64/libogg.so /usr/lib/libvtkIOParallelNetCDF.so.1 /usr/lib/libvtkFiltersGeneric.so.1 /usr/lib/libvtkIOGDAL.so.1 /usr/lib/libvtkRenderingParallel.so.1 /usr/lib/libvtkFiltersParallelStatistics.so.1 /usr/lib/libvtkIOExport.so.1 /usr/lib/libvtkIOGeoJSON.so.1 /usr/lib/libvtkRenderingMatplotlib.so.1 /usr/lib/libvtkPythonInterpreter.so.1 /usr/lib/libvtkIOXdmf3.so.1 /usr/lib/libvtkxdmf3.so /usr/lib/libvtkImagingMath.so.1 /usr/lib/libvtkImagingStatistics.so.1 /usr/lib/libvtkFiltersSMP.so.1 /usr/lib/libvtkIOXdmf2.so.1 /usr/lib/libvtkxdmf2.so.1 /usr/lib/libvtkIOParallelLSDyna.so.1 /usr/lib/libvtkIOLSDyna.so.1 /usr/lib/libvtkIOMPIImage.so.1 /usr/lib/libvtkLocalExample.so.1 /usr/lib/libvtkFiltersPython.so.1 /usr/lib/libvtkIOParallelXML.so.1 /usr/lib/libvtkFiltersVerdict.so.1 /usr/lib/libvtkverdict.so.1 /usr/lib/libvtkInteractionImage.so.1 /usr/lib/libvtkFiltersSelection.so.1 /usr/lib/libvtkIOEnSight.so.1 /usr/lib/libvtkIOInfovis.so.1 /usr/lib/libvtkRenderingImage.so.1 /usr/lib/libvtkIOPLY.so.1 /usr/lib/libvtkFiltersHyperTree.so.1 /usr/lib/libvtkParallelMPI4Py.so.1 /usr/lib/libvtkFiltersParallelImaging.so.1 /usr/lib/libvtkWrappingJava.so.1 /usr/lib/libvtkImagingMorphological.so.1 /usr/lib/libvtkIOPostgreSQL.so.1 /usr/lib/libvtkImagingStencil.so.1 /usr/lib/libvtkIOVPIC.so.1 /usr/lib/libvtkGUISupportQtOpenGL.so.1 /usr/lib/libvtkGUISupportQtSQL.so.1 /usr/lib/libvtkTestingIOSQL.so.1 /usr/lib/libvtkIOAMR.so.1 /usr/lib/libvtkFiltersParallelGeometry.so.1 /usr/lib/libvtkIOVideo.so.1 /usr/lib/libvtkTestingGenericBridge.so.1 /usr/lib/libvtkRenderingVolumeAMR.so.1 /usr/lib/libvtkIOODBC.so.1 /usr/lib/libvtkViewsQt.so.1 /usr/lib/libvtkViewsInfovis.so.1 /usr/lib/libvtkChartsCore.so.1 /usr/lib/libvtkInfovisLayout.so.1 /usr/lib/libvtkViewsCore.so.1 /usr/lib/libvtkexoIIc.so.1 /usr/lib/libvtkNetCDF_cxx.so.1 /usr/lib/libvtkNetCDF.so.1 /usr/lib/libvtkRenderingLabel.so.1 /usr/lib/libvtkRenderingGL2PS.so.1 /usr/lib/libvtkRenderingContextOpenGL.so.1 /usr/lib/libvtkRenderingContext2D.so.1 /usr/lib/libXdmfCore.so /usr/lib64/libxml2.so /usr/lib/libvtkWrappingPython35Core.so.1 /usr/lib/libvtkInteractionWidgets.so.1 /usr/lib/libvtkFiltersHybrid.so.1 /usr/lib/libvtkRenderingAnnotation.so.1 /usr/lib/libvtkRenderingFreeType.so.1 /usr/lib64/libfreetype.so /usr/lib/libvtkImagingColor.so.1 /usr/lib/libvtkInfovisCore.so.1 /usr/lib/libvtkIOXML.so.1 /usr/lib/libvtkIOXMLParser.so.1 /usr/lib/libvtkIOGeometry.so.1 /usr/lib/libpython3.5m.so /usr/lib/libvtkFiltersImaging.so.1 /usr/lib/libvtkFiltersParallel.so.1 /usr/lib/libvtkFiltersModeling.so.1 /usr/lib/libvtkImagingGeneral.so.1 /usr/lib/libvtkImagingSources.so.1 /usr/lib/libvtkVPIC.so.1 /usr/lib/libvtkGUISupportQt.so.1 /usr/lib/libvtkInteractionStyle.so.1 /usr/lib/libQt5Widgets.so.5.7.0 /usr/lib/libQt5Gui.so.5.7.0 /usr/lib/libQt5Core.so.5.7.0 /usr/lib/libvtkhdf5_hl.so.1 /usr/lib/libvtkhdf5.so.1 -lm /usr/lib/libvtkParallelMPI.so.1 /usr/lib/libvtkFiltersAMR.so.1 /usr/lib/libvtkParallelCore.so.1 /usr/lib/libvtkIOLegacy.so.1 /usr/lib/libvtkRenderingVolumeOpenGL.so.1 /usr/lib/libvtkRenderingOpenGL.so.1 /usr/lib/libvtkImagingHybrid.so.1 /usr/lib/libvtkIOImage.so.1 /usr/lib/libvtkDICOMParser.so.1 /usr/lib/libvtkmetaio.so.1 /usr/lib64/libz.so /usr/lib64/libSM.so /usr/lib64/libICE.so /usr/lib64/libX11.so /usr/lib64/libXext.so /usr/lib64/libXt.so /usr/lib/libvtkRenderingVolume.so.1 /usr/lib/libvtkRenderingCore.so.1 /usr/lib/libvtkFiltersExtraction.so.1 /usr/lib/libvtkFiltersStatistics.so.1 /usr/lib/libvtkImagingFourier.so.1 /usr/lib/libvtkImagingCore.so.1 /usr/lib/libvtkalglib.so.1 /usr/lib/libvtkCommonColor.so.1 /usr/lib/libvtkFiltersGeometry.so.1 /usr/lib/libvtkFiltersSources.so.1 /usr/lib/libvtkFiltersGeneral.so.1 /usr/lib/libvtkFiltersCore.so.1 /usr/lib/libvtkCommonComputationalGeometry.so.1 /usr/lib/libvtkIOSQL.so.1 /usr/lib/libvtkIOCore.so.1 /usr/lib/libvtkCommonExecutionModel.so.1 /usr/lib/libvtkCommonDataModel.so.1 /usr/lib/libvtkCommonSystem.so.1 /usr/lib/libvtkCommonTransforms.so.1 /usr/lib/libvtksys.so.1 -ldl /usr/lib/libvtkCommonMisc.so.1 /usr/lib/libvtkCommonMath.so.1 /usr/lib/libvtkCommonCore.so.1 /usr/lib/libvtksqlite.so.1 -lpthread I'm surprised by two things: 1. The shear amount of libraries that are linked against. Are all these really necessary, or is it possible to more selective somehow? Is there something like Qt's CMake system, where you can pull in just a certain Qt module with target_link_libraries(myapp Qt5::Widgets) ? 2. How come the .so files are specified directly as inputs, with their full paths? Isn't the common method to just add the appropriate -l (and possibly -L if needed) flags? Cheers, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Mon Jun 27 16:10:39 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Mon, 27 Jun 2016 14:10:39 -0600 Subject: [vtkusers] CMake best practice for using VTK? In-Reply-To: References: Message-ID: On Mon, Jun 27, 2016 at 1:44 PM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > I'm using the trio > > find_package(VTK REQUIRED) > > include(${VTK_USE_FILE}) > > target_link_libraries(myapp ${VTK_LIBRARIES}) > > in my CMakeLists.txt, to find and link against VTK, like is done in the > VTK examples. > > I'm surprised by two things: > > 1. The shear amount of libraries that are linked against. Are all these > really necessary, or is it possible to more selective somehow? Is there > something like Qt's CMake system, where you can pull in just a certain Qt > module with target_link_libraries(myapp Qt5::Widgets) ? > > 2. How come the .so files are specified directly as inputs, with their > full paths? Isn't the common method to just add the appropriate -l (and > possibly -L if needed) flags? > I build my own list that contains only the libraries that I need, and I also try to be careful about public vs. private linkage. For example: set(VTK_LIBS vtkCommonCore vtkCommonDataModel vtkImagingCore vtkIOImage) # Also link vtkIOMPIImage if present, it has factories for vtkIOImage list(FIND VTK_LIBRARIES vtkIOMPIImage TMP_INDEX) if(TMP_INDEX GREATER -1) set(VTK_LIBS ${VTK_LIBS} vtkIOMPIImage) endif() target_link_libraries(${LIB_NAME} LINK_PUBLIC ${VTK_LIBS}) # target_link_libraries(${LIB_NAME} LINK_PRIVATE ) To find out what modules you need to link, the script VTK/Utilities/Maintenance/WhatModulesVTK.py can be of some use. I know this doesn't cover all of your points, but unfortunately this is as complete an answer as I have time to give right now. Hopefully someone else can jump in and provide more details. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Mon Jun 27 16:17:16 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Mon, 27 Jun 2016 22:17:16 +0200 Subject: [vtkusers] CMake best practice for using VTK? In-Reply-To: References: Message-ID: 2016-06-27 22:10 GMT+02:00 David Gobbi : > > > On Mon, Jun 27, 2016 at 1:44 PM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> I'm using the trio >> >> find_package(VTK REQUIRED) >> >> include(${VTK_USE_FILE}) >> >> target_link_libraries(myapp ${VTK_LIBRARIES}) >> >> in my CMakeLists.txt, to find and link against VTK, like is done in the >> VTK examples. >> >> I'm surprised by two things: >> >> 1. The shear amount of libraries that are linked against. Are all these >> really necessary, or is it possible to more selective somehow? Is there >> something like Qt's CMake system, where you can pull in just a certain Qt >> module with target_link_libraries(myapp Qt5::Widgets) ? >> >> 2. How come the .so files are specified directly as inputs, with their >> full paths? Isn't the common method to just add the appropriate -l (and >> possibly -L if needed) flags? >> > > I build my own list that contains only the libraries that I need, and I > also try to be careful about public vs. private linkage. For example: > > set(VTK_LIBS vtkCommonCore vtkCommonDataModel vtkImagingCore > vtkIOImage) > # Also link vtkIOMPIImage if present, it has factories for vtkIOImage > list(FIND VTK_LIBRARIES vtkIOMPIImage TMP_INDEX) > if(TMP_INDEX GREATER -1) > set(VTK_LIBS ${VTK_LIBS} vtkIOMPIImage) > endif() > > target_link_libraries(${LIB_NAME} LINK_PUBLIC ${VTK_LIBS}) > # target_link_libraries(${LIB_NAME} LINK_PRIVATE ) > > To find out what modules you need to link, the script > VTK/Utilities/Maintenance/WhatModulesVTK.py can be of some use. > > I know this doesn't cover all of your points, but unfortunately this is as > complete an answer as I have time to give right now. Hopefully someone > else can jump in and provide more details. > Ah, thanks for sharing! I'll have a look at that script. Elvis > > - David > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfaieghi at westerneng.ca Tue Jun 28 08:12:27 2016 From: mfaieghi at westerneng.ca (Reza Faieghi) Date: Tue, 28 Jun 2016 08:12:27 -0400 Subject: [vtkusers] Writing CMake file for VTK+CUDA project In-Reply-To: References: Message-ID: Hi Chuck, Thanks so very much for looking into my question and the detailed answer. As I am new to CUDA I have the tendency to keep both CUDA and VTK in a single .cu file. But, I keep your advice in mind that ideal code should have host and device codes separated. I have written the CMake code according to your and I have ran into few problems: First, upon building the solution I have got the "cmd.exe exited with code 1" error. To get around this one, I changed the build customization of the VS project into CUDA. Then, I had the error of "The given path's format is not supported". To fix this, I found that the .cu file must be moved into the VS project directory. After doing these, I have recieved the following error and could not really figure out how to address this one. Error 92 error LNK1104: cannot open file 'C:\Users\Reza\Desktop\cuda_vtk_testing\build\CMakeFiles\Test.dir\Debug\Test_generated_source.cu.obj' C:\Users\Reza\Desktop\cuda_vtk_testing\build\LINK Test It is confusing for me that the NVIDIA CUDA Samples run properly in my computer but this code gives me these errors. I was wondering if you could take a look into this error as well. Regards, Reza On Mon, Jun 27, 2016 at 2:20 PM, Chuck Atkins wrote: > Hi Reza, > > >> find_package(CUDA REQUIRED) >> if (CUDA_FOUND) >> message("CUDA found!") >> else() >> message("CUDA not found, doing something alternatively") >> endif() >> > > The if(CUDA_FOUND) is redundant since the REQUIRED argument to > find_package will generate a fatal error if not found. If you want to be > able to have two different configurations, one found and one not found, > then just remove the REQUIRED from find_package(CUDA). > > > >> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} >> > > Rather than explicitly force the CXX flags, there's more compiler agnostic > ways to address this: > > > -std=c++11 >> > > instead of forcing the flag, let CMake do the work for you. Just set the > CXX_STANDARD=11 property on the resulting target and CMake will know how to > set the correct flag. > > > >> -D_FORCE_INLINES >> > > Use add_definitions(-D_FORCE_INLINES). The end effect is the same but > it does a better job of propagating target usage requirements under the > hood. > > > CUDA_ADD_EXECUTABLE(Test source.cu) >> > > Ideally you should keep the host and device code seperate. That way the > CUDA compiler is only used for actual CUDA code and your host compiler > deals with the rest. > > > >> I am using CUDA 7.5, VTK 7.0.0 and CMake 3.6.0. Here is the source.cu. >> It is basically combination of VTK Hello World example (Rendering a >> Cylinder) and vectorAdd.cu in CUDA samples and both are working separately. >> > > > >> What are my mistakes that VS12 cannot find includes of VTK in my codes >> > You're missing a call to CUDA_INCLUDE_DIRECTORIES to pass them to the > separate CUDA compiler > > > >> Generally, how do we write a CMake code when we want to combine CUDA and >> VTK? >> > Putting it all together, we get: > > cmake_minimum_required(VERSION 3.3) > project(Test) > > find_package(VTK REQUIRED) > include(${VTK_USE_FILE}) > > find_package(CUDA REQUIRED) > > add_definitions(-D_FORCE_INLINES) > > set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --gpu-architecture sm_20) > > // The following is ONLY necessary if your CDA code is actually including > VTK > CUDA_INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS}) > > CUDA_ADD_EXECUTABLE(Test cylinder.cxx vectorAdd.cu) > target_link_libraries(Test ${VTK_LIBRARIES}) > set_target_properties(Test PROPERTIES CXX_STANDARD 11) > > Hope that helps, > - Chuck > -- PhD student in Biomedical Engineering, Spencer Engineering Building Room 37 University of Western Ontario London, ON, Canada, N6A 5B9 -------------- next part -------------- An HTML attachment was scrubbed... URL: From berk.geveci at kitware.com Tue Jun 28 09:46:01 2016 From: berk.geveci at kitware.com (Berk Geveci) Date: Tue, 28 Jun 2016 09:46:01 -0400 Subject: [vtkusers] VTK bug hackathon In-Reply-To: References: Message-ID: Hi folks, We are all set with July 6, 9-5 EDT. I reserved a large conference room at Kitware Headquarters in Clifton Park, NY. If you are interested in attending physically, please let me know. We will also have a Google Hangout running. Here is the link: https://hangouts.google.com/hangouts/_/kitware.com/vtk-hackathon I will check email regularly in the morning so please send me a note then if you have issues joining. Did I forget anything? Best, -berk On Mon, Jun 20, 2016 at 4:31 PM, Berk Geveci wrote: > Hi folks, > > We are planning a VTK bug hackathon on July 6. Going forward, we would > like this to be a monthly event during which the community comes together > to address bugs reported to the tracker. It will be an all day event that > we will host physically at Kitware Headquarters in Clifton Park, NY as well > as online via Google Hangout. All are welcome to attend as long as they > know the code base enough to fix bugs. > > Any questions? Comments? Any potential issue with the date? > > Best, > -berk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.grabietz at img-online.de Tue Jun 28 09:39:15 2016 From: michael.grabietz at img-online.de (Michael Grabietz) Date: Tue, 28 Jun 2016 15:39:15 +0200 Subject: [vtkusers] Kaspersky 2016 reports a virus in the windows installer for version 7.0.0 Message-ID: <9b97d15a-626b-5e87-382f-9aecb3f68ca7@img-online.de> Hello, I just downloaded the vtk7-Installer for Windows. I want to install vtk under Windows 10. Kaspersky Internet Security 2016 is running on the PC. I used the following installer: http://www.vtk.org/files/release/7.0/vtkpython-7.0.0-Windows-64bit.exe Kaspersky 2016 is up to date. When I start the installer Kaspersky reports an issue with the file. A virus was detected. Name or type of the virus is reported as 'UDS:DangerousObject.Multi.Generic'. When VTK 7.0.0 is installed Kaspersky reports every *.pyd file in the directory C:\Program Files\VTK 7.0.0\bin\Lib\site-packages\vtk as infected by 'UDS:DangerousObject.Multi.Generic' too. 85 files were quarantined. vtkChartsCorePython.pyd Date: 2016-01-28 21:00 vtkCommonColorPython.pyd Date: 2016-01-28 20:55 vtkCommonComputationalGeometryPython.pyd ... vtkViewsInfovisPython.pyd I checked these files on various computers running different virus scanners like F-Secure and even Kaspersky 2015 (not 2016!) with up to date data bases. They don't complain. Further I checked vtkChartsCorePython.pyd on the Kaspersky Site. There is a possibility to upload files for checking. It is reported as infected. Maybe somebody can give it a try and uploads one of these pyd files to the Kaspersky site to verify this behaviour. I hope it is a false positive. Do you had already some similar issues like that? I am rather confused, since I cannot find any suitable information in the web about this issue. Best regards, Michael From dave.demarle at kitware.com Tue Jun 28 10:02:34 2016 From: dave.demarle at kitware.com (David E DeMarle) Date: Tue, 28 Jun 2016 10:02:34 -0400 Subject: [vtkusers] Kaspersky 2016 reports a virus in the windows installer for version 7.0.0 In-Reply-To: <9b97d15a-626b-5e87-382f-9aecb3f68ca7@img-online.de> References: <9b97d15a-626b-5e87-382f-9aecb3f68ca7@img-online.de> Message-ID: Michael, We've had false positives like this before so I assume and hope this is another case of that happening. We'll investigate and report back when we know more. thanks, David E DeMarle Kitware, Inc. R&D Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Tue, Jun 28, 2016 at 9:39 AM, Michael Grabietz < michael.grabietz at img-online.de> wrote: > Hello, > > I just downloaded the vtk7-Installer for Windows. I want to install vtk > under Windows 10. Kaspersky Internet Security 2016 is running on the PC. > > I used the following installer: > > http://www.vtk.org/files/release/7.0/vtkpython-7.0.0-Windows-64bit.exe > > Kaspersky 2016 is up to date. > > > When I start the installer Kaspersky reports an issue with the file. A > virus was detected. Name or type of the virus is reported as > 'UDS:DangerousObject.Multi.Generic'. > > When VTK 7.0.0 is installed Kaspersky reports every *.pyd file in the > directory C:\Program Files\VTK 7.0.0\bin\Lib\site-packages\vtk as > infected by 'UDS:DangerousObject.Multi.Generic' too. 85 files were > quarantined. > > vtkChartsCorePython.pyd Date: 2016-01-28 21:00 > vtkCommonColorPython.pyd Date: 2016-01-28 20:55 > vtkCommonComputationalGeometryPython.pyd > ... > vtkViewsInfovisPython.pyd > > > I checked these files on various computers running different virus > scanners like F-Secure and even Kaspersky 2015 (not 2016!) with up to > date data bases. They don't complain. > > Further I checked vtkChartsCorePython.pyd on the Kaspersky Site. There > is a possibility to upload files for checking. It is reported as > infected. Maybe somebody can give it a try and uploads one of these pyd > files to the Kaspersky site to verify this behaviour. > > I hope it is a false positive. Do you had already some similar issues > like that? I am rather confused, since I cannot find any suitable > information in the web about this issue. > > > Best regards, Michael > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Tue Jun 28 10:24:15 2016 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 28 Jun 2016 10:24:15 -0400 Subject: [vtkusers] Is -DVTK_RENDERING_BACKEND=OpenGL needed for Haswell with 7.0.0? In-Reply-To: References: Message-ID: Yes, the 7.0 default is opengl2. - Ken On Sun, Jun 26, 2016 at 5:45 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > 2016-06-26 11:42 GMT+02:00 Elvis Stansvik : > >> 2016-06-26 11:05 GMT+02:00 Elvis Stansvik : >> >>> 2016-06-26 11:01 GMT+02:00 Elvis Stansvik >>> : >>> >>>> 2016-05-25 17:08 GMT+02:00 Elvis Stansvik >>> >: >>>> >>>>> 2016-05-25 13:49 GMT+02:00 Ken Martin : >>>>> >>>>>> Yes, you should be fine with VTK 7.0, OpenGL2 and Haswell. - Ken >>>>>> >>>>> >>>> Hm, initially it seemed like things were working fine. I was using the >>>> GPU based volume mapper without problems (using a modified >>>> QVTKRenderWindowInteractor), and I _think_ I was using the OpenGL2 backend >>>> (how can I tell btw?). >>>> >>>> But now, as I started trying to make a QOpenGLWidget-based Qt<->VTK >>>> adapter class instead, I get the following when trying to initialize the >>>> render window: >>>> >>>> ERROR: In >>>> /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, >>>> line 545 >>>> vtkGenericOpenGLRenderWindow (0x205fb10): GL version 2.1 with the >>>> gpu_shader4 extension is not supported by your graphics driver but is >>>> required for the new OpenGL rendering backend. Please update your OpenGL >>>> driver. If you are using Mesa please make sure you have version 10.6.5 or >>>> later and make sure your driver in Mesa supports OpenGL 3.2. >>>> >>>> And sure enough: >>>> >>>> estan at newton:~$ glxinfo | grep "OpenGL version" >>>> OpenGL version string: 3.0 Mesa 11.2.0 >>>> >>>> However: >>>> >>>> estan at newton:~$ glxinfo | grep "OpenGL core profile version" >>>> OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 >>>> >>>> I'm a little unsure about which of these version numbers I should be >>>> looking at to see if my graphics has what it takes. >>>> >>>> Also, I'm now even unsure if I was ever using the OpenGL2 backend.. >>>> perhaps VTK was falling back to OpenGL1 somehow, and that's why it worked >>>> in the beginning? Or is the selection of backend always a compile time >>>> thing? >>>> >>>> I build my VTK 7.0.0 in a Personal Package Archive at: >>>> >>>> https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 >>>> >>>> and the full build log is at: >>>> >>>> >>>> https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz >>>> >>> >>> Okay, so looking at that build log, I see: >>> >>> -- Setting rendering backend to 'OpenGL2' as none was specified. >>> -- Backend OpenGL modules: vtkRenderingContextOpenGL;vtkRenderingOpenGL;vtkRenderingLIC;vtkRenderingVolumeOpenGL;vtkRenderingGL2PS >>> -- Backend OpenGL2 modules: vtkRenderingContextOpenGL2;vtkRenderingVolumeOpenGL2;vtkRenderingOpenGL2;vtkRenderingLICOpenGL2;vtkDomainsChemistryOpenGL2 >>> -- Enabling modules for OpenGL2. >>> >>> >>> Does this mean I'll always be using the OpenGL2 backend, or that OpenGL >>> vs OpenGL2 is a runtime choice? >>> >> >> I've now done some testing here at home, on my old Sandybridge laptop >> which I think only has a HD 3000 graphics chip: >> >> [estan at pyret ~]$ glxinfo | grep "OpenGL version" >> OpenGL version string: 3.0 Mesa 11.2.2 >> >> and the "Extended renderer info" section says: >> >> Extended renderer info (GLX_MESA_query_renderer): >> Vendor: Intel Open Source Technology Center (0x8086) >> Device: Mesa DRI Intel(R) Sandybridge Mobile (0x126) >> Version: 11.2.2 >> Accelerated: yes >> Video memory: 1536MB >> Unified memory: yes >> Preferred profile: core (0x1) >> Max core profile version: 3.3 >> Max compat profile version: 3.0 >> Max GLES1 profile version: 1.1 >> Max GLES[23] profile version: 3.0 >> >> And it turns out that all I had to do in my little QOpenGLWidget-adapter >> was: >> >> surfaceFormat.setMajorVersion(3) >> surfaceFormat.setMinorVersion(2) >> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >> self.setFormat(surfaceFormat) >> >> to request OpenGL 3.2 compatibility profile. After this I no longer get >> the error and rendering seems to work. >> >> I'm actually a little surprised this works, since I didn't think my old >> home laptop would support the OpenGL2 backend. And the glxinfo output shows >> "Max compat profile version: 3.0". But printing the >> .format().majorVersion() and .format().minorVersion() after setting it on >> the QOpenGLWidget confirms that I've gotten the 3.2 format set. >> >> Oh well, I'm happy now, but would still like some clarification from >> someone who knows more than me about these things. >> > > For full disclosure, on this older home laptop I run Arch Linux and not > Kubuntu 16.04 like at work. The VTK I build using a custom Arch Linux > package which does > > for lib in EXPAT FREETYPE JPEG PNG TIFF ZLIB LIBXML2 OGGTHEORA TWISTED > ZOPE SIX AUTOBAHN MPI4PY JSONCPP GLEW GL2PS; do > cmake_system_flags+="-DVTK_USE_SYSTEM_${lib}:BOOL=ON " > done > > ... > > cmake \ > -Wno-dev \ > -DCMAKE_SKIP_RPATH=ON \ > -DBUILD_SHARED_LIBS:BOOL=ON \ > -DCMAKE_INSTALL_PREFIX:FILEPATH=/usr \ > -DBUILD_DOCUMENTATION:BOOL=ON \ > -DDOCUMENTATION_HTML_HELP:BOOL=ON \ > -DDOCUMENTATION_HTML_TARZ:BOOL=ON \ > -DBUILD_EXAMPLES:BOOL=ON \ > -DVTK_USE_FFMPEG_ENCODER:BOOL=ON \ > -DVTK_BUILD_ALL_MODULES:BOOL=ON \ > -DVTK_USE_LARGE_DATA:BOOL=ON \ > -DVTK_QT_VERSION:STRING="5" \ > -DVTK_WRAP_JAVA:BOOL=ON \ > -DVTK_WRAP_PYTHON:BOOL=ON \ > -DVTK_WRAP_TCL:BOOL=ON \ > -DCMAKE_CXX_FLAGS="-D__STDC_CONSTANT_MACROS" \ > -DVTK_CUSTOM_LIBRARY_SUFFIX="" \ > -DVTK_INSTALL_INCLUDE_DIR:PATH=include/vtk \ > -DVTK_INSTALL_TCL_DIR=/usr/lib/tcl${_tkver}/vtk/ \ > -DVTK_PYTHON_VERSION=3 \ > -DPYTHON_EXECUTABLE=/usr/bin/python3 \ > -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m \ > -DPYTHON_LIBRARY=/usr/lib/libpython3.5m.so \ > -DVTK_USE_SYSTEM_HDF5=OFF \ > ${cmake_system_flags} \ > -DCMAKE_BUILD_TYPE=Release \ > "${srcdir}/VTK-$pkgver" \ > -GNinja > > ninja > > to build VTK. I don't have the build log for it, but I would think the > above would give me the OpenGL2 backend (?), since I didn't specify > anything special in the cmake command. > > Elvis > > >> Elvis >> >> >> >>> Elvis >>> >>> >>>> >>>> Any advice is much appreciated! >>>> >>>> I'm considering switching to the old OpenGL1 backend anyway, since I >>>> realized my laptop at home only has a Sandybridge chipset (at work it's >>>> Haswell), and it's convenient to be able to do some work from my home >>>> laptop. But I'd like to know why I get the above error on my work laptop, >>>> since I thought it'd be compatible. >>>> >>>> Elvis >>>> >>>> >>>>> Great, thanks! >>>>> >>>>> Elvis >>>>> >>>>> >>>>>> >>>>>> On Wed, May 25, 2016 at 4:50 AM, Elvis Stansvik < >>>>>> elvis.stansvik at orexplore.com> wrote: >>>>>> >>>>>>> Hi all, >>>>>>> >>>>>>> I'm about to try a compile of VTK 7.0.0 release on Ubuntu 16.04 >>>>>>> (Xenial). >>>>>>> >>>>>>> The machine where I need this to run has a Haswell Intel graphics >>>>>>> chip (Intel(R) HD Graphics 4400), which supports the OpenGL 3.3 profile. >>>>>>> Will the new OpenGL backend (the version in 7.0.0) support this graphics >>>>>>> card, or will I need to use the old backend with >>>>>>> -DVTK_RENDERING_BACKEND=OpenGL? >>>>>>> >>>>>>> I read that support for is for Ivy Bridge and later in 7.0.0, so I >>>>>>> think I should be OK right? >>>>>>> >>>>>>> Thanks in advance, >>>>>>> Elvis >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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 >>>>>>> >>>>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>>>>> >>>>>>> Follow this link to subscribe/unsubscribe: >>>>>>> http://public.kitware.com/mailman/listinfo/vtkusers >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Ken Martin PhD >>>>>> Chairman & CFO >>>>>> Kitware Inc. >>>>>> 28 Corporate Drive >>>>>> Clifton Park NY 12065 >>>>>> 518 371 3971 >>>>>> >>>>>> This communication, including all attachments, contains confidential >>>>>> and legally privileged information, and it is intended only for the use of >>>>>> the addressee. Access to this email by anyone else is unauthorized. If you >>>>>> are not the intended recipient, any disclosure, copying, distribution or >>>>>> any action taken in reliance on it is prohibited and may be unlawful. If >>>>>> you received this communication in error please notify us immediately and >>>>>> destroy the original message. Thank you. >>>>>> >>>>> >>>>> >>>> >>> >> > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.grabietz at img-online.de Tue Jun 28 10:27:20 2016 From: michael.grabietz at img-online.de (Michael Grabietz) Date: Tue, 28 Jun 2016 16:27:20 +0200 Subject: [vtkusers] Kaspersky 2016 reports a virus in the windows installer for version 7.0.0 In-Reply-To: References: <9b97d15a-626b-5e87-382f-9aecb3f68ca7@img-online.de> Message-ID: <956a6208-6181-c1dc-b62a-ea26b38f0431@img-online.de> Hi David, thanks for your reply. Current status of the installer listed on virustotal. https://legacy.virustotal.com/en/file/6b090fb40050e45feb5bfaca1c29056a89e25497828d00a785548b579b716a36/analysis/ Best Regards, Michael Am 28.06.2016 um 16:02 schrieb David E DeMarle: > Michael, > > We've had false positives like this before so I assume and hope this is > another case of that happening. We'll investigate and report back when > we know more. > > thanks, > > > David E DeMarle > Kitware, Inc. > R&D Engineer > 21 Corporate Drive > Clifton Park, NY 12065-8662 > Phone: 518-881-4909 > > On Tue, Jun 28, 2016 at 9:39 AM, Michael Grabietz > > > wrote: > > Hello, > > I just downloaded the vtk7-Installer for Windows. I want to install vtk > under Windows 10. Kaspersky Internet Security 2016 is running on the PC. > > I used the following installer: > > http://www.vtk.org/files/release/7.0/vtkpython-7.0.0-Windows-64bit.exe > > Kaspersky 2016 is up to date. > > > When I start the installer Kaspersky reports an issue with the file. A > virus was detected. Name or type of the virus is reported as > 'UDS:DangerousObject.Multi.Generic'. > > When VTK 7.0.0 is installed Kaspersky reports every *.pyd file in the > directory C:\Program Files\VTK 7.0.0\bin\Lib\site-packages\vtk as > infected by 'UDS:DangerousObject.Multi.Generic' too. 85 files were > quarantined. > > vtkChartsCorePython.pyd Date: 2016-01-28 21:00 > vtkCommonColorPython.pyd Date: 2016-01-28 20:55 > vtkCommonComputationalGeometryPython.pyd > ... > vtkViewsInfovisPython.pyd > > > I checked these files on various computers running different virus > scanners like F-Secure and even Kaspersky 2015 (not 2016!) with up to > date data bases. They don't complain. > > Further I checked vtkChartsCorePython.pyd on the Kaspersky Site. There > is a possibility to upload files for checking. It is reported as > infected. Maybe somebody can give it a try and uploads one of these pyd > files to the Kaspersky site to verify this behaviour. > > I hope it is a false positive. Do you had already some similar issues > like that? I am rather confused, since I cannot find any suitable > information in the web about this issue. > > > Best regards, Michael > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Michael Grabietz IMG - Ingenieurbuero Michael Grabietz Stauferring 56 97941 Tauberbischofsheim Germany Fon: +49 9341 89 66 70 Fax: +49 9341 89 66 71 michael.grabietz at img-online.de www.img-online.de From remi.charrier at gmail.com Tue Jun 28 10:28:11 2016 From: remi.charrier at gmail.com (Remi Charrier) Date: Tue, 28 Jun 2016 16:28:11 +0200 Subject: [vtkusers] Projected shadow rendering in a vtkRenderWindow In-Reply-To: References: Message-ID: Thanks for the information, As you probably guessed I was not looking in the proper folder for the OpenGL2 backend that I configured. I managed to get something, almost working (I have strange shadows in addition to the normal shadow) by changing this example. As I would like to understand what is wrong, I then started to try to get the TestShadowMapPass.cxx working as it is. I have 2 problems: - #include "vtkRegressionTestImage.h" "Cannot open include file: 'vtkRegressionTestImage.h' " I believe I did not include or generate the vtk module that contains it (but I do not manage to know which one it could be). It seems it is not useful for the core of this feature, but I would like to get everything working before going further... - the code is mentioning a 3D object: dragon.ply . On my computer I only have the dragon.ply.md5 . What should I do? Use another software to transform the .md5 into a .ply, or something else? Finally, as you mentioned, this shadow rendering seems to not be compatible with the stereo technique implemented in the vtkRenderWindow or at least no directly... Thanks! R?mi 2016-06-27 21:43 GMT+02:00 Ken Martin : > For both the old and new OpenGL backends there are tests built into VTK > using shadows. See > > VTK/Rendering/OpenGL2/Testing/Cxx/TestShadowMapPass.cxx or if building the > old backend > VTK/Rendering/OpenGL/Testing/Cxx/TestShadowMapPass.cxx. I have do not > know if those will work in conjunction with the stereo technique you are > using but those examples should give you some ideas. > > Thanks > Ken > > > > On Mon, Jun 27, 2016 at 3:22 AM, Remi Charrier > wrote: > >> Dear vtk users community, >> >> I started 3 weeks ago a new project with vtk, I just register to this >> mailing list to get answers to some of my questions. Let me know if I am >> doing anything wrong in the use of this mailing list. >> >> My development environment is : >> - Visual Studio 2013 >> - vtk7.0 >> - qt5.7 >> My computer has a NVidia TITAN X graphic card. >> >> Here is my problem: >> - I managed to create a vtkRenderWindow that allows me to display >> different 3D meshes >> - I am using Stereo Rendering (Anaglyph mode) >> - I would like to project the shadows of my different elements on the >> others elements. >> >> To do so I tried many different things, but did not manage to find >> anything that seems to work. >> Here are what I tried: >> - vtkEDLshading - I got it running but it does not do what I expected and >> no projected shadows appear >> - vtkShadowMapBakerPass (as described in >> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Shadows) but I >> have compilation errors on vtkShadowMapBakerPass::OCCLUDER(), it seems >> this class has change or I missed something: "error C2039: 'OCCLUDER' : >> is not a member of 'vtkShadowMapBakerPass'" >> - Then I tried to only use basic functions associated to the renderer or >> the actors: m_Renderer->UseShadowsOn(); m_cylTipActor->GetProperty()->ShadingOn(); >> But once again no visible result... >> >> If someone can tell me where the correct information to display projected >> shadows with VTK 7.0 can be found, I can then investigate and come back to >> you with my code if I am still having problems. >> >> Thanks in advance, >> R?mi (glad to come back to vtk after an 8 years break) >> >> >> >> Garanti >> sans virus. www.avast.com >> >> <#m_2849201775683376845_m_8386774261481987078_DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and > legally privileged information, and it is intended only for the use of the > addressee. Access to this email by anyone else is unauthorized. If you are > not the intended recipient, any disclosure, copying, distribution or any > action taken in reliance on it is prohibited and may be unlawful. If you > received this communication in error please notify us immediately and > destroy the original message. Thank you. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Tue Jun 28 10:41:43 2016 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 28 Jun 2016 10:41:43 -0400 Subject: [vtkusers] Projected shadow rendering in a vtkRenderWindow In-Reply-To: References: Message-ID: Replace the dragon with whatever you want to render or download it and change the code to point to where you put it. http://www.cc.gatech.edu/projects/large_models/dragon.html You can remove the RegressionTest code, it is just there to support our regression tests. On Tue, Jun 28, 2016 at 10:28 AM, Remi Charrier wrote: > Thanks for the information, > > As you probably guessed I was not looking in the proper folder for the > OpenGL2 backend that I configured. > > I managed to get something, almost working (I have strange shadows in > addition to the normal shadow) by changing this example. As I would like to > understand what is wrong, I then started to try to get the > TestShadowMapPass.cxx working as it is. > > I have 2 problems: > - #include "vtkRegressionTestImage.h" > "Cannot open include file: 'vtkRegressionTestImage.h' " > I believe I did not include or generate the vtk module that contains it > (but I do not manage to know which one it could be). It seems it is not > useful for the core of this feature, but I would like to get everything > working before going further... > > - the code is mentioning a 3D object: dragon.ply . On my computer I only > have the dragon.ply.md5 . What should I do? Use another software to > transform the .md5 into a .ply, or something else? > > Finally, as you mentioned, this shadow rendering seems to not be > compatible with the stereo technique implemented in the vtkRenderWindow or > at least no directly... > > Thanks! > R?mi > > > > > > > > 2016-06-27 21:43 GMT+02:00 Ken Martin : > >> For both the old and new OpenGL backends there are tests built into VTK >> using shadows. See >> >> VTK/Rendering/OpenGL2/Testing/Cxx/TestShadowMapPass.cxx or if building >> the old backend >> VTK/Rendering/OpenGL/Testing/Cxx/TestShadowMapPass.cxx. I have do not >> know if those will work in conjunction with the stereo technique you are >> using but those examples should give you some ideas. >> >> Thanks >> Ken >> >> >> >> On Mon, Jun 27, 2016 at 3:22 AM, Remi Charrier >> wrote: >> >>> Dear vtk users community, >>> >>> I started 3 weeks ago a new project with vtk, I just register to this >>> mailing list to get answers to some of my questions. Let me know if I am >>> doing anything wrong in the use of this mailing list. >>> >>> My development environment is : >>> - Visual Studio 2013 >>> - vtk7.0 >>> - qt5.7 >>> My computer has a NVidia TITAN X graphic card. >>> >>> Here is my problem: >>> - I managed to create a vtkRenderWindow that allows me to display >>> different 3D meshes >>> - I am using Stereo Rendering (Anaglyph mode) >>> - I would like to project the shadows of my different elements on the >>> others elements. >>> >>> To do so I tried many different things, but did not manage to find >>> anything that seems to work. >>> Here are what I tried: >>> - vtkEDLshading - I got it running but it does not do what I expected >>> and no projected shadows appear >>> - vtkShadowMapBakerPass (as described in >>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Shadows) but I >>> have compilation errors on vtkShadowMapBakerPass::OCCLUDER(), it seems >>> this class has change or I missed something: "error C2039: 'OCCLUDER' : >>> is not a member of 'vtkShadowMapBakerPass'" >>> - Then I tried to only use basic functions associated to the renderer or >>> the actors: m_Renderer->UseShadowsOn(); m_cylTipActor->GetProperty()->ShadingOn(); >>> But once again no visible result... >>> >>> If someone can tell me where the correct information to display >>> projected shadows with VTK 7.0 can be found, I can then investigate and >>> come back to you with my code if I am still having problems. >>> >>> Thanks in advance, >>> R?mi (glad to come back to vtk after an 8 years break) >>> >>> >>> >>> Garanti >>> sans virus. www.avast.com >>> >>> <#m_-3067287779711849497_m_2849201775683376845_m_8386774261481987078_DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>> >>> _______________________________________________ >>> 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 >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/vtkusers >>> >>> >> >> >> -- >> Ken Martin PhD >> Chairman & CFO >> Kitware Inc. >> 28 Corporate Drive >> Clifton Park NY 12065 >> 518 371 3971 >> >> This communication, including all attachments, contains confidential and >> legally privileged information, and it is intended only for the use of the >> addressee. Access to this email by anyone else is unauthorized. If you are >> not the intended recipient, any disclosure, copying, distribution or any >> action taken in reliance on it is prohibited and may be unlawful. If you >> received this communication in error please notify us immediately and >> destroy the original message. Thank you. >> > > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi.charrier at gmail.com Tue Jun 28 10:53:52 2016 From: remi.charrier at gmail.com (Remi Charrier) Date: Tue, 28 Jun 2016 16:53:52 +0200 Subject: [vtkusers] Projected shadow rendering in a vtkRenderWindow In-Reply-To: References: Message-ID: Thanks, the test with the dragon works well. I will investigate more in details my code and the reasons why I have strange shadows before coming back with other questions. Thanks for the support! 2016-06-28 16:41 GMT+02:00 Ken Martin : > Replace the dragon with whatever you want to render or download it and > change the code to point to where you put it. > > http://www.cc.gatech.edu/projects/large_models/dragon.html > > You can remove the RegressionTest code, it is just there to support our > regression tests. > > > > On Tue, Jun 28, 2016 at 10:28 AM, Remi Charrier > wrote: > >> Thanks for the information, >> >> As you probably guessed I was not looking in the proper folder for the >> OpenGL2 backend that I configured. >> >> I managed to get something, almost working (I have strange shadows in >> addition to the normal shadow) by changing this example. As I would like to >> understand what is wrong, I then started to try to get the >> TestShadowMapPass.cxx working as it is. >> >> I have 2 problems: >> - #include "vtkRegressionTestImage.h" >> "Cannot open include file: 'vtkRegressionTestImage.h' " >> I believe I did not include or generate the vtk module that contains it >> (but I do not manage to know which one it could be). It seems it is not >> useful for the core of this feature, but I would like to get everything >> working before going further... >> >> - the code is mentioning a 3D object: dragon.ply . On my computer I only >> have the dragon.ply.md5 . What should I do? Use another software to >> transform the .md5 into a .ply, or something else? >> >> Finally, as you mentioned, this shadow rendering seems to not be >> compatible with the stereo technique implemented in the vtkRenderWindow or >> at least no directly... >> >> Thanks! >> R?mi >> >> >> >> >> >> >> >> 2016-06-27 21:43 GMT+02:00 Ken Martin : >> >>> For both the old and new OpenGL backends there are tests built into VTK >>> using shadows. See >>> >>> VTK/Rendering/OpenGL2/Testing/Cxx/TestShadowMapPass.cxx or if building >>> the old backend >>> VTK/Rendering/OpenGL/Testing/Cxx/TestShadowMapPass.cxx. I have do not >>> know if those will work in conjunction with the stereo technique you are >>> using but those examples should give you some ideas. >>> >>> Thanks >>> Ken >>> >>> >>> >>> On Mon, Jun 27, 2016 at 3:22 AM, Remi Charrier >>> wrote: >>> >>>> Dear vtk users community, >>>> >>>> I started 3 weeks ago a new project with vtk, I just register to this >>>> mailing list to get answers to some of my questions. Let me know if I am >>>> doing anything wrong in the use of this mailing list. >>>> >>>> My development environment is : >>>> - Visual Studio 2013 >>>> - vtk7.0 >>>> - qt5.7 >>>> My computer has a NVidia TITAN X graphic card. >>>> >>>> Here is my problem: >>>> - I managed to create a vtkRenderWindow that allows me to display >>>> different 3D meshes >>>> - I am using Stereo Rendering (Anaglyph mode) >>>> - I would like to project the shadows of my different elements on the >>>> others elements. >>>> >>>> To do so I tried many different things, but did not manage to find >>>> anything that seems to work. >>>> Here are what I tried: >>>> - vtkEDLshading - I got it running but it does not do what I expected >>>> and no projected shadows appear >>>> - vtkShadowMapBakerPass (as described in >>>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Shadows) but I >>>> have compilation errors on vtkShadowMapBakerPass::OCCLUDER(), it seems >>>> this class has change or I missed something: "error C2039: 'OCCLUDER' >>>> : is not a member of 'vtkShadowMapBakerPass'" >>>> - Then I tried to only use basic functions associated to the renderer >>>> or the actors: m_Renderer->UseShadowsOn(); >>>> m_cylTipActor->GetProperty()->ShadingOn(); But once again no visible >>>> result... >>>> >>>> If someone can tell me where the correct information to display >>>> projected shadows with VTK 7.0 can be found, I can then investigate and >>>> come back to you with my code if I am still having problems. >>>> >>>> Thanks in advance, >>>> R?mi (glad to come back to vtk after an 8 years break) >>>> >>>> >>>> >>>> Garanti >>>> sans virus. www.avast.com >>>> >>>> <#m_-2091360125698783353_m_-3067287779711849497_m_2849201775683376845_m_8386774261481987078_DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>>> >>>> _______________________________________________ >>>> 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 >>>> >>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>> >>>> Follow this link to subscribe/unsubscribe: >>>> http://public.kitware.com/mailman/listinfo/vtkusers >>>> >>>> >>> >>> >>> -- >>> Ken Martin PhD >>> Chairman & CFO >>> Kitware Inc. >>> 28 Corporate Drive >>> Clifton Park NY 12065 >>> 518 371 3971 >>> >>> This communication, including all attachments, contains confidential and >>> legally privileged information, and it is intended only for the use of the >>> addressee. Access to this email by anyone else is unauthorized. If you are >>> not the intended recipient, any disclosure, copying, distribution or any >>> action taken in reliance on it is prohibited and may be unlawful. If you >>> received this communication in error please notify us immediately and >>> destroy the original message. Thank you. >>> >> >> > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and > legally privileged information, and it is intended only for the use of the > addressee. Access to this email by anyone else is unauthorized. If you are > not the intended recipient, any disclosure, copying, distribution or any > action taken in reliance on it is prohibited and may be unlawful. If you > received this communication in error please notify us immediately and > destroy the original message. Thank you. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 28 12:11:25 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 28 Jun 2016 18:11:25 +0200 Subject: [vtkusers] Is -DVTK_RENDERING_BACKEND=OpenGL needed for Haswell with 7.0.0? In-Reply-To: References: Message-ID: Den 28 juni 2016 4:24 em skrev "Ken Martin" : > > Yes, the 7.0 default is opengl2. - Ken Alright, thanks for the info Ken. I've since ran into some problems with segfaults inside VTK when trying to do volume rendering into my QOpenGLWidget-based VTK widget (as well as that from another author), both on my home Sandybridge laptop and Haswell laptop at work. So for now I've given up on using QOpenGLWidget and will stay with QGLWidget, despite the inability to turn on multisampling, but if anyone has time to look at my recent thread about this ("Segfault in vtkOpenGLRenderWindow.OpenGLInitState and advice about render window in/out events"), it would be much appreciated. Elvis > > On Sun, Jun 26, 2016 at 5:45 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: >> >> 2016-06-26 11:42 GMT+02:00 Elvis Stansvik : >>> >>> 2016-06-26 11:05 GMT+02:00 Elvis Stansvik : >>>> >>>> 2016-06-26 11:01 GMT+02:00 Elvis Stansvik : >>>>> >>>>> 2016-05-25 17:08 GMT+02:00 Elvis Stansvik < elvis.stansvik at orexplore.com>: >>>>>> >>>>>> 2016-05-25 13:49 GMT+02:00 Ken Martin : >>>>>>> >>>>>>> Yes, you should be fine with VTK 7.0, OpenGL2 and Haswell. - Ken >>>>> >>>>> >>>>> Hm, initially it seemed like things were working fine. I was using the GPU based volume mapper without problems (using a modified QVTKRenderWindowInteractor), and I _think_ I was using the OpenGL2 backend (how can I tell btw?). >>>>> >>>>> But now, as I started trying to make a QOpenGLWidget-based Qt<->VTK adapter class instead, I get the following when trying to initialize the render window: >>>>> >>>>> ERROR: In /home/estan/Blandat/vtk-python3/src/VTK-7.0.0/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 545 >>>>> vtkGenericOpenGLRenderWindow (0x205fb10): GL version 2.1 with the gpu_shader4 extension is not supported by your graphics driver but is required for the new OpenGL rendering backend. Please update your OpenGL driver. If you are using Mesa please make sure you have version 10.6.5 or later and make sure your driver in Mesa supports OpenGL 3.2. >>>>> >>>>> And sure enough: >>>>> >>>>> estan at newton:~$ glxinfo | grep "OpenGL version" >>>>> OpenGL version string: 3.0 Mesa 11.2.0 >>>>> >>>>> However: >>>>> >>>>> estan at newton:~$ glxinfo | grep "OpenGL core profile version" >>>>> OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 >>>>> >>>>> I'm a little unsure about which of these version numbers I should be looking at to see if my graphics has what it takes. >>>>> >>>>> Also, I'm now even unsure if I was ever using the OpenGL2 backend.. perhaps VTK was falling back to OpenGL1 somehow, and that's why it worked in the beginning? Or is the selection of backend always a compile time thing? >>>>> >>>>> I build my VTK 7.0.0 in a Personal Package Archive at: >>>>> >>>>> https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 >>>>> >>>>> and the full build log is at: >>>>> >>>>> https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz >>>> >>>> >>>> Okay, so looking at that build log, I see: >>>> >>>> -- Setting rendering backend to 'OpenGL2' as none was specified. >>>> -- Backend OpenGL modules: vtkRenderingContextOpenGL;vtkRenderingOpenGL;vtkRenderingLIC;vtkRenderingVolumeOpenGL;vtkRenderingGL2PS >>>> -- Backend OpenGL2 modules: vtkRenderingContextOpenGL2;vtkRenderingVolumeOpenGL2;vtkRenderingOpenGL2;vtkRenderingLICOpenGL2;vtkDomainsChemistryOpenGL2 >>>> -- Enabling modules for OpenGL2. >>>> >>>> >>>> Does this mean I'll always be using the OpenGL2 backend, or that OpenGL vs OpenGL2 is a runtime choice? >>> >>> >>> I've now done some testing here at home, on my old Sandybridge laptop which I think only has a HD 3000 graphics chip: >>> >>> [estan at pyret ~]$ glxinfo | grep "OpenGL version" >>> OpenGL version string: 3.0 Mesa 11.2.2 >>> >>> and the "Extended renderer info" section says: >>> >>> Extended renderer info (GLX_MESA_query_renderer): >>> Vendor: Intel Open Source Technology Center (0x8086) >>> Device: Mesa DRI Intel(R) Sandybridge Mobile (0x126) >>> Version: 11.2.2 >>> Accelerated: yes >>> Video memory: 1536MB >>> Unified memory: yes >>> Preferred profile: core (0x1) >>> Max core profile version: 3.3 >>> Max compat profile version: 3.0 >>> Max GLES1 profile version: 1.1 >>> Max GLES[23] profile version: 3.0 >>> >>> And it turns out that all I had to do in my little QOpenGLWidget-adapter was: >>> >>> surfaceFormat.setMajorVersion(3) >>> surfaceFormat.setMinorVersion(2) >>> surfaceFormat.setProfile(QSurfaceFormat.CompatibilityProfile) >>> self.setFormat(surfaceFormat) >>> >>> to request OpenGL 3.2 compatibility profile. After this I no longer get the error and rendering seems to work. >>> >>> I'm actually a little surprised this works, since I didn't think my old home laptop would support the OpenGL2 backend. And the glxinfo output shows "Max compat profile version: 3.0". But printing the .format().majorVersion() and .format().minorVersion() after setting it on the QOpenGLWidget confirms that I've gotten the 3.2 format set. >>> >>> Oh well, I'm happy now, but would still like some clarification from someone who knows more than me about these things. >> >> >> For full disclosure, on this older home laptop I run Arch Linux and not Kubuntu 16.04 like at work. The VTK I build using a custom Arch Linux package which does >> >> for lib in EXPAT FREETYPE JPEG PNG TIFF ZLIB LIBXML2 OGGTHEORA TWISTED ZOPE SIX AUTOBAHN MPI4PY JSONCPP GLEW GL2PS; do >> cmake_system_flags+="-DVTK_USE_SYSTEM_${lib}:BOOL=ON " >> done >> >> ... >> >> cmake \ >> -Wno-dev \ >> -DCMAKE_SKIP_RPATH=ON \ >> -DBUILD_SHARED_LIBS:BOOL=ON \ >> -DCMAKE_INSTALL_PREFIX:FILEPATH=/usr \ >> -DBUILD_DOCUMENTATION:BOOL=ON \ >> -DDOCUMENTATION_HTML_HELP:BOOL=ON \ >> -DDOCUMENTATION_HTML_TARZ:BOOL=ON \ >> -DBUILD_EXAMPLES:BOOL=ON \ >> -DVTK_USE_FFMPEG_ENCODER:BOOL=ON \ >> -DVTK_BUILD_ALL_MODULES:BOOL=ON \ >> -DVTK_USE_LARGE_DATA:BOOL=ON \ >> -DVTK_QT_VERSION:STRING="5" \ >> -DVTK_WRAP_JAVA:BOOL=ON \ >> -DVTK_WRAP_PYTHON:BOOL=ON \ >> -DVTK_WRAP_TCL:BOOL=ON \ >> -DCMAKE_CXX_FLAGS="-D__STDC_CONSTANT_MACROS" \ >> -DVTK_CUSTOM_LIBRARY_SUFFIX="" \ >> -DVTK_INSTALL_INCLUDE_DIR:PATH=include/vtk \ >> -DVTK_INSTALL_TCL_DIR=/usr/lib/tcl${_tkver}/vtk/ \ >> -DVTK_PYTHON_VERSION=3 \ >> -DPYTHON_EXECUTABLE=/usr/bin/python3 \ >> -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m \ >> -DPYTHON_LIBRARY=/usr/lib/libpython3.5m.so \ >> -DVTK_USE_SYSTEM_HDF5=OFF \ >> ${cmake_system_flags} \ >> -DCMAKE_BUILD_TYPE=Release \ >> "${srcdir}/VTK-$pkgver" \ >> -GNinja >> >> ninja >> >> to build VTK. I don't have the build log for it, but I would think the above would give me the OpenGL2 backend (?), since I didn't specify anything special in the cmake command. >> >> Elvis >> >>> >>> Elvis >>> >>> >>>> >>>> Elvis >>>> >>>>> >>>>> >>>>> Any advice is much appreciated! >>>>> >>>>> I'm considering switching to the old OpenGL1 backend anyway, since I realized my laptop at home only has a Sandybridge chipset (at work it's Haswell), and it's convenient to be able to do some work from my home laptop. But I'd like to know why I get the above error on my work laptop, since I thought it'd be compatible. >>>>> >>>>> Elvis >>>>> >>>>>> >>>>>> Great, thanks! >>>>>> >>>>>> Elvis >>>>>> >>>>>>> >>>>>>> >>>>>>> On Wed, May 25, 2016 at 4:50 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: >>>>>>>> >>>>>>>> Hi all, >>>>>>>> >>>>>>>> I'm about to try a compile of VTK 7.0.0 release on Ubuntu 16.04 (Xenial). >>>>>>>> >>>>>>>> The machine where I need this to run has a Haswell Intel graphics chip (Intel(R) HD Graphics 4400), which supports the OpenGL 3.3 profile. Will the new OpenGL backend (the version in 7.0.0) support this graphics card, or will I need to use the old backend with -DVTK_RENDERING_BACKEND=OpenGL? >>>>>>>> >>>>>>>> I read that support for is for Ivy Bridge and later in 7.0.0, so I think I should be OK right? >>>>>>>> >>>>>>>> Thanks in advance, >>>>>>>> Elvis >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> 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 >>>>>>>> >>>>>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>>>>>>> >>>>>>>> Follow this link to subscribe/unsubscribe: >>>>>>>> http://public.kitware.com/mailman/listinfo/vtkusers >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Ken Martin PhD >>>>>>> Chairman & CFO >>>>>>> Kitware Inc. >>>>>>> 28 Corporate Drive >>>>>>> Clifton Park NY 12065 >>>>>>> 518 371 3971 >>>>>>> >>>>>>> This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. >>>>>> >>>>>> >>>>> >>>> >>> >> > > > > -- > Ken Martin PhD > Chairman & CFO > Kitware Inc. > 28 Corporate Drive > Clifton Park NY 12065 > 518 371 3971 > > This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From joaolsvieira at gmail.com Tue Jun 28 12:58:39 2016 From: joaolsvieira at gmail.com (=?UTF-8?Q?Jo=C3=A3o_Luis?=) Date: Tue, 28 Jun 2016 12:58:39 -0400 Subject: [vtkusers] vtkTable Filter By Column Message-ID: Hello Guys Is possible to filter vtkTable by column? I have the following data within a vtkTable from a *.CSV file and I want to share this in three distinct tables as L=line table; P=plane table and C=cone table. I had posted here about vtkThresholdTable and the answers still not come. Following is my *CSV, and the referred column is Vector Type. I appreciate any help. FElemID Structural Type Vector Type Depth Easting Northing Elevation SiteID Borehole_Dip Borehole_DipDirection CA Structure_Dip Structure_DipDirection Channel 1 Channel 2 Channel 3 1 Ctt P 0 0 0 2 FSEX-41 -47 137.2 60 75 1 1 1 1 Ctt P 0 0 0 0 FSEX-41 -47 137.2 0 0 1 1 1 2 Ctt L 1 1 1 2 FSEX-42 -46 135.9 0 0 7 1 1 2 Ctt L 1 1 1 1 FSEX-42 -46 135.9 45 0 7 1 1 2 Ctt L 1 1 1 0 FSEX-42 -46 135.9 60 45 7 1 1 3 Ctt C 2 2 0 2 FSEX-47 -45 30 5 1 1 1 3 Ctt C 2 2 0 1 FSEX-47 -45 30 45 1 1 1 3 Ctt C 2 2 0 0 FSEX-47 -45 30 85 1 1 1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From joaolsvieira at gmail.com Tue Jun 28 12:59:37 2016 From: joaolsvieira at gmail.com (=?UTF-8?Q?Jo=C3=A3o_Luis?=) Date: Tue, 28 Jun 2016 12:59:37 -0400 Subject: [vtkusers] vtkThresholdTable - VTK 7.0 Message-ID: Hello guys, Any ideas about how to build a vtkThresholdTable with characters (e.g L,P,C,N) representing MinValue/ MaxValue? I have a python version but in C++ is returning NULL/empty. Following my code and the *.CSV I am trying to filter (simulate 3 distinct tables L=line Table; P=plane Table; C=cone Table) Thank you very much. Python # Set up filters for extracting feature types self.thresholders = {} for threshVals in [('line', 'K', 'M'), ('plane', 'O','Q'), ('cone', 'B', 'D')]: tt = vtkThresholdTable() tt.SetInputConnection(self.rdr.GetOutputPort()) tt.SetInputArrayToProcess(0, 0, 0, vtkDataObject.FIELD_ASSOCIATION_ROWS, 'Vector Type') tt.SetMinValue(vtkVariant(threshVals[1])) tt.SetMaxValue(vtkVariant(threshVals[2])) tt.SetMode(vtkThresholdTable.ACCEPT_BETWEEN) self.thresholders[threshVals[0]] = tt C++ const char* tnames [] = { "line", "plane", "cone" }; char tminmax [] = { 'K', 'M', 'O', 'Q', 'B', 'D' }; unsigned int numThresh = sizeof(tnames) / sizeof(tnames[0]); // == 3 for (unsigned ti = 0; ti < numThresh; ++ti) { thHoldTable = vtkSmartPointer::New(); thHoldTable->SetInputConnection(readerStructureData->GetOutputPort ()); thHoldTable->SetInputArrayToProcess(0, 0, 0, vtkDataObject:: FIELD_ASSOCIATION_ROWS, "Vector Type"); thHoldTable->SetMinValue(vtkVariant(tminmax[2*ti])); thHoldTable->SetMaxValue(vtkVariant(tminmax[2*ti+1])); thHoldTable->SetMode(vtkThresholdTable::ACCEPT_BETWEEN); thHoldTable->Update(); thresholders[tnames[ti]] = thHoldTable; } *.csv FElemID Structural Type Vector Type Depth Easting Northing Elevation SiteID Borehole_Dip Borehole_DipDirection CA Structure_Dip Structure_DipDirection Channel 1 Channel 2 Channel 3 1 Ctt P 0 0 0 2 FSEX-41 -47 137.2 60 75 1 1 1 1 Ctt P 0 0 0 0 FSEX-41 -47 137.2 0 0 1 1 1 2 Ctt L 1 1 1 2 FSEX-42 -46 135.9 0 0 7 1 1 2 Ctt L 1 1 1 1 FSEX-42 -46 135.9 45 0 7 1 1 2 Ctt L 1 1 1 0 FSEX-42 -46 135.9 60 45 7 1 1 3 Ctt C 2 2 0 2 FSEX-47 -45 30 5 1 1 1 3 Ctt C 2 2 0 1 FSEX-47 -45 30 45 1 1 1 3 Ctt C 2 2 0 0 FSEX-47 -45 30 85 1 1 1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 28 14:04:08 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 28 Jun 2016 20:04:08 +0200 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? Message-ID: Hi, I have a volume rendering pipeline set up. In response to user interactions, I can manipulate certain aspects of the pipeline and re-render. I can even set the filename of the reader that I use as a source, to completely change out the volume being rendered. But what if I want to completely disable the pipeline, in effect unsetting the filename of the reader. My pipeline is basically just HDF5Reader -> vtkGPUVolumeRayCastMapper, where HDF5Reader is a custom reader I wrote to read volumes from a HDF5 file. The problem is I can't just setFileName(None) on my reader, because my custom reader has a if self._fileName is None: return 0 in its RequestData and RequestInformation, and I will thus get errors from VTK saying the pipeline failed if I do this. So my question is: What is the proper way of "unhooking" (or "disabling" if you will) a pipeline? I want the render window to simply show empty space when in this state, but still have the entire pipeline intact and ready for when I next want to set the filename of the reader to a valid volume. Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From sankhesh.jhaveri at kitware.com Tue Jun 28 14:42:39 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Tue, 28 Jun 2016 14:42:39 -0400 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: Hi Elvis, You could do any one of the following if it is an invalid filename: 1. Set the visibility of the volume to be 0. 2. Remove the volume from the renderer. Sankhesh On Tue, Jun 28, 2016 at 2:04 PM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > Hi, > > I have a volume rendering pipeline set up. In response to user > interactions, I can manipulate certain aspects of the pipeline and > re-render. I can even set the filename of the reader that I use as a > source, to completely change out the volume being rendered. > > But what if I want to completely disable the pipeline, in effect unsetting > the filename of the reader. > > My pipeline is basically just HDF5Reader -> vtkGPUVolumeRayCastMapper, > where HDF5Reader is a custom reader I wrote to read volumes from a HDF5 > file. > > The problem is I can't just setFileName(None) on my reader, because my > custom reader has a > > if self._fileName is None: > return 0 > > in its RequestData and RequestInformation, and I will thus get errors from > VTK saying the pipeline failed if I do this. > > So my question is: What is the proper way of "unhooking" (or "disabling" > if you will) a pipeline? I want the render window to simply show empty > space when in this state, but still have the entire pipeline intact and > ready for when I next want to set the filename of the reader to a valid > volume. > > Thanks in advance, > Elvis > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue Jun 28 14:54:47 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 28 Jun 2016 20:54:47 +0200 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: 2016-06-28 20:42 GMT+02:00 Sankhesh Jhaveri : > Hi Elvis, > > You could do any one of the following if it is an invalid filename: > > 1. Set the visibility of the volume to be 0. > 2. Remove the volume from the renderer. > > Sankhesh > Thanks Sankhesh, I think I'll remove the volume from the renderer then, but keep it around (and the rest of the pipeline intact) until next time I need it. Elvis > > > > On Tue, Jun 28, 2016 at 2:04 PM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> Hi, >> >> I have a volume rendering pipeline set up. In response to user >> interactions, I can manipulate certain aspects of the pipeline and >> re-render. I can even set the filename of the reader that I use as a >> source, to completely change out the volume being rendered. >> >> But what if I want to completely disable the pipeline, in effect >> unsetting the filename of the reader. >> >> My pipeline is basically just HDF5Reader -> vtkGPUVolumeRayCastMapper, >> where HDF5Reader is a custom reader I wrote to read volumes from a HDF5 >> file. >> >> The problem is I can't just setFileName(None) on my reader, because my >> custom reader has a >> >> if self._fileName is None: >> return 0 >> >> in its RequestData and RequestInformation, and I will thus get errors >> from VTK saying the pipeline failed if I do this. >> >> So my question is: What is the proper way of "unhooking" (or "disabling" >> if you will) a pipeline? I want the render window to simply show empty >> space when in this state, but still have the entire pipeline intact and >> ready for when I next want to set the filename of the reader to a valid >> volume. >> >> Thanks in advance, >> Elvis >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Jun 28 15:01:55 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 28 Jun 2016 13:01:55 -0600 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: On Tue, Jun 28, 2016 at 12:04 PM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > > So my question is: What is the proper way of "unhooking" (or "disabling" > if you will) a pipeline? I want the render window to simply show empty > space when in this state, but still have the entire pipeline intact and > ready for when I next want to set the filename of the reader to a valid > volume. > I've found it convenient to build the pipeline in segments, with shallow copies as necessary to connect the segments. For example, the reader is handled like this (drastically simplified code): void ReadImage(vtkImageData *data, const char *filename) { vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName(filename); reader->Update(); vtkImageData *image = reader->GetOutput(); // shallow copy the data into the supplied data object data->CopyStructure(image); data->GetPointData()->PassData(image->GetPointData()); } My app has a data management structure (i.e. an object) that contains a list of all the images that the app needs. So to read a new file, I create a new vtkImageData object, call the above function to populate it via the reader, and then I connect it to the rest of my pipeline. The reader object is temporary. By doing my code like this, it's easy to support a broad range of readers. Most processing pipelines are done the same way: they exist just long enough to generate an output. Afterwards, the filter objects are deleted and only the output is kept (via a shallow copy done with the CopyStructure()/PassData() calls above). Display pipelines (e.g. pipelines that terminate with a mapper) have a longer life: when I need to display a new data set, I generate the display pipeline as well as its actors, then I connect an input and add the actors to the renderer. When I unload a data set, I also remove the actors. I have a class for each display pipeline that I need, and objects of these class are instantiated and destructed when data is loaded or unloaded. Having as much of your program logic as possible tied to object construction/destruction helps to simplify things. Interactive processing pipelines (as opposed to the run-once pipelines) are temporarily connected to a display pipeline via the usual AddInputConnection() mechanism, but when the interaction is complete the following is done: 1) the connection is broken with e.g. RemoveAllInputConnections(), 2) the output is shallow-copied into a new data object with the CopyStructure()/PassData() calls and the processing pipeline is deleted, and 3) the copy is connected directly to the display pipeline (and generally stored in my data management structure, as well). The general idea is that pipeline segments only exist for as long as they are being used, i.e. they are either limited to the scope of a single function, or limited to the lifetime of a specific object. This helps to reduce the overall resource usage of the application. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From enzo.matsumiya at gmail.com Tue Jun 28 15:02:17 2016 From: enzo.matsumiya at gmail.com (Enzo Matsumiya) Date: Tue, 28 Jun 2016 16:02:17 -0300 Subject: [vtkusers] Custom cursor shapes Message-ID: <91D8CC7A-821C-4A5E-9519-97A8A3611E45@gmail.com> Hello, Is there any way to add custom cursors? I'm already using VTK_CURSOR_CROSSHAIR and VTK_CURSOR_HAND, but now I'm implementing zoom and rotate functionality to my app and I would like to use some shapes that represents those better. Thanks in advance! From elvis.stansvik at orexplore.com Tue Jun 28 16:29:42 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 28 Jun 2016 22:29:42 +0200 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: Hi David, Thanks a lot for the thorough advice/explanation! See my comments inline. 2016-06-28 21:01 GMT+02:00 David Gobbi : > On Tue, Jun 28, 2016 at 12:04 PM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: >> >> >> So my question is: What is the proper way of "unhooking" (or "disabling" >> if you will) a pipeline? I want the render window to simply show empty >> space when in this state, but still have the entire pipeline intact and >> ready for when I next want to set the filename of the reader to a valid >> volume. >> > > I've found it convenient to build the pipeline in segments, with shallow > copies as necessary to connect the segments. > > For example, the reader is handled like this (drastically simplified code): > > void ReadImage(vtkImageData *data, const char *filename) > { > vtkSmartPointer reader = > vtkSmartPointer::New(); > reader->SetFileName(filename); > reader->Update(); > > vtkImageData *image = reader->GetOutput(); > > // shallow copy the data into the supplied data object > data->CopyStructure(image); > data->GetPointData()->PassData(image->GetPointData()); > } > > My app has a data management structure (i.e. an object) that contains a > list of all the images that the app needs. So to read a new file, I create > a new vtkImageData object, call the above function to populate it via the > reader, and then I connect it to the rest of my pipeline. The reader > object is temporary. By doing my code like this, it's easy to support a > broad range of readers. > That's interesting. So if I understand the above correctly, you create a little ad-hoc pipeline for the purpose of reading the file, and then keep only what you need. In my case I'm working from Python, though for various reasons I'm at least entertaining the idea of re-writing what I have in C++. But say I stick to Python, would the shallow copying maneuver above be relevant in Python-land? > > Most processing pipelines are done the same way: they exist just long > enough to generate an output. Afterwards, the filter objects are deleted > and only the output is kept (via a shallow copy done with the > CopyStructure()/PassData() calls above). > I see. In my case I'm not going to have any pure-processing pipelines. Most of what I'll use VTK for is interactive visualization, where I may want to tweak certain aspects of the visualization while it is shown (transfer functions, volume of interest extraction bounds, transforms, ...). So I think I want to keep the entire pipeline alive in most cases (but see my question further down), even if some nodes in the pipeline can be "hidden" in the sense that I don't need to keep around references to them. The nodes I do have to keep references to are of course the ones where I'll need to tweak things. > Display pipelines (e.g. pipelines that terminate with a mapper) have a > longer life: when I need to display a new data set, I generate the display > pipeline as well as its actors, then I connect an input and add the actors > to the renderer. When I unload a data set, I also remove the actors. I > have a class for each display pipeline that I need, and objects of these > class are instantiated and destructed when data is loaded or unloaded. > Having as much of your program logic as possible tied to object > construction/destruction helps to simplify things. > Ah, perhaps it would make sense for me to also break out the pipeline construction/destruction logic out of my widget into a separate class, even if I don't have destructors in the C++ sense. > > Interactive processing pipelines (as opposed to the run-once pipelines) > are temporarily connected to a display pipeline via the usual > AddInputConnection() mechanism, but when the interaction is complete the > following is done: 1) the connection is broken with e.g. > RemoveAllInputConnections(), 2) the output is shallow-copied into a new > data object with the CopyStructure()/PassData() calls and the processing > pipeline is deleted, and 3) the copy is connected directly to the display > pipeline (and generally stored in my data management structure, as well). > Hm, now I think I understand what you mean. So you have a general "processing" segment of the pipeline, and a visualization pipeline that follows, and you keep the processing part of it alive only for as long as you need it. I then just have one question I think: What if you later need to "hook up" the processing segment again? Do you discard the shallow copy you made, create a new processing pipeline segment and hook it up to the visualization segment? > The general idea is that pipeline segments only exist for as long as they > are being used, i.e. they are either limited to the scope of a single > function, or limited to the lifetime of a specific object. This helps to > reduce the overall resource usage of the application. > I like this design, and it makes sense. I'll have to think about it some more. A little about my use case: It's a tool for looking at tomographic images of drilled rock cores, along with some spectral analysis results (plots). The user will be able to see a scale showing drilled depth (~1000 m), with some segments indicating where there are samples available. Clicking such a segment (~1 m) will bring up the volume corresponding to that sample in a VTK view. If the user wishes to go even closer, he/she should be able to select a smaller (~10 cm) segment in the ~1 m view, which will bring that segment up in a third (larger) view which has free zooming/rotation. And another thing is that the user must be able to adjust the color/opacity transfer functions used in the volume rendering. Not everything is ironed out yet, but that's the gist of it, as far as VTK is involved. Again, thanks a lot for your input, you've been very helpful. Elvis > - David > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From patriciop at gmail.com Tue Jun 28 17:37:52 2016 From: patriciop at gmail.com (Patricio Palma C.) Date: Tue, 28 Jun 2016 17:37:52 -0400 Subject: [vtkusers] Issues when using Mesa 11.2.2 Message-ID: Hello Expert I'm testing VTK 7.1(git) with OpenGL2 using Mesa 11.2.2 and it fails at when rendering the structure. The first error I got is: ERROR: In vtkShaderProgram.cxx, line 370 vtkShaderProgram (0xa385610): Error: GL_EXT_gpu_shader4: required extension is not supported. Error: failed to preprocess the source. This was solved by defining MESA_GL_VERSION_OVERRIDE = 3.2 After that VTK request GLSL at least 1.50 then variable MESA_GL_VERSION_OVERRIDE is defined as 150 After that I got the following message: Program received signal SIGSEGV, Segmentation fault. 0x00002aaaaf55181b in vtkShaderProgram::FindUniform(char const*) () at Rendering/OpenGL2/vtkShaderProgram.cxx:772 772 if (name == NULL || !this->Linked) ?Do you have any idea on how I could solve this crash? Regards? -- Patricio Palma Contreras -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.martin at kitware.com Tue Jun 28 17:51:01 2016 From: ken.martin at kitware.com (Ken Martin) Date: Tue, 28 Jun 2016 17:51:01 -0400 Subject: [vtkusers] Issues when using Mesa 11.2.2 In-Reply-To: References: Message-ID: Setting MESA_GL_VERSION_OVERRIDE = 3.2 means your graphics library does not support OpenGL 3.2 normally. If you are using Mesa 11.2.2 I suspect that means you are not using the llvmpipe driver (which does support 3.2) but some other driver. glxinfo can help narrow that down to see what driver is being used. Thanks Ken On Tue, Jun 28, 2016 at 5:37 PM, Patricio Palma C. wrote: > Hello Expert > > I'm testing VTK 7.1(git) with OpenGL2 using Mesa 11.2.2 and it fails at > when rendering the structure. > > The first error I got is: > > ERROR: In vtkShaderProgram.cxx, line 370 > vtkShaderProgram (0xa385610): Error: GL_EXT_gpu_shader4: required > extension is not supported. > Error: failed to preprocess the source. > > This was solved by defining MESA_GL_VERSION_OVERRIDE = 3.2 > > After that VTK request GLSL at least 1.50 then variable > MESA_GL_VERSION_OVERRIDE is defined as 150 > > After that I got the following message: > > Program received signal SIGSEGV, Segmentation fault. > 0x00002aaaaf55181b in vtkShaderProgram::FindUniform(char const*) () at > Rendering/OpenGL2/vtkShaderProgram.cxx:772 > 772 if (name == NULL || !this->Linked) > > ?Do you have any idea on how I could solve this crash? > > Regards? > -- > Patricio Palma Contreras > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Ken Martin PhD Chairman & CFO Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Tue Jun 28 17:53:14 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Tue, 28 Jun 2016 15:53:14 -0600 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: On Tue, Jun 28, 2016 at 2:29 PM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > > That's interesting. So if I understand the above correctly, you create a > little ad-hoc pipeline for the purpose of reading the file, and then keep > only what you need. > Yes, exactly. The ad-hoc pipeline is sometimes more than just a reader, it might also massage the image by changing the orientation or the data type. > In my case I'm working from Python, though for various reasons I'm at > least entertaining the idea of re-writing what I have in C++. But say I > stick to Python, would the shallow copying maneuver above be relevant in > Python-land? > It'll work exactly the same in Python as C++. > I see. In my case I'm not going to have any pure-processing pipelines. > Most of what I'll use VTK for is interactive visualization, where I may > want to tweak certain aspects of the visualization while it is shown > (transfer functions, volume of interest extraction bounds, transforms, > ...). So I think I want to keep the entire pipeline alive in most cases > (but see my question further down), even if some nodes in the pipeline can > be "hidden" in the sense that I don't need to keep around references to > them. The nodes I do have to keep references to are of course the ones > where I'll need to tweak things. > This sort of interactive display pipeline is what VTK was made for. > Ah, perhaps it would make sense for me to also break out the pipeline > construction/destruction logic out of my widget into a separate class, even > if I don't have destructors in the C++ sense. > Since the "clean-up" that you want to do is mainly just deleting all the object you don't need anymore, it should be fine if all your VTK filter objects are members of your break-out class. You have to rely on the Python & VTK reference counting to take care of the destruction. The fact that C++ provides so many options for how to do memory management is a nice feature (or maybe the lack of unified memory management is a non-feature?) Interactive processing pipelines (as opposed to the run-once pipelines) are >> temporarily connected to a display pipeline via the usual >> AddInputConnection() mechanism, but when the interaction is complete the >> following is done: 1) the connection is broken with e.g. >> RemoveAllInputConnections(), 2) the output is shallow-copied into a new >> data object with the CopyStructure()/PassData() calls and the processing >> pipeline is deleted, and 3) the copy is connected directly to the display >> pipeline (and generally stored in my data management structure, as well). >> > > Hm, now I think I understand what you mean. So you have a general > "processing" segment of the pipeline, and a visualization pipeline that > follows, and you keep the processing part of it alive only for as long as > you need it. > > I then just have one question I think: What if you later need to "hook up" > the processing segment again? Do you discard the shallow copy you made, > create a new processing pipeline segment and hook it up to the > visualization segment? > Yes, the pipeline segment is re-created. Its input is set (via SetInputData) to the vtkImageData object that came from the reader (or to some other vtkImageData object) and then this pipeline segment is connected to the display pipeline. The previous input to the display pipeline can be thrown away or placed on an undo stack. The general idea is that pipeline segments only exist for as long as they >> are being used, i.e. they are either limited to the scope of a single >> function, or limited to the lifetime of a specific object. This helps to >> reduce the overall resource usage of the application. >> > > I like this design, and it makes sense. I'll have to think about it some > more. > > A little about my use case: It's a tool for looking at tomographic images > of drilled rock cores, along with some spectral analysis results (plots). > The user will be able to see a scale showing drilled depth (~1000 m), with > some segments indicating where there are samples available. Clicking such a > segment (~1 m) will bring up the volume corresponding to that sample in a > VTK view. If the user wishes to go even closer, he/she should be able to > select a smaller (~10 cm) segment in the ~1 m view, which will bring that > segment up in a third (larger) view which has free zooming/rotation. And > another thing is that the user must be able to adjust the color/opacity > transfer functions used in the volume rendering. Not everything is ironed > out yet, but that's the gist of it, as far as VTK is involved. > Sounds interesting. The "selection" part will be fun ;) > Again, thanks a lot for your input, you've been very helpful. > You're making me jealous, because lately I've been dedicating most of my time to writing command-line image processing scripts with bash (not fun!). But next month I'll be getting back into app development. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhoppes at mbfbioscience.com Wed Jun 29 08:10:30 2016 From: dhoppes at mbfbioscience.com (Doug Hoppes) Date: Wed, 29 Jun 2016 12:10:30 +0000 Subject: [vtkusers] Viewport clipping Message-ID: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> Hey all, Running into a critical issue and not sure where to turn. We've been using vtkViewport for a while and never seem to have an issue with them. However, just updated the software and moved to OpenGL2 and now running into an issue. Some of the viewports seem to be clipped. I can move my objects without a problem in them but, in one case, vtkImageActor, the display is clipped. Is there a particular place I can look at in the code to see what is happening? The vtkViewport code seems to have the correct port size. Where is the display rendering done? I've noticed that, if I use a sphere actor or any general surface actor, there doesn't seem to be a problem. It only happens when I'm rendering a volume or an image actor. Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 29 08:24:42 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 29 Jun 2016 06:24:42 -0600 Subject: [vtkusers] Viewport clipping In-Reply-To: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> Message-ID: On Wed, Jun 29, 2016 at 6:10 AM, Doug Hoppes wrote: > Hey all, > > > > Running into a critical issue and not sure where to turn. > We?ve been using vtkViewport for a while and never seem to have an issue > with them. However, just updated the software and moved to OpenGL2 and now > running into an issue. Some of the viewports seem to be clipped. I can > move my objects without a problem in them but, in one case, vtkImageActor, > the display is clipped. > > > > Is there a particular place I can look at in the code to > see what is happening? The vtkViewport code seems to have the correct port > size. Where is the display rendering done? I?ve noticed that, if I use a > sphere actor or any general surface actor, there doesn?t seem to be a > problem. It only happens when I?m rendering a volume or an image actor. > Hmm... I haven't seen anything like this. By "clipped", do you mean that the actor/volume is limited to a rectangle that is smaller than the viewport? Is this rectangle always in the upper left corner of the viewport, or is it somewhere else? When you say "rendering a volume", do you mean rendered with a vtkVolume? If so, what volume mapper was used? What version of VTK? For OpenGL2 the vtkImageActor rendering is done by Rendering/OpenGL2/vtkOpenGLImageSliceMapper.cxx, which in turn uses vtkTexture and vtkPolyDataMapper. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.demarle at kitware.com Wed Jun 29 09:50:31 2016 From: dave.demarle at kitware.com (David E DeMarle) Date: Wed, 29 Jun 2016 09:50:31 -0400 Subject: [vtkusers] Kaspersky 2016 reports a virus in the windows installer for version 7.0.0 In-Reply-To: <956a6208-6181-c1dc-b62a-ea26b38f0431@img-online.de> References: <9b97d15a-626b-5e87-382f-9aecb3f68ca7@img-online.de> <956a6208-6181-c1dc-b62a-ea26b38f0431@img-online.de> Message-ID: I think it is a false positive. Although kaspersky's online checker complained about the pyd files with the mysterious UDS.DangerousObject.Multi.Generic problem, a local check with a fully updated Kaspersky anti-virus 2016 trial version did not. Our build machines are virus checker protected in any case so it is unlikely to be a real threat. I think it is more likely that Kaspersky is being over protective as VTK isn't all that common in the scale of things. We will continue to try and work it out with Kaspersky in any case. David E DeMarle Kitware, Inc. R&D Engineer 21 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-881-4909 On Tue, Jun 28, 2016 at 10:27 AM, Michael Grabietz < michael.grabietz at img-online.de> wrote: > Hi David, > > thanks for your reply. > > Current status of the installer listed on virustotal. > > > https://legacy.virustotal.com/en/file/6b090fb40050e45feb5bfaca1c29056a89e25497828d00a785548b579b716a36/analysis/ > > Best Regards, Michael > > > > Am 28.06.2016 um 16:02 schrieb David E DeMarle: > > Michael, > > > > We've had false positives like this before so I assume and hope this is > > another case of that happening. We'll investigate and report back when > > we know more. > > > > thanks, > > > > > > David E DeMarle > > Kitware, Inc. > > R&D Engineer > > 21 Corporate Drive > > Clifton Park, NY 12065-8662 > > Phone: 518-881-4909 > > > > On Tue, Jun 28, 2016 at 9:39 AM, Michael Grabietz > > > > > wrote: > > > > Hello, > > > > I just downloaded the vtk7-Installer for Windows. I want to install > vtk > > under Windows 10. Kaspersky Internet Security 2016 is running on the > PC. > > > > I used the following installer: > > > > > http://www.vtk.org/files/release/7.0/vtkpython-7.0.0-Windows-64bit.exe > > > > Kaspersky 2016 is up to date. > > > > > > When I start the installer Kaspersky reports an issue with the file. > A > > virus was detected. Name or type of the virus is reported as > > 'UDS:DangerousObject.Multi.Generic'. > > > > When VTK 7.0.0 is installed Kaspersky reports every *.pyd file in the > > directory C:\Program Files\VTK 7.0.0\bin\Lib\site-packages\vtk as > > infected by 'UDS:DangerousObject.Multi.Generic' too. 85 files were > > quarantined. > > > > vtkChartsCorePython.pyd Date: 2016-01-28 21:00 > > vtkCommonColorPython.pyd Date: 2016-01-28 20:55 > > vtkCommonComputationalGeometryPython.pyd > > ... > > vtkViewsInfovisPython.pyd > > > > > > I checked these files on various computers running different virus > > scanners like F-Secure and even Kaspersky 2015 (not 2016!) with up to > > date data bases. They don't complain. > > > > Further I checked vtkChartsCorePython.pyd on the Kaspersky Site. > There > > is a possibility to upload files for checking. It is reported as > > infected. Maybe somebody can give it a try and uploads one of these > pyd > > files to the Kaspersky site to verify this behaviour. > > > > I hope it is a false positive. Do you had already some similar issues > > like that? I am rather confused, since I cannot find any suitable > > information in the web about this issue. > > > > > > Best regards, Michael > > > > _______________________________________________ > > 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 > > > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > > > Follow this link to subscribe/unsubscribe: > > http://public.kitware.com/mailman/listinfo/vtkusers > > > > > > -- > Michael Grabietz > > IMG - Ingenieurbuero Michael Grabietz > Stauferring 56 > 97941 Tauberbischofsheim > Germany > > Fon: +49 9341 89 66 70 > Fax: +49 9341 89 66 71 > > michael.grabietz at img-online.de > www.img-online.de > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 10:22:43 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 16:22:43 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? Message-ID: Hi, I'm building a custom Ubuntu package of VTK-7.0.0 at this PPA: https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 the full build log is at: https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz I only recently discovered that the vtkGUISupportQtOpenGL module was not included. Anyone know how I can deduce from the build log why it wasn't built? The only relevant message I could find in the CMake output is: -- Group Qt modules: vtkRenderingQt;vtkGUISupportQtSQL;vtkGUISupportQt;vtkViewsQt But I can't find anything stating the reason for vtkGUISupportQtOpenGL not being built. The build slave has libqt5opengl5 and libqt5opengl5-dev installed (search for "Setting up libqt5opengl5" in the build log linked above). Do I have to specify something more than -DVTK_Group_Qt=ON and -DVTK_QT_VERSION=5 to get this module? Thanks in advance, Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From chinander at gmail.com Wed Jun 29 10:27:47 2016 From: chinander at gmail.com (Mike Chinander) Date: Wed, 29 Jun 2016 09:27:47 -0500 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: Was vtkGUISupportQtOpenGL2 built instead? What is your VTK_RENDERING_BACKEND set to? OpenGL2 is the default for 7.0. On Wed, Jun 29, 2016 at 9:22 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > Hi, > > I'm building a custom Ubuntu package of VTK-7.0.0 at this PPA: > > https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 > > the full build log is at: > > > https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz > > I only recently discovered that the vtkGUISupportQtOpenGL module was not > included. > > Anyone know how I can deduce from the build log why it wasn't built? > > The only relevant message I could find in the CMake output is: > > -- Group Qt modules: > vtkRenderingQt;vtkGUISupportQtSQL;vtkGUISupportQt;vtkViewsQt > > But I can't find anything stating the reason for vtkGUISupportQtOpenGL not > being built. > > The build slave has libqt5opengl5 and libqt5opengl5-dev installed (search > for "Setting up libqt5opengl5" in the build log linked above). > > Do I have to specify something more than -DVTK_Group_Qt=ON and > -DVTK_QT_VERSION=5 to get this module? > > Thanks in advance, > Elvis > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 10:33:57 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 16:33:57 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: 2016-06-29 16:27 GMT+02:00 Mike Chinander : > Was vtkGUISupportQtOpenGL2 built instead? What is your > VTK_RENDERING_BACKEND set to? OpenGL2 is the default for 7.0. > vtkGUISupportQtOpenGL2 was not built either AFAICS (I don't think there is such a module). I don't set VTK_RENDERING_BACKEND explicitly, so it's defaulting to OpenGL2: -- Setting rendering backend to 'OpenGL2' as none was specified. But I think the name of the QtOpenGL modules is the same, regardless of the rendering backend used. I now found that the vtkGUISupportQtOpenGL is defined (in GUISupport/QtOpenGL/module.cmake) with: if(VTK_RENDERING_BACKEND STREQUAL "OpenGL") set(_groups GROUPS Qt) endif() vtk_module(vtkGUISupportQtOpenGL ${_groups} DEPENDS vtkGUISupportQt vtkRendering${VTK_RENDERING_BACKEND} TEST_DEPENDS vtkTestingCore vtkTestingRendering vtkFiltersSources EXCLUDE_FROM_WRAPPING ) Does this mean the module will only be part of the Qt group if the OpenGL backend is used? Not when using the OpenGL2 backend? If so, how do I activate it when using OpenGL2? Elvis > On Wed, Jun 29, 2016 at 9:22 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> Hi, >> >> I'm building a custom Ubuntu package of VTK-7.0.0 at this PPA: >> >> https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 >> >> the full build log is at: >> >> >> https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz >> >> I only recently discovered that the vtkGUISupportQtOpenGL module was not >> included. >> >> Anyone know how I can deduce from the build log why it wasn't built? >> >> The only relevant message I could find in the CMake output is: >> >> -- Group Qt modules: >> vtkRenderingQt;vtkGUISupportQtSQL;vtkGUISupportQt;vtkViewsQt >> >> But I can't find anything stating the reason for vtkGUISupportQtOpenGL >> not being built. >> >> The build slave has libqt5opengl5 and libqt5opengl5-dev installed (search >> for "Setting up libqt5opengl5" in the build log linked above). >> >> Do I have to specify something more than -DVTK_Group_Qt=ON and >> -DVTK_QT_VERSION=5 to get this module? >> >> Thanks in advance, >> Elvis >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sankhesh.jhaveri at kitware.com Wed Jun 29 10:37:49 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Wed, 29 Jun 2016 10:37:49 -0400 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: Hi Elvis, vtkGUISupportQtOpenGL module hasn't been ported to the OpenGL2 backend yet. See: https://github.com/Kitware/VTK/commit/e58ca401466f9af4c542c085f7b599b6bde939c8 ?For now, it just works with the OpenGL backend.? ?Sankhesh? On Wed, Jun 29, 2016 at 10:22 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > Hi, > > I'm building a custom Ubuntu package of VTK-7.0.0 at this PPA: > > https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 > > the full build log is at: > > > https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz > > I only recently discovered that the vtkGUISupportQtOpenGL module was not > included. > > Anyone know how I can deduce from the build log why it wasn't built? > > The only relevant message I could find in the CMake output is: > > -- Group Qt modules: > vtkRenderingQt;vtkGUISupportQtSQL;vtkGUISupportQt;vtkViewsQt > > But I can't find anything stating the reason for vtkGUISupportQtOpenGL not > being built. > > The build slave has libqt5opengl5 and libqt5opengl5-dev installed (search > for "Setting up libqt5opengl5" in the build log linked above). > > Do I have to specify something more than -DVTK_Group_Qt=ON and > -DVTK_QT_VERSION=5 to get this module? > > Thanks in advance, > Elvis > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhoppes at mbfbioscience.com Wed Jun 29 10:39:51 2016 From: dhoppes at mbfbioscience.com (Doug Hoppes) Date: Wed, 29 Jun 2016 14:39:51 +0000 Subject: [vtkusers] Viewport clipping In-Reply-To: References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> Message-ID: <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> Sorry about that?. Here?s more information? In VTK Version 6.2.0 using the OpenGL flag, this is what we see in all 4 viewports, we see that the vtkimageactor looks fine. [cid:image003.png at 01D1D1F1.8D2F5CF0] However, we just moved to VTK Version 7.0.0 using the OpenGL2 flag. This is what we now see: [cid:image004.png at 01D1D1F2.8FB66080] Notice the clipping. The upper two viewports show nothing, the bottom viewport is correct and the rightmost viewport is clipped in the center of the viewport. If we resize the overall vtk window, the viewport is still clipped in the center. It seems that there is no display to the right-side of the viewport. In the main right viewport, we can actually move the objects around without a problem but the results are still clipped. We have seen this issue with really large vtkvolumes but it doesn?t happen all of the time. Using the vtkimageactor, this happens consistently. This problem does not present itself with any generic vtkactors. I?ll also check the vtkImageSliceMapper code to see if I can get any information from it. Doug From: David Gobbi [mailto:david.gobbi at gmail.com] Sent: Wednesday, June 29, 2016 9:03 AM To: Doug Hoppes Subject: Re: [vtkusers] Viewport clipping Hi Doug, Please keep the discussion on the list. It's possible that the near/far clipping planes are too tight. When you reset the focal point, you can try calling SetClippingRange(near, far) at the same time. Also, I hate to be redundant, but what version of VTK are you using? Do you see this only with vtkImageActor, or also with vtkVolume? It helps me help you if you answer these questions... - David On Wed, Jun 29, 2016 at 6:45 AM, Doug Hoppes > wrote: Hey David! Thanks for responding. Here?s what we are seeing: I can move the image in the 3D area without any problem?. It?s just that the image is clipped. We have seen it happen with a couple of large images and I noticed that it happens when I try to reset the camera focal point. From: David Gobbi [mailto:david.gobbi at gmail.com] Sent: Wednesday, June 29, 2016 8:25 AM To: Doug Hoppes Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Viewport clipping On Wed, Jun 29, 2016 at 6:10 AM, Doug Hoppes > wrote: Hey all, Running into a critical issue and not sure where to turn. We?ve been using vtkViewport for a while and never seem to have an issue with them. However, just updated the software and moved to OpenGL2 and now running into an issue. Some of the viewports seem to be clipped. I can move my objects without a problem in them but, in one case, vtkImageActor, the display is clipped. Is there a particular place I can look at in the code to see what is happening? The vtkViewport code seems to have the correct port size. Where is the display rendering done? I?ve noticed that, if I use a sphere actor or any general surface actor, there doesn?t seem to be a problem. It only happens when I?m rendering a volume or an image actor. Hmm... I haven't seen anything like this. By "clipped", do you mean that the actor/volume is limited to a rectangle that is smaller than the viewport? Is this rectangle always in the upper left corner of the viewport, or is it somewhere else? When you say "rendering a volume", do you mean rendered with a vtkVolume? If so, what volume mapper was used? What version of VTK? For OpenGL2 the vtkImageActor rendering is done by Rendering/OpenGL2/vtkOpenGLImageSliceMapper.cxx, which in turn uses vtkTexture and vtkPolyDataMapper. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.emz Type: application/octet-stream Size: 34768 bytes Desc: image002.emz URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.png Type: image/png Size: 28972 bytes Desc: image003.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: oledata.mso Type: application/octet-stream Size: 30817 bytes Desc: oledata.mso URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.emz Type: application/octet-stream Size: 20866 bytes Desc: image001.emz URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.png Type: image/png Size: 15944 bytes Desc: image004.png URL: From elvis.stansvik at orexplore.com Wed Jun 29 10:43:03 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 16:43:03 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: 2016-06-29 16:37 GMT+02:00 Sankhesh Jhaveri : > Hi Elvis, > > vtkGUISupportQtOpenGL module hasn't been ported to the OpenGL2 backend yet. > > See: > https://github.com/Kitware/VTK/commit/e58ca401466f9af4c542c085f7b599b6bde939c8 > > ?For now, it just works with the OpenGL backend.? > Aha. That explains it. Thanks. Are there any big downsides to using the OpenGL backend? What are the main benefits of the OpenGL2 backend? Elvis > > ?Sankhesh? > > > On Wed, Jun 29, 2016 at 10:22 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> Hi, >> >> I'm building a custom Ubuntu package of VTK-7.0.0 at this PPA: >> >> https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 >> >> the full build log is at: >> >> >> https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz >> >> I only recently discovered that the vtkGUISupportQtOpenGL module was not >> included. >> >> Anyone know how I can deduce from the build log why it wasn't built? >> >> The only relevant message I could find in the CMake output is: >> >> -- Group Qt modules: >> vtkRenderingQt;vtkGUISupportQtSQL;vtkGUISupportQt;vtkViewsQt >> >> But I can't find anything stating the reason for vtkGUISupportQtOpenGL >> not being built. >> >> The build slave has libqt5opengl5 and libqt5opengl5-dev installed (search >> for "Setting up libqt5opengl5" in the build log linked above). >> >> Do I have to specify something more than -DVTK_Group_Qt=ON and >> -DVTK_QT_VERSION=5 to get this module? >> >> Thanks in advance, >> Elvis >> >> _______________________________________________ >> 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 >> >> Search the list archives at: http://markmail.org/search/?q=vtkusers >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/vtkusers >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bill.lorensen at gmail.com Wed Jun 29 10:50:21 2016 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Wed, 29 Jun 2016 10:50:21 -0400 Subject: [vtkusers] Viewport clipping In-Reply-To: <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> Message-ID: Can you post the code? On Wed, Jun 29, 2016 at 10:39 AM, Doug Hoppes wrote: > Sorry about that?. Here?s more information? > > > > In VTK Version 6.2.0 using the OpenGL flag, this is what we see in all 4 > viewports, we see that the vtkimageactor looks fine. > > > > > > However, we just moved to VTK Version 7.0.0 using the OpenGL2 flag. This > is what we now see: > > > > > > Notice the clipping. The upper two viewports show nothing, the bottom > viewport is correct and the rightmost viewport is clipped in the center of > the viewport. If we resize the overall vtk window, the viewport is still > clipped in the center. It seems that there is no display to the right-side > of the viewport. In the main right viewport, we can actually move the > objects around without a problem but the results are still clipped. > > > > We have seen this issue with really large vtkvolumes but it doesn?t happen > all of the time. Using the vtkimageactor, this happens consistently. This > problem does not present itself with any generic vtkactors. > > > > I?ll also check the vtkImageSliceMapper code to see if I can get any > information from it. > > > > Doug > > > > *From:* David Gobbi [mailto:david.gobbi at gmail.com] > *Sent:* Wednesday, June 29, 2016 9:03 AM > *To:* Doug Hoppes > *Subject:* Re: [vtkusers] Viewport clipping > > > > Hi Doug, > > > > Please keep the discussion on the list. It's possible that the near/far > clipping planes are too tight. When you reset the focal point, you can try > calling SetClippingRange(near, far) at the same time. > > > > Also, I hate to be redundant, but what version of VTK are you using? Do > you see this only with vtkImageActor, or also with vtkVolume? It helps me > help you if you answer these questions... > > > > - David > > > > > > On Wed, Jun 29, 2016 at 6:45 AM, Doug Hoppes > wrote: > > Hey David! > > > > Thanks for responding. Here?s what we are seeing: > > > > > > I can move the image in the 3D area without any problem?. It?s just that > the image is clipped. We have seen it happen with a couple of large images > and I noticed that it happens when I try to reset the camera focal point. > > > > *From:* David Gobbi [mailto:david.gobbi at gmail.com] > *Sent:* Wednesday, June 29, 2016 8:25 AM > *To:* Doug Hoppes > *Cc:* vtkusers at vtk.org > *Subject:* Re: [vtkusers] Viewport clipping > > > > On Wed, Jun 29, 2016 at 6:10 AM, Doug Hoppes > wrote: > > Hey all, > > > > Running into a critical issue and not sure where to turn. > We?ve been using vtkViewport for a while and never seem to have an issue > with them. However, just updated the software and moved to OpenGL2 and now > running into an issue. Some of the viewports seem to be clipped. I can > move my objects without a problem in them but, in one case, vtkImageActor, > the display is clipped. > > > > Is there a particular place I can look at in the code to > see what is happening? The vtkViewport code seems to have the correct port > size. Where is the display rendering done? I?ve noticed that, if I use a > sphere actor or any general surface actor, there doesn?t seem to be a > problem. It only happens when I?m rendering a volume or an image actor. > > > > Hmm... I haven't seen anything like this. By "clipped", do you mean that > the actor/volume is limited to a rectangle that is smaller than the > viewport? Is this rectangle always in the upper left corner of the > viewport, or is it somewhere else? When you say "rendering a volume", do > you mean rendered with a vtkVolume? If so, what volume mapper was used? > What version of VTK? > > > > For OpenGL2 the vtkImageActor rendering is done > by Rendering/OpenGL2/vtkOpenGLImageSliceMapper.cxx, which in turn uses > vtkTexture and vtkPolyDataMapper. > > > > - David > > > > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > > -- Unpaid intern in BillsBasement at noware dot com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.png Type: image/png Size: 28972 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.png Type: image/png Size: 15944 bytes Desc: not available URL: From sankhesh.jhaveri at kitware.com Wed Jun 29 11:00:13 2016 From: sankhesh.jhaveri at kitware.com (Sankhesh Jhaveri) Date: Wed, 29 Jun 2016 11:00:13 -0400 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: The biggest downside to using the OpenGL backend is that limited support on newer architectures as it uses the OpenGL 1.1 fixed function pipeline (deprecated since over a decade now). Some blog posts that provide more info on the OpenGL2 backend: https://blog.kitware.com/new-opengl-rendering-in-vtk/ https://blog.kitware.com/rendering-engine-improvements-in-vtk/ https://blog.kitware.com/volume-rendering-improvements-in-vtk/ Having said that, do you have a specific use case for the vtkGUISupportQtOpenGL module? For most applications, I find myself just compiling the vtkGUISupportQt module and using QVTKWidget and QVTKInteractor. Sankhesh On Wed, Jun 29, 2016 at 10:43 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > 2016-06-29 16:37 GMT+02:00 Sankhesh Jhaveri > : > >> Hi Elvis, >> >> vtkGUISupportQtOpenGL module hasn't been ported to the OpenGL2 backend >> yet. >> >> See: >> https://github.com/Kitware/VTK/commit/e58ca401466f9af4c542c085f7b599b6bde939c8 >> >> ?For now, it just works with the OpenGL backend.? >> > > Aha. That explains it. Thanks. > > Are there any big downsides to using the OpenGL backend? What are the main > benefits of the OpenGL2 backend? > > Elvis > > >> >> ?Sankhesh? >> >> >> On Wed, Jun 29, 2016 at 10:22 AM, Elvis Stansvik < >> elvis.stansvik at orexplore.com> wrote: >> >>> Hi, >>> >>> I'm building a custom Ubuntu package of VTK-7.0.0 at this PPA: >>> >>> https://launchpad.net/~elvstone/+archive/ubuntu/vtk7 >>> >>> the full build log is at: >>> >>> >>> https://launchpadlibrarian.net/261625779/buildlog_ubuntu-xenial-amd64.vtk7_7.0.0-0ubuntu2_BUILDING.txt.gz >>> >>> I only recently discovered that the vtkGUISupportQtOpenGL module was not >>> included. >>> >>> Anyone know how I can deduce from the build log why it wasn't built? >>> >>> The only relevant message I could find in the CMake output is: >>> >>> -- Group Qt modules: >>> vtkRenderingQt;vtkGUISupportQtSQL;vtkGUISupportQt;vtkViewsQt >>> >>> But I can't find anything stating the reason for vtkGUISupportQtOpenGL >>> not being built. >>> >>> The build slave has libqt5opengl5 and libqt5opengl5-dev installed >>> (search for "Setting up libqt5opengl5" in the build log linked above). >>> >>> Do I have to specify something more than -DVTK_Group_Qt=ON and >>> -DVTK_QT_VERSION=5 to get this module? >>> >>> Thanks in advance, >>> Elvis >>> >>> _______________________________________________ >>> 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 >>> >>> Search the list archives at: http://markmail.org/search/?q=vtkusers >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/vtkusers >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhoppes at mbfbioscience.com Wed Jun 29 11:02:55 2016 From: dhoppes at mbfbioscience.com (Doug Hoppes) Date: Wed, 29 Jun 2016 15:02:55 +0000 Subject: [vtkusers] Viewport clipping In-Reply-To: References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> Message-ID: <46CB11F12B9DC24D860D4082451B318A36B80DA8@exchange3.microbrightfield.com> Sure? it?s a bit convoluted since it?s part of a larger program but I can give you some of the essentials: Building the viewports (I have my own ViewPort class that is a wrapper around the vtkViewport code): 1) In my situation, I have create 4 viewports using: void Viewport::CreateViewPort() { // A Viewport is composed of the renderer, camera, light, and interactor. m_pRenderer = new SceneRenderer(m_pSceneManager->GetRenderWindow()); m_pCamera = new VTKCameras(m_pRenderer, m_pSceneManager); m_pLight = new VTKLights(m_pRenderer); // Create the scene item list. This list is really only a list of the // items in the current viewport. The main list is stored with the scene // manager. m_pSceneItems = new VTKSceneItemList(m_pSceneManager, false); } 2) I then set the position of the viewport in the VTK scene m_iCurrentViewport = 0; m_arViews[0]->SetPosition(0.0, 0.667, 0.333, 1.0); m_iCurrentViewport = 1; m_arViews[1]->SetPosition(0.0, 0.334, 0.333, 0.665); m_iCurrentViewport = 2; m_arViews[2]->SetPosition(0.0, 0.0, 0.333, 0.332); m_iCurrentViewport = 3; m_arViews[3]->SetPosition(0.335, 0, 1.0, 1.0); where SetPosition is a function in my Viewport class: void Viewport::SetPosition(double dMinX, double dMinY, double dMaxX, double dMaxY) { // Tell the renderer where the viewport is located m_pRenderer->SetViewportPosition(dMinX, dMinY, dMaxX, dMaxY); } Once the viewport is created, I call vtkSmartPointer pHelpActor = m_pSceneItems->SetUserHelpItem(pImageData); AddActor(pHelpActor); RefreshScene(true, true, true); Where RefreshScene resets the cameras and the camera clipping ranges for all of the viewports: m_arViews[i]->GetRenderer()->ResetCamera(); m_arViews[i]->GetRenderer()->ResetCameraClippingRange(); m_pRenderWindow->GetInteractor()->Render(); Doug From: Bill Lorensen [mailto:bill.lorensen at gmail.com] Sent: Wednesday, June 29, 2016 10:50 AM To: Doug Hoppes Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Viewport clipping Can you post the code? On Wed, Jun 29, 2016 at 10:39 AM, Doug Hoppes > wrote: Sorry about that?. Here?s more information? In VTK Version 6.2.0 using the OpenGL flag, this is what we see in all 4 viewports, we see that the vtkimageactor looks fine. [cid:image001.png at 01D1D1F4.EC2CF610] However, we just moved to VTK Version 7.0.0 using the OpenGL2 flag. This is what we now see: [cid:image002.png at 01D1D1F4.EC2CF610] Notice the clipping. The upper two viewports show nothing, the bottom viewport is correct and the rightmost viewport is clipped in the center of the viewport. If we resize the overall vtk window, the viewport is still clipped in the center. It seems that there is no display to the right-side of the viewport. In the main right viewport, we can actually move the objects around without a problem but the results are still clipped. We have seen this issue with really large vtkvolumes but it doesn?t happen all of the time. Using the vtkimageactor, this happens consistently. This problem does not present itself with any generic vtkactors. I?ll also check the vtkImageSliceMapper code to see if I can get any information from it. Doug From: David Gobbi [mailto:david.gobbi at gmail.com] Sent: Wednesday, June 29, 2016 9:03 AM To: Doug Hoppes Subject: Re: [vtkusers] Viewport clipping Hi Doug, Please keep the discussion on the list. It's possible that the near/far clipping planes are too tight. When you reset the focal point, you can try calling SetClippingRange(near, far) at the same time. Also, I hate to be redundant, but what version of VTK are you using? Do you see this only with vtkImageActor, or also with vtkVolume? It helps me help you if you answer these questions... - David On Wed, Jun 29, 2016 at 6:45 AM, Doug Hoppes > wrote: Hey David! Thanks for responding. Here?s what we are seeing: I can move the image in the 3D area without any problem?. It?s just that the image is clipped. We have seen it happen with a couple of large images and I noticed that it happens when I try to reset the camera focal point. From: David Gobbi [mailto:david.gobbi at gmail.com] Sent: Wednesday, June 29, 2016 8:25 AM To: Doug Hoppes Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Viewport clipping On Wed, Jun 29, 2016 at 6:10 AM, Doug Hoppes > wrote: Hey all, Running into a critical issue and not sure where to turn. We?ve been using vtkViewport for a while and never seem to have an issue with them. However, just updated the software and moved to OpenGL2 and now running into an issue. Some of the viewports seem to be clipped. I can move my objects without a problem in them but, in one case, vtkImageActor, the display is clipped. Is there a particular place I can look at in the code to see what is happening? The vtkViewport code seems to have the correct port size. Where is the display rendering done? I?ve noticed that, if I use a sphere actor or any general surface actor, there doesn?t seem to be a problem. It only happens when I?m rendering a volume or an image actor. Hmm... I haven't seen anything like this. By "clipped", do you mean that the actor/volume is limited to a rectangle that is smaller than the viewport? Is this rectangle always in the upper left corner of the viewport, or is it somewhere else? When you say "rendering a volume", do you mean rendered with a vtkVolume? If so, what volume mapper was used? What version of VTK? For OpenGL2 the vtkImageActor rendering is done by Rendering/OpenGL2/vtkOpenGLImageSliceMapper.cxx, which in turn uses vtkTexture and vtkPolyDataMapper. - David _______________________________________________ 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 Search the list archives at: http://markmail.org/search/?q=vtkusers Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/vtkusers -- Unpaid intern in BillsBasement at noware dot com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 28972 bytes Desc: image001.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 15944 bytes Desc: image002.png URL: From david.gobbi at gmail.com Wed Jun 29 11:14:42 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 29 Jun 2016 09:14:42 -0600 Subject: [vtkusers] Viewport clipping In-Reply-To: <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> Message-ID: For troubleshooting problems like this, use test images that don't have a black background. That way we can see where the boundaries of the images are. It looks like the images are simply being rendered in the wrong position. So the question is whether this is due to the fact that multiple viewports are being used (i.e. due to a bug in the display coords or view coords), or if this is due to a shift in the world coords. Either way, this is strange because the OpenGL2 vtkImageSliceMapper simply uses a vtkPolyDataMapper under the hood. There were many changes between VTK 6.2 and VTK 7.0... any chance that you can try this with the OpenGL backend in VTK 7.0 (instead of OpenGL2)? Also, here is a very important question: do you create a separate vtkImageActor for each of your viewports? Actors should not, in general, be shared between viewports. - David On Wed, Jun 29, 2016 at 8:39 AM, Doug Hoppes wrote: > > > > Notice the clipping. The upper two viewports show nothing, the bottom > viewport is correct and the rightmost viewport is clipped in the center of > the viewport. If we resize the overall vtk window, the viewport is still > clipped in the center. It seems that there is no display to the right-side > of the viewport. In the main right viewport, we can actually move the > objects around without a problem but the results are still clipped. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcus.hanwell at kitware.com Wed Jun 29 11:17:09 2016 From: marcus.hanwell at kitware.com (Marcus D. Hanwell) Date: Wed, 29 Jun 2016 11:17:09 -0400 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: On Wed, Jun 29, 2016 at 10:43 AM, Elvis Stansvik wrote: > 2016-06-29 16:37 GMT+02:00 Sankhesh Jhaveri : >> >> vtkGUISupportQtOpenGL module hasn't been ported to the OpenGL2 backend >> yet. >> >> See: >> https://github.com/Kitware/VTK/commit/e58ca401466f9af4c542c085f7b599b6bde939c8 >> >> For now, it just works with the OpenGL backend. > > Aha. That explains it. Thanks. > > Are there any big downsides to using the OpenGL backend? What are the main > benefits of the OpenGL2 backend? > I would echo Sankhesh's comments - are there any applications using the classes in vtkGUISupportQtOpenGL? There are not many I am aware of, and the classes in that module use a deprecated Qt class. The vast majority make use of QVTKWidget in vtkGUISupportQt Things changed quite a bit in Qt, and I think if you are packaging/using this in general builds skipping vtkGUISupportQtOpenGL is normally the correct thing to do unless you have a compelling user of the classes in there. If you do it would be great to learn what is using it in the wild. We will hopefully have a replacement for OpenGL2 soon, but it should likely derive from the newer QOpenGL* classes, and as such may not precisely match the previous API. Marcus From dhoppes at mbfbioscience.com Wed Jun 29 11:25:18 2016 From: dhoppes at mbfbioscience.com (Doug Hoppes) Date: Wed, 29 Jun 2016 15:25:18 +0000 Subject: [vtkusers] Viewport clipping In-Reply-To: References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> Message-ID: <46CB11F12B9DC24D860D4082451B318A36B80E0D@exchange3.microbrightfield.com> Okay? I?ll see how hard it is to move our code back to OpenGL with the latest version and see if the problem persists. Here?s the image with a different background. As you can see, the vtkimageactor looks like it?s the correct size. [cid:image002.png at 01D1D1F8.6BC12650] If I use the mouse to drag the image over to the right (using the interactorstyle Pan()), I see: [cid:image004.png at 01D1D1F8.6BC12650] Doug From: David Gobbi [mailto:david.gobbi at gmail.com] Sent: Wednesday, June 29, 2016 11:15 AM To: Doug Hoppes Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Viewport clipping For troubleshooting problems like this, use test images that don't have a black background. That way we can see where the boundaries of the images are. It looks like the images are simply being rendered in the wrong position. So the question is whether this is due to the fact that multiple viewports are being used (i.e. due to a bug in the display coords or view coords), or if this is due to a shift in the world coords. Either way, this is strange because the OpenGL2 vtkImageSliceMapper simply uses a vtkPolyDataMapper under the hood. There were many changes between VTK 6.2 and VTK 7.0... any chance that you can try this with the OpenGL backend in VTK 7.0 (instead of OpenGL2)? Also, here is a very important question: do you create a separate vtkImageActor for each of your viewports? Actors should not, in general, be shared between viewports. - David On Wed, Jun 29, 2016 at 8:39 AM, Doug Hoppes > wrote: Notice the clipping. The upper two viewports show nothing, the bottom viewport is correct and the rightmost viewport is clipped in the center of the viewport. If we resize the overall vtk window, the viewport is still clipped in the center. It seems that there is no display to the right-side of the viewport. In the main right viewport, we can actually move the objects around without a problem but the results are still clipped. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.emz Type: application/octet-stream Size: 28761 bytes Desc: image001.emz URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 26181 bytes Desc: image002.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image003.emz Type: application/octet-stream Size: 27453 bytes Desc: image003.emz URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image004.png Type: image/png Size: 25172 bytes Desc: image004.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: oledata.mso Type: application/octet-stream Size: 34553 bytes Desc: oledata.mso URL: From dhoppes at mbfbioscience.com Wed Jun 29 11:33:30 2016 From: dhoppes at mbfbioscience.com (Doug Hoppes) Date: Wed, 29 Jun 2016 15:33:30 +0000 Subject: [vtkusers] Viewport clipping In-Reply-To: <46CB11F12B9DC24D860D4082451B318A36B80E0D@exchange3.microbrightfield.com> References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80E0D@exchange3.microbrightfield.com> Message-ID: <46CB11F12B9DC24D860D4082451B318A36B80EA4@exchange3.microbrightfield.com> Forgot to mention? it?s the same VTKImageActor for all of the viewports. From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of Doug Hoppes Sent: Wednesday, June 29, 2016 11:25 AM To: David Gobbi Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Viewport clipping Okay? I?ll see how hard it is to move our code back to OpenGL with the latest version and see if the problem persists. Here?s the image with a different background. As you can see, the vtkimageactor looks like it?s the correct size. [cid:image005.png at 01D1D1FA.0EEF7BA0] If I use the mouse to drag the image over to the right (using the interactorstyle Pan()), I see: [cid:image006.png at 01D1D1FA.0EEF7BA0] Doug From: David Gobbi [mailto:david.gobbi at gmail.com] Sent: Wednesday, June 29, 2016 11:15 AM To: Doug Hoppes Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Viewport clipping For troubleshooting problems like this, use test images that don't have a black background. That way we can see where the boundaries of the images are. It looks like the images are simply being rendered in the wrong position. So the question is whether this is due to the fact that multiple viewports are being used (i.e. due to a bug in the display coords or view coords), or if this is due to a shift in the world coords. Either way, this is strange because the OpenGL2 vtkImageSliceMapper simply uses a vtkPolyDataMapper under the hood. There were many changes between VTK 6.2 and VTK 7.0... any chance that you can try this with the OpenGL backend in VTK 7.0 (instead of OpenGL2)? Also, here is a very important question: do you create a separate vtkImageActor for each of your viewports? Actors should not, in general, be shared between viewports. - David On Wed, Jun 29, 2016 at 8:39 AM, Doug Hoppes > wrote: Notice the clipping. The upper two viewports show nothing, the bottom viewport is correct and the rightmost viewport is clipped in the center of the viewport. If we resize the overall vtk window, the viewport is still clipped in the center. It seems that there is no display to the right-side of the viewport. In the main right viewport, we can actually move the objects around without a problem but the results are still clipped. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image005.png Type: image/png Size: 26181 bytes Desc: image005.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image006.png Type: image/png Size: 25172 bytes Desc: image006.png URL: From david.gobbi at gmail.com Wed Jun 29 11:43:06 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 29 Jun 2016 09:43:06 -0600 Subject: [vtkusers] Viewport clipping In-Reply-To: <46CB11F12B9DC24D860D4082451B318A36B80E0D@exchange3.microbrightfield.com> References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80E0D@exchange3.microbrightfield.com> Message-ID: Let me know how it goes. I just tried multiple viewports with vtkImageActor on my own machine, with the OpenGL2 backend, and everything worked fine. Also, many of the nightly VTK tests use multiple viewports with image rendering, e.g. Rendering/Image/Testing/Cxx/TestImageSliceMapperInterpolation.cxx I'm using vtk-master, but the vtkImageActor and vtkImageSliceMapper code hasn't changed since VTK 7.0 in any way that should change the interaction between image rendering and viewports. - David On Wed, Jun 29, 2016 at 9:25 AM, Doug Hoppes wrote: > Okay? I?ll see how hard it is to move our code back to OpenGL with the > latest version and see if the problem persists. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 11:47:36 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 17:47:36 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: 2016-06-29 17:17 GMT+02:00 Marcus D. Hanwell : > On Wed, Jun 29, 2016 at 10:43 AM, Elvis Stansvik > wrote: > > 2016-06-29 16:37 GMT+02:00 Sankhesh Jhaveri < > sankhesh.jhaveri at kitware.com>: > >> > >> vtkGUISupportQtOpenGL module hasn't been ported to the OpenGL2 backend > >> yet. > >> > >> See: > >> > https://github.com/Kitware/VTK/commit/e58ca401466f9af4c542c085f7b599b6bde939c8 > >> > >> For now, it just works with the OpenGL backend. > > > > Aha. That explains it. Thanks. > > > > Are there any big downsides to using the OpenGL backend? What are the > main > > benefits of the OpenGL2 backend? > > > I would echo Sankhesh's comments - are there any applications using > the classes in vtkGUISupportQtOpenGL? There are not many I am aware > of, and the classes in that module use a deprecated Qt class. The vast > majority make use of QVTKWidget in vtkGUISupportQt > > Things changed quite a bit in Qt, and I think if you are > packaging/using this in general builds skipping vtkGUISupportQtOpenGL > is normally the correct thing to do unless you have a compelling user > of the classes in there. If you do it would be great to learn what is > using it in the wild. > > We will hopefully have a replacement for OpenGL2 soon, but it should > likely derive from the newer QOpenGL* classes, and as such may not > precisely match the previous API. > I see, I may have misunderstood the role of QVTKWidget2 is vs QVTKWidget. I thought QVTKWidget2 was essentially a newer replacement for QVTKWidget, and to be preferred in new code. I've also misunderstood a little how the two widgets work. I knew QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying to make a similar Python class just recently, which uses QOpenGLWidget, but ran into some problems). But I also wrongly thought that QVTKWidget used QGLWidget, looking at the code I see now that it doesn't. So in short: I have no great need for QVTKWidget2, functionality-wise. So if using it precludes using the OpenGL2 backend, I'll use QVTKWidget instead. One thing I did like was that the code in QVTKWidget2 looked a little simpler/cleaner than the one QVTKWidget. It's always nice to be able to quickly check how something work. An officially supported widget, based on QOpenGLWidget and supporting the OpenGL2 backend, would be the absolutely best of course. In fact, there's an answer on StackOverflow where a user posted his QVTKWidget2 hacked to work with QOpenGLWidget [1], perhaps it could be used as a starting point? Elvis [1] http://stackoverflow.com/questions/26944831/using-qvtkwidget-and-qopenglwidget-in-the-same-ui/26946040#26946040 > > Marcus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shawn.waldon at kitware.com Wed Jun 29 12:07:13 2016 From: shawn.waldon at kitware.com (Shawn Waldon) Date: Wed, 29 Jun 2016 12:07:13 -0400 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: > > > I see, I may have misunderstood the role of QVTKWidget2 is vs QVTKWidget. > I thought QVTKWidget2 was essentially a newer replacement for QVTKWidget, > and to be preferred in new code. > > I've also misunderstood a little how the two widgets work. I knew > QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying > to make a similar Python class just recently, which uses QOpenGLWidget, but > ran into some problems). But I also wrongly thought that QVTKWidget used > QGLWidget, looking at the code I see now that it doesn't. > > So in short: I have no great need for QVTKWidget2, functionality-wise. So > if using it precludes using the OpenGL2 backend, I'll use QVTKWidget > instead. > > One thing I did like was that the code in QVTKWidget2 looked a little > simpler/cleaner than the one QVTKWidget. It's always nice to be able to > quickly check how something work. > > An officially supported widget, based on QOpenGLWidget and supporting the > OpenGL2 backend, would be the absolutely best of course. In fact, there's > an answer on StackOverflow where a user posted his QVTKWidget2 hacked to > work with QOpenGLWidget [1], perhaps it could be used as a starting point? > So just to throw this out there, here is the situation as I understand it. Ben (cc'd) can correct what I get wrong since he was one of the last to touch QVTKWidget2. QVTKWidget works fine with OpenGL2 if you are building against Qt4. But when you build for Qt5 there are issues with creating the OpenGL context and letting Qt know the context is there and so some features of the OpenGL2 backend don't work right. Ben updated (or has a branch to udpate?) QVTKWidget2 so that it fixes these problems and works with Qt5, but if you are on Linux you need Qt5.6 for a bugfix in Qt (otherwise there are interactivity problems when interacting with the mouse). Yes, an officially supported QOpenGLWidget-based QVTKWidget3 would be the best way forward. But I don't know what the status of that discussion is... HTH, Shawn -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 29 12:08:09 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 29 Jun 2016 10:08:09 -0600 Subject: [vtkusers] Custom cursor shapes In-Reply-To: <91D8CC7A-821C-4A5E-9519-97A8A3611E45@gmail.com> References: <91D8CC7A-821C-4A5E-9519-97A8A3611E45@gmail.com> Message-ID: Hi Enzo, For custom cursor shapes, you'd have to rely on a GUI toolkit like Qt. VTK can't load custom cursors on its own. - David On Tue, Jun 28, 2016 at 1:02 PM, Enzo Matsumiya wrote: > Hello, > > Is there any way to add custom cursors? > I'm already using VTK_CURSOR_CROSSHAIR and VTK_CURSOR_HAND, but now I'm > implementing zoom and rotate functionality to my app and I would like to > use some shapes that represents those better. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 29 12:16:54 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 29 Jun 2016 10:16:54 -0600 Subject: [vtkusers] Viewport clipping In-Reply-To: References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80E0D@exchange3.microbrightfield.com> Message-ID: And I just tried multiple viewports with VTK 7.0.0, it worked fine too. bin/vtkRenderingImageCxxTests TestImageSliceMapperInterpolation -I On Wed, Jun 29, 2016 at 9:43 AM, David Gobbi wrote: > Let me know how it goes. I just tried multiple viewports with > vtkImageActor on my own machine, with the OpenGL2 backend, and everything > worked fine. Also, many of the nightly VTK tests use multiple viewports > with image rendering, > e.g. Rendering/Image/Testing/Cxx/TestImageSliceMapperInterpolation.cxx > > I'm using vtk-master, but the vtkImageActor and vtkImageSliceMapper code > hasn't changed since VTK 7.0 in any way that should change the interaction > between image rendering and viewports. > > - David > > > On Wed, Jun 29, 2016 at 9:25 AM, Doug Hoppes > wrote: > >> Okay? I?ll see how hard it is to move our code back to OpenGL with the >> latest version and see if the problem persists. >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 12:43:23 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 18:43:23 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: Den 29 juni 2016 6:07 em skrev "Shawn Waldon" : >> >> >> I see, I may have misunderstood the role of QVTKWidget2 is vs QVTKWidget. I thought QVTKWidget2 was essentially a newer replacement for QVTKWidget, and to be preferred in new code. >> >> I've also misunderstood a little how the two widgets work. I knew QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying to make a similar Python class just recently, which uses QOpenGLWidget, but ran into some problems). But I also wrongly thought that QVTKWidget used QGLWidget, looking at the code I see now that it doesn't. >> >> So in short: I have no great need for QVTKWidget2, functionality-wise. So if using it precludes using the OpenGL2 backend, I'll use QVTKWidget instead. >> >> One thing I did like was that the code in QVTKWidget2 looked a little simpler/cleaner than the one QVTKWidget. It's always nice to be able to quickly check how something work. >> >> An officially supported widget, based on QOpenGLWidget and supporting the OpenGL2 backend, would be the absolutely best of course. In fact, there's an answer on StackOverflow where a user posted his QVTKWidget2 hacked to work with QOpenGLWidget [1], perhaps it could be used as a starting point? > > > So just to throw this out there, here is the situation as I understand it. Ben (cc'd) can correct what I get wrong since he was one of the last to touch QVTKWidget2. > > QVTKWidget works fine with OpenGL2 if you are building against Qt4. But when you build for Qt5 there are issues with creating the OpenGL context and letting Qt know the context is there and so some features of the OpenGL2 backend don't work right. > > Ben updated (or has a branch to udpate?) QVTKWidget2 so that it fixes these problems and works with Qt5, but if you are on Linux you need Qt5.6 for a bugfix in Qt (otherwise there are interactivity problems when interacting with the mouse). Aha, so it seems I'm stuck between a rock and a hard place if I'm on Qt 5 and want to use the OpenGL2 backend with a released version of VTK (so 7.0.0 or hopefully soon 7.0.1)? Additionally, this app is to be deployed with the Qt shipped on Ubuntu 16.04, which is 5.5.1, so even if I would switch to a special VTK branch, I'd suffer interactivity problems (?). So say I give up on using the OpenGL2 backend, and use the combo QVTKWidget + Qt 5.5.1 + OpenGL backend. Can I expect any problems there? The target hardware is a laptop with dual GPUs of our choosing, where the nVidia GPU is occupied for calculations, so VTK will in all likelihood run on a Intel GPU, with the driver version in Xenial. I'll also have to be able to develop on my work laptop (Haswell), which has Intel graphics. Will the old fixed pipeline OpenGL backend be a problem on these systems? Volume rendering is the only GPU heavy VTK feature I'll use I think. Thankful for any advice on what is currently the most reliable combo. Elvis > > Yes, an officially supported QOpenGLWidget-based QVTKWidget3 would be the best way forward. But I don't know what the status of that discussion is... > > HTH, > > Shawn -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 12:45:11 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 18:45:11 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: Den 29 juni 2016 6:07 em skrev "Shawn Waldon" : >> >> >> I see, I may have misunderstood the role of QVTKWidget2 is vs QVTKWidget. I thought QVTKWidget2 was essentially a newer replacement for QVTKWidget, and to be preferred in new code. >> >> I've also misunderstood a little how the two widgets work. I knew QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying to make a similar Python class just recently, which uses QOpenGLWidget, but ran into some problems). But I also wrongly thought that QVTKWidget used QGLWidget, looking at the code I see now that it doesn't. >> >> So in short: I have no great need for QVTKWidget2, functionality-wise. So if using it precludes using the OpenGL2 backend, I'll use QVTKWidget instead. >> >> One thing I did like was that the code in QVTKWidget2 looked a little simpler/cleaner than the one QVTKWidget. It's always nice to be able to quickly check how something work. >> >> An officially supported widget, based on QOpenGLWidget and supporting the OpenGL2 backend, would be the absolutely best of course. In fact, there's an answer on StackOverflow where a user posted his QVTKWidget2 hacked to work with QOpenGLWidget [1], perhaps it could be used as a starting point? > > > So just to throw this out there, here is the situation as I understand it. Ben (cc'd) can correct what I get wrong since he was one of the last to touch QVTKWidget2. > > QVTKWidget works fine with OpenGL2 if you are building against Qt4. But when you build for Qt5 there are issues with creating the OpenGL context and letting Qt know the context is there and so some features of the OpenGL2 backend don't work right. Do you know which features and if this is being worked out? Elvis > > Ben updated (or has a branch to udpate?) QVTKWidget2 so that it fixes these problems and works with Qt5, but if you are on Linux you need Qt5.6 for a bugfix in Qt (otherwise there are interactivity problems when interacting with the mouse). > > Yes, an officially supported QOpenGLWidget-based QVTKWidget3 would be the best way forward. But I don't know what the status of that discussion is... > > HTH, > > Shawn -------------- next part -------------- An HTML attachment was scrubbed... URL: From dhoppes at mbfbioscience.com Wed Jun 29 12:53:35 2016 From: dhoppes at mbfbioscience.com (Doug Hoppes) Date: Wed, 29 Jun 2016 16:53:35 +0000 Subject: [vtkusers] Viewport clipping In-Reply-To: References: <46CB11F12B9DC24D860D4082451B318A36B80C41@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80C9B@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80D57@exchange3.microbrightfield.com> <46CB11F12B9DC24D860D4082451B318A36B80E0D@exchange3.microbrightfield.com> Message-ID: <46CB11F12B9DC24D860D4082451B318A36B80F44@exchange3.microbrightfield.com> Okay? thanks? I?ll have to debug the code check out why we?re getting this issue. I?ll let you know what we find. From: David Gobbi [mailto:david.gobbi at gmail.com] Sent: Wednesday, June 29, 2016 12:17 PM To: Doug Hoppes Cc: vtkusers at vtk.org Subject: Re: [vtkusers] Viewport clipping And I just tried multiple viewports with VTK 7.0.0, it worked fine too. bin/vtkRenderingImageCxxTests TestImageSliceMapperInterpolation -I On Wed, Jun 29, 2016 at 9:43 AM, David Gobbi > wrote: Let me know how it goes. I just tried multiple viewports with vtkImageActor on my own machine, with the OpenGL2 backend, and everything worked fine. Also, many of the nightly VTK tests use multiple viewports with image rendering, e.g. Rendering/Image/Testing/Cxx/TestImageSliceMapperInterpolation.cxx I'm using vtk-master, but the vtkImageActor and vtkImageSliceMapper code hasn't changed since VTK 7.0 in any way that should change the interaction between image rendering and viewports. - David On Wed, Jun 29, 2016 at 9:25 AM, Doug Hoppes > wrote: Okay? I?ll see how hard it is to move our code back to OpenGL with the latest version and see if the problem persists. -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 13:00:47 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 19:00:47 +0200 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: 2016-06-28 23:53 GMT+02:00 David Gobbi : > On Tue, Jun 28, 2016 at 2:29 PM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: >> >> >> That's interesting. So if I understand the above correctly, you create a >> little ad-hoc pipeline for the purpose of reading the file, and then keep >> only what you need. >> > > Yes, exactly. The ad-hoc pipeline is sometimes more than just a reader, > it might also massage the image by changing the orientation or the data > type. > > >> In my case I'm working from Python, though for various reasons I'm at >> least entertaining the idea of re-writing what I have in C++. But say I >> stick to Python, would the shallow copying maneuver above be relevant in >> Python-land? >> > > It'll work exactly the same in Python as C++. > I see, and it makes sense now: The shallow copying of the result and subsequent discarding of the pipeline must still be done in Python. It's not enough to just let the pipeline go out of scope, since VTK will then still hold references keeping the objects of the pipeline alive (preventing Python garbage collection) (?). > >> I see. In my case I'm not going to have any pure-processing pipelines. >> Most of what I'll use VTK for is interactive visualization, where I may >> want to tweak certain aspects of the visualization while it is shown >> (transfer functions, volume of interest extraction bounds, transforms, >> ...). So I think I want to keep the entire pipeline alive in most cases >> (but see my question further down), even if some nodes in the pipeline can >> be "hidden" in the sense that I don't need to keep around references to >> them. The nodes I do have to keep references to are of course the ones >> where I'll need to tweak things. >> > > This sort of interactive display pipeline is what VTK was made for. > > >> Ah, perhaps it would make sense for me to also break out the pipeline >> construction/destruction logic out of my widget into a separate class, even >> if I don't have destructors in the C++ sense. >> > > Since the "clean-up" that you want to do is mainly just deleting all the > object you don't need anymore, it should be fine if all your VTK filter > objects are members of your break-out class. You have to rely on the > Python & VTK reference counting to take care of the destruction. > Yes, makes sense. > > The fact that C++ provides so many options for how to do memory management > is a nice feature (or maybe the lack of unified memory management is a > non-feature?) > :) > > Interactive processing pipelines (as opposed to the run-once pipelines) >>> are temporarily connected to a display pipeline via the usual >>> AddInputConnection() mechanism, but when the interaction is complete the >>> following is done: 1) the connection is broken with e.g. >>> RemoveAllInputConnections(), 2) the output is shallow-copied into a new >>> data object with the CopyStructure()/PassData() calls and the processing >>> pipeline is deleted, and 3) the copy is connected directly to the display >>> pipeline (and generally stored in my data management structure, as well). >>> >> >> Hm, now I think I understand what you mean. So you have a general >> "processing" segment of the pipeline, and a visualization pipeline that >> follows, and you keep the processing part of it alive only for as long as >> you need it. >> >> I then just have one question I think: What if you later need to "hook >> up" the processing segment again? Do you discard the shallow copy you made, >> create a new processing pipeline segment and hook it up to the >> visualization segment? >> > > Yes, the pipeline segment is re-created. Its input is set (via > SetInputData) to the vtkImageData object that came from the reader (or to > some other vtkImageData object) and then this pipeline segment is connected > to the display pipeline. The previous input to the display pipeline can be > thrown away or placed on an undo stack. > Alright. > > The general idea is that pipeline segments only exist for as long as they >>> are being used, i.e. they are either limited to the scope of a single >>> function, or limited to the lifetime of a specific object. This helps to >>> reduce the overall resource usage of the application. >>> >> >> I like this design, and it makes sense. I'll have to think about it some >> more. >> >> A little about my use case: It's a tool for looking at tomographic images >> of drilled rock cores, along with some spectral analysis results (plots). >> The user will be able to see a scale showing drilled depth (~1000 m), with >> some segments indicating where there are samples available. Clicking such a >> segment (~1 m) will bring up the volume corresponding to that sample in a >> VTK view. If the user wishes to go even closer, he/she should be able to >> select a smaller (~10 cm) segment in the ~1 m view, which will bring that >> segment up in a third (larger) view which has free zooming/rotation. And >> another thing is that the user must be able to adjust the color/opacity >> transfer functions used in the volume rendering. Not everything is ironed >> out yet, but that's the gist of it, as far as VTK is involved. >> > > Sounds interesting. The "selection" part will be fun ;) > I'll start small :) Did you mean fun as in challenging and stimulating, or fun as in I'll tear my hair out? > > >> Again, thanks a lot for your input, you've been very helpful. >> > > You're making me jealous, because lately I've been dedicating most of my > time to writing command-line image processing scripts with bash (not > fun!). But next month I'll be getting back into app development. > Bash scripts has their charm as well :) But yes, this is very interesting work. A lot of the challenges are not in the technical, but in trying to understand what the user want. Elvis > - David > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Wed Jun 29 13:25:03 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Wed, 29 Jun 2016 11:25:03 -0600 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: On Wed, Jun 29, 2016 at 11:00 AM, Elvis Stansvik < elvis.stansvik at orexplore.com> wrote: > > I see, and it makes sense now: The shallow copying of the result and > subsequent discarding of the pipeline must still be done in Python. It's > not enough to just let the pipeline go out of scope, since VTK will then > still hold references keeping the objects of the pipeline alive (preventing > Python garbage collection) (?). > Well, from VTK 6 onwards the data objects shouldn't hold any references to the upstream pipeline... the "shallow copy" trick is something I started doing back in the days of VTK 5, but it still works fine for VTK 6 and VTK 7 so I haven't changed it. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 13:48:36 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 19:48:36 +0200 Subject: [vtkusers] "Disabling" a volume rendering pipeline in a controlled way? In-Reply-To: References: Message-ID: 2016-06-29 19:25 GMT+02:00 David Gobbi : > On Wed, Jun 29, 2016 at 11:00 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> >> I see, and it makes sense now: The shallow copying of the result and >> subsequent discarding of the pipeline must still be done in Python. It's >> not enough to just let the pipeline go out of scope, since VTK will then >> still hold references keeping the objects of the pipeline alive (preventing >> Python garbage collection) (?). >> > > Well, from VTK 6 onwards the data objects shouldn't hold any references to > the upstream pipeline... the "shallow copy" trick is something I started > doing back in the days of VTK 5, but it still works fine for VTK 6 and VTK > 7 so I haven't changed it. > Ah, I see. > > - David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Wed Jun 29 15:28:10 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Wed, 29 Jun 2016 21:28:10 +0200 Subject: [vtkusers] About Pitfalls section in smart pointers tutorial Message-ID: At http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers#Pitfalls is this warning: "If you create an object and then change where it is pointing, the reference count will be incorrect. e.g. vtkSmartPointer Polydata = vtkSmartPointer::New(); Polydata = Reader->GetOutput(); In this case, memory is allocated for Polydata, but then we change Polydata to point to the output of Reader rather than the memory we just allocated. Instead, we should have done simply: vtkPolyData* Polydata = Reader->GetOutput(); It was not necessary to use a smart pointer because we did not actually create any new objects" I fail to see how the refcount would be incorrect in the first approach. First a new object is created and its refcount increased to 1, then when Reader->GetOutput() (a raw pointer) is assigned to Polydata, wouldn't the smart pointer take care of decreasing the refcount for the object it already points to (so it would go to 0), before it starts managing the new pointer? Or is that not how it will work? Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcus.hanwell at kitware.com Wed Jun 29 15:42:10 2016 From: marcus.hanwell at kitware.com (Marcus D. Hanwell) Date: Wed, 29 Jun 2016 15:42:10 -0400 Subject: [vtkusers] About Pitfalls section in smart pointers tutorial In-Reply-To: References: Message-ID: On Wed, Jun 29, 2016 at 3:28 PM, Elvis Stansvik wrote: > At > > http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers#Pitfalls > > is this warning: > > "If you create an object and then change where it is pointing, the reference > count will be incorrect. e.g. > > vtkSmartPointer Polydata = vtkSmartPointer::New(); > Polydata = Reader->GetOutput(); > > In this case, memory is allocated for Polydata, but then we change Polydata > to point to the output of Reader rather than the memory we just allocated. > Instead, we should have done simply: > > vtkPolyData* Polydata = Reader->GetOutput(); > > It was not necessary to use a smart pointer because we did not actually > create any new objects" > > I fail to see how the refcount would be incorrect in the first approach. > First a new object is created and its refcount increased to 1, then when > Reader->GetOutput() (a raw pointer) is assigned to Polydata, wouldn't the > smart pointer take care of decreasing the refcount for the object it already > points to (so it would go to 0), before it starts managing the new pointer? > Or is that not how it will work? > I have the same interpretation, it looks like it was added by David Doria in 2009. It is silly to allocate a new object, and then immediately point to something else without ever using that object, but the reference count for that object should be correctly decremented and so deleted as far as I can see. I am not sure the pitfalls section has any real value as the only remaining point is quite generically true, don't create objects you are not going to use (on the stack, pointers, or smart pointers). Anyone see something I am missing there? Thanks, Marcus From clinton at elemtech.com Wed Jun 29 16:52:58 2016 From: clinton at elemtech.com (clinton at elemtech.com) Date: Wed, 29 Jun 2016 14:52:58 -0600 (MDT) Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: Message-ID: <1432415697.121274527.1467233578002.JavaMail.zimbra@elemtech.com> ----- On Jun 29, 2016, at 10:45 AM, Elvis Stansvik wrote: > Den 29 juni 2016 6:07 em skrev "Shawn Waldon" < shawn.waldon at kitware.com >: >>> I see, I may have misunderstood the role of QVTKWidget2 is vs QVTKWidget. I >>> thought QVTKWidget2 was essentially a newer replacement for QVTKWidget, and to > >> be preferred in new code. >>> I've also misunderstood a little how the two widgets work. I knew QVTKWidget2 >>> makes use of the deprecated QGLWidget (and was in fact trying to make a similar >>> Python class just recently, which uses QOpenGLWidget, but ran into some >>> problems). But I also wrongly thought that QVTKWidget used QGLWidget, looking > >> at the code I see now that it doesn't. >>> So in short: I have no great need for QVTKWidget2, functionality-wise. So if > >> using it precludes using the OpenGL2 backend, I'll use QVTKWidget instead. >>> One thing I did like was that the code in QVTKWidget2 looked a little >>> simpler/cleaner than the one QVTKWidget. It's always nice to be able to quickly > >> check how something work. >>> An officially supported widget, based on QOpenGLWidget and supporting the >>> OpenGL2 backend, would be the absolutely best of course. In fact, there's an >>> answer on StackOverflow where a user posted his QVTKWidget2 hacked to work with > >> QOpenGLWidget [1], perhaps it could be used as a starting point? >> So just to throw this out there, here is the situation as I understand it. Ben >> (cc'd) can correct what I get wrong since he was one of the last to touch > > QVTKWidget2. >> QVTKWidget works fine with OpenGL2 if you are building against Qt4. But when you >> build for Qt5 there are issues with creating the OpenGL context and letting Qt >> know the context is there and so some features of the OpenGL2 backend don't > > work right. > Do you know which features and if this is being worked out? I'm aware of some issues, and have looked briefly at Linux specific issues. For instance, QVTKWidget::x11_setup_window is disabled for Qt5 and there has not been a replacement for that yet. One possible workaround is to do something like the following in your main() before the QApplication is constructed. QSurfaceFormat fmt ; fmt . setDepthBufferSize ( 8 ); fmt . setSamples ( 1 ); fmt . setAlphaBufferSize ( 8 ); fmt . setStereo ( 1 ); fmt . setStencilBufferSize ( 8 ); QSurfaceFormat :: setDefaultFormat ( fmt ); It does fix some issues I'm able to replicate with the OpenGL backend. For OpenGL2 backend, and possibly applicable to any platform, perhaps you could try adding a fmt .setMajorVersion ( 3 ); fmt .setMajorVersion ( 2 ); However, that may not be necessary because in the case of QVTKWidget, VTK is creating OpenGL contexts, not Qt. I do not yet see a way for that information to be passed from vtkRenderWindow to QVTKWidget and down to Qt after the QApplication has been constructed. Anyway, perhaps these workarounds will help. Clint -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.grabietz at img-online.de Thu Jun 30 01:15:18 2016 From: michael.grabietz at img-online.de (Michael Grabietz) Date: Thu, 30 Jun 2016 07:15:18 +0200 Subject: [vtkusers] Kaspersky 2016 reports a virus in the windows installer for version 7.0.0 In-Reply-To: References: <9b97d15a-626b-5e87-382f-9aecb3f68ca7@img-online.de> <956a6208-6181-c1dc-b62a-ea26b38f0431@img-online.de> Message-ID: <610c0ede-9e3a-ae8b-7258-60f6f53ba281@img-online.de> David, thank you very much for your assistance. I am going to mark the files as 'false positive'. Michael Am 29.06.2016 um 15:50 schrieb David E DeMarle: > I think it is a false positive. > > Although kaspersky's online checker > complained about the pyd files with the mysterious > UDS.DangerousObject.Multi.Generic problem, a local check with a fully > updated Kaspersky anti-virus 2016 trial version did not. > > Our build machines are virus checker protected in any case so it is > unlikely to be a real threat. I think it is more > likely that Kaspersky is being over protective as VTK isn't all that > common in the scale of things. > > We will continue to try and work it out with Kaspersky in any case. > > > David E DeMarle > Kitware, Inc. > R&D Engineer > 21 Corporate Drive > Clifton Park, NY 12065-8662 > Phone: 518-881-4909 > > On Tue, Jun 28, 2016 at 10:27 AM, Michael Grabietz > > > wrote: > > Hi David, > > thanks for your reply. > > Current status of the installer listed on virustotal. > > https://legacy.virustotal.com/en/file/6b090fb40050e45feb5bfaca1c29056a89e25497828d00a785548b579b716a36/analysis/ > > Best Regards, Michael > > > > Am 28.06.2016 um 16:02 schrieb David E DeMarle: > > Michael, > > > > We've had false positives like this before so I assume and hope this is > > another case of that happening. We'll investigate and report back when > > we know more. > > > > thanks, > > > > > > David E DeMarle > > Kitware, Inc. > > R&D Engineer > > 21 Corporate Drive > > Clifton Park, NY 12065-8662 > > Phone: 518-881-4909 > > > > On Tue, Jun 28, 2016 at 9:39 AM, Michael Grabietz > > > >> > > wrote: > > > > Hello, > > > > I just downloaded the vtk7-Installer for Windows. I want to > install vtk > > under Windows 10. Kaspersky Internet Security 2016 is running > on the PC. > > > > I used the following installer: > > > > > http://www.vtk.org/files/release/7.0/vtkpython-7.0.0-Windows-64bit.exe > > > > Kaspersky 2016 is up to date. > > > > > > When I start the installer Kaspersky reports an issue with the > file. A > > virus was detected. Name or type of the virus is reported as > > 'UDS:DangerousObject.Multi.Generic'. > > > > When VTK 7.0.0 is installed Kaspersky reports every *.pyd file > in the > > directory C:\Program Files\VTK 7.0.0\bin\Lib\site-packages\vtk as > > infected by 'UDS:DangerousObject.Multi.Generic' too. 85 files were > > quarantined. > > > > vtkChartsCorePython.pyd Date: 2016-01-28 21:00 > > vtkCommonColorPython.pyd Date: 2016-01-28 20:55 > > vtkCommonComputationalGeometryPython.pyd > > ... > > vtkViewsInfovisPython.pyd > > > > > > I checked these files on various computers running different virus > > scanners like F-Secure and even Kaspersky 2015 (not 2016!) > with up to > > date data bases. They don't complain. > > > > Further I checked vtkChartsCorePython.pyd on the Kaspersky > Site. There > > is a possibility to upload files for checking. It is reported as > > infected. Maybe somebody can give it a try and uploads one of > these pyd > > files to the Kaspersky site to verify this behaviour. > > > > I hope it is a false positive. Do you had already some similar > issues > > like that? I am rather confused, since I cannot find any suitable > > information in the web about this issue. > > > > > > Best regards, Michael > > > > _______________________________________________ > > 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 > > > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > > > Follow this link to subscribe/unsubscribe: > > http://public.kitware.com/mailman/listinfo/vtkusers > > > > > > -- > Michael Grabietz > > IMG - Ingenieurbuero Michael Grabietz > Stauferring 56 > 97941 Tauberbischofsheim > Germany > > Fon: +49 9341 89 66 70 > Fax: +49 9341 89 66 71 > > michael.grabietz at img-online.de > www.img-online.de > > > -- Michael Grabietz IMG - Ingenieurbuero Michael Grabietz Stauferring 56 97941 Tauberbischofsheim Germany Fon: +49 9341 89 66 70 Fax: +49 9341 89 66 71 michael.grabietz at img-online.de www.img-online.de From elvis.stansvik at orexplore.com Thu Jun 30 03:02:02 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 09:02:02 +0200 Subject: [vtkusers] About Pitfalls section in smart pointers tutorial In-Reply-To: References: Message-ID: 2016-06-29 21:42 GMT+02:00 Marcus D. Hanwell : > On Wed, Jun 29, 2016 at 3:28 PM, Elvis Stansvik > wrote: > > At > > > > http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers#Pitfalls > > > > is this warning: > > > > "If you create an object and then change where it is pointing, the > reference > > count will be incorrect. e.g. > > > > vtkSmartPointer Polydata = > vtkSmartPointer::New(); > > Polydata = Reader->GetOutput(); > > > > In this case, memory is allocated for Polydata, but then we change > Polydata > > to point to the output of Reader rather than the memory we just > allocated. > > Instead, we should have done simply: > > > > vtkPolyData* Polydata = Reader->GetOutput(); > > > > It was not necessary to use a smart pointer because we did not actually > > create any new objects" > > > > I fail to see how the refcount would be incorrect in the first approach. > > First a new object is created and its refcount increased to 1, then when > > Reader->GetOutput() (a raw pointer) is assigned to Polydata, wouldn't the > > smart pointer take care of decreasing the refcount for the object it > already > > points to (so it would go to 0), before it starts managing the new > pointer? > > Or is that not how it will work? > > > I have the same interpretation, it looks like it was added by David > Doria in 2009. It is silly to allocate a new object, and then > immediately point to something else without ever using that object, > but the reference count for that object should be correctly > decremented and so deleted as far as I can see. > Yes, I forgot to say: I of course also think it's silly, I was just curious about the wording of that warning since it didn't make sense to me. Elvis > > I am not sure the pitfalls section has any real value as the only > remaining point is quite generically true, don't create objects you > are not going to use (on the stack, pointers, or smart pointers). > > Anyone see something I am missing there? > > Thanks, > > Marcus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spir.robert at gmail.com Thu Jun 30 03:16:03 2016 From: spir.robert at gmail.com (RobertS) Date: Thu, 30 Jun 2016 00:16:03 -0700 (MST) Subject: [vtkusers] Qt5X11extras dependency Message-ID: <1467270963310-5739005.post@n5.nabble.com> Hello all, when building VTK from git I noticed that when building with Qt5 there is new dependency on Qt5X11extras library. This library is not installed on most distributions by default and I'm trying to create "portable" binary using static VTK libraries that will be able to run on at least ubuntu family without the need to install additional libraries. Is it possible to remove this dependency by disabling some module while still being able to build VTK with Qt5? Thanks, Robert -- View this message in context: http://vtk.1045678.n5.nabble.com/Qt5X11extras-dependency-tp5739005.html Sent from the VTK - Users mailing list archive at Nabble.com. From ich_daniel at habmalnefrage.de Thu Jun 30 03:16:41 2016 From: ich_daniel at habmalnefrage.de (-Daniel-) Date: Thu, 30 Jun 2016 00:16:41 -0700 (MST) Subject: [vtkusers] Custom cursor shapes In-Reply-To: References: <91D8CC7A-821C-4A5E-9519-97A8A3611E45@gmail.com> Message-ID: <1467271001238-5739006.post@n5.nabble.com> Hi Enzo, I'm using Java, where I added my own cursor as follows: Cursor c = Toolkit.getDefaultToolkit().createCustomCursor( CursorImageAsGIF, new Point(10,10), "Cursorname" ); myVTKPanel.setCursor(c); Maybe it helps you... -- View this message in context: http://vtk.1045678.n5.nabble.com/Custom-cursor-shapes-tp5738967p5739006.html Sent from the VTK - Users mailing list archive at Nabble.com. From elvis.stansvik at orexplore.com Thu Jun 30 03:19:29 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 09:19:29 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: <1432415697.121274527.1467233578002.JavaMail.zimbra@elemtech.com> References: <1432415697.121274527.1467233578002.JavaMail.zimbra@elemtech.com> Message-ID: 2016-06-29 22:52 GMT+02:00 : > > > ----- On Jun 29, 2016, at 10:45 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > > > Den 29 juni 2016 6:07 em skrev "Shawn Waldon" : > >> > >> > >> I see, I may have misunderstood the role of QVTKWidget2 is vs > QVTKWidget. I thought QVTKWidget2 was essentially a newer replacement for > QVTKWidget, and to be preferred in new code. > >> > >> I've also misunderstood a little how the two widgets work. I knew > QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying > to make a similar Python class just recently, which uses QOpenGLWidget, but > ran into some problems). But I also wrongly thought that QVTKWidget used > QGLWidget, looking at the code I see now that it doesn't. > >> > >> So in short: I have no great need for QVTKWidget2, functionality-wise. > So if using it precludes using the OpenGL2 backend, I'll use QVTKWidget > instead. > >> > >> One thing I did like was that the code in QVTKWidget2 looked a little > simpler/cleaner than the one QVTKWidget. It's always nice to be able to > quickly check how something work. > >> > >> An officially supported widget, based on QOpenGLWidget and supporting > the OpenGL2 backend, would be the absolutely best of course. In fact, > there's an answer on StackOverflow where a user posted his QVTKWidget2 > hacked to work with QOpenGLWidget [1], perhaps it could be used as a > starting point? > > > > > > So just to throw this out there, here is the situation as I understand > it. Ben (cc'd) can correct what I get wrong since he was one of the last > to touch QVTKWidget2. > > > > QVTKWidget works fine with OpenGL2 if you are building against Qt4. But > when you build for Qt5 there are issues with creating the OpenGL context > and letting Qt know the context is there and so some features of the > OpenGL2 backend don't work right. > > Do you know which features and if this is being worked out? > > > I'm aware of some issues, and have looked briefly at Linux specific issues. > For instance, QVTKWidget::x11_setup_window is disabled for Qt5 and there > has not been a replacement for that yet. > Alright, good to know, thanks. > > One possible workaround is to do something like the following in your > main() before the QApplication is constructed. > > QSurfaceFormat fmt; > > fmt.setDepthBufferSize(8); > > fmt.setSamples(1); > > fmt.setAlphaBufferSize(8); > > fmt.setStereo(1); > > fmt.setStencilBufferSize(8); > QSurfaceFormat::setDefaultFormat(fmt); > > > Hm, but isn't QSurfaceFormat only about the context set up by the new (or well, somewhat new) QOpenGLWidget? If you mean you are using a context from QGLWidget (through QVTKWidget2), then shouldn't QGLFormat be used instead? > It does fix some issues I'm able to replicate with the OpenGL backend. > For OpenGL2 backend, and possibly applicable to any platform, perhaps you > could try adding a > > fmt.setMajorVersion(3); > > fmt.setMajorVersion(2); > > Yes, this is what I did (and also fmt.setProfile(QSurfaceFormat.CompatibilityProfile) when experimenting with trying to get a QOpenGLWidget-backed widget working from Python (? la http://stackoverflow.com/questions/26944831/using-qvtkwidget-and-qopenglwidget-in-the-same-ui/26946040#26946040), in order for VTK to accept the context. > However, that may not be necessary because in the case of QVTKWidget, VTK > is creating OpenGL contexts, not Qt. > Right, that's what I also found out when looking at the code. > > I do not yet see a way for that information to be passed from > vtkRenderWindow to QVTKWidget and down to Qt after the QApplication has > been constructed. > With "that information", do you mean information about what OpenGL version the render needs? No I guess not, I guess you just have to target a certain VTK version and use fixed numbers in the calls to .setMajor/MinorVersion. But, like you say, with QVTKWidget, VTK is creating the OpenGL context, so there's nothing to .setMajorMinor/Version on, or am I missing something? > Anyway, perhaps these workarounds will help. > I'm not sure, if QSurfaceFormat is only for QOpenGLWidget, I would have to have a working QOpenGLWidget-based VTK widget first. But it was interesting that you set the depth/alpha/stencil buffers as well, since I only used it to set the number of samples when I experimented with QOpenGLWidget. Perhaps I should give it a try again. In the end, I would still be very interested to hear if anyone knows what would be the best backend + VTK widget to use given the hardware I need to support. Elvis > Clint > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 30 07:16:14 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 13:16:14 +0200 Subject: [vtkusers] CMake best practice for using VTK? In-Reply-To: References: Message-ID: 2016-06-27 22:10 GMT+02:00 David Gobbi : > > > On Mon, Jun 27, 2016 at 1:44 PM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >> I'm using the trio >> >> find_package(VTK REQUIRED) >> >> include(${VTK_USE_FILE}) >> >> target_link_libraries(myapp ${VTK_LIBRARIES}) >> >> in my CMakeLists.txt, to find and link against VTK, like is done in the >> VTK examples. >> >> I'm surprised by two things: >> >> 1. The shear amount of libraries that are linked against. Are all these >> really necessary, or is it possible to more selective somehow? Is there >> something like Qt's CMake system, where you can pull in just a certain Qt >> module with target_link_libraries(myapp Qt5::Widgets) ? >> >> 2. How come the .so files are specified directly as inputs, with their >> full paths? Isn't the common method to just add the appropriate -l (and >> possibly -L if needed) flags? >> > > I build my own list that contains only the libraries that I need, and I > also try to be careful about public vs. private linkage. For example: > > set(VTK_LIBS vtkCommonCore vtkCommonDataModel vtkImagingCore > vtkIOImage) > # Also link vtkIOMPIImage if present, it has factories for vtkIOImage > list(FIND VTK_LIBRARIES vtkIOMPIImage TMP_INDEX) > if(TMP_INDEX GREATER -1) > set(VTK_LIBS ${VTK_LIBS} vtkIOMPIImage) > endif() > > target_link_libraries(${LIB_NAME} LINK_PUBLIC ${VTK_LIBS}) > # target_link_libraries(${LIB_NAME} LINK_PRIVATE ) > > To find out what modules you need to link, the script > VTK/Utilities/Maintenance/WhatModulesVTK.py can be of some use. > The script seems to work fine, but has some limitations. It seems it only considers headers that start with "vtk", so if I include QVTKWidget.h, it won't pick up that I need the vtkGUISupportQt module. Elvis > > I know this doesn't cover all of your points, but unfortunately this is as > complete an answer as I have time to give right now. Hopefully someone > else can jump in and provide more details. > > - David > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From utkarsh.ayachit at kitware.com Thu Jun 30 07:27:45 2016 From: utkarsh.ayachit at kitware.com (Utkarsh Ayachit) Date: Thu, 30 Jun 2016 07:27:45 -0400 Subject: [vtkusers] Qt5X11extras dependency In-Reply-To: <1467270963310-5739005.post@n5.nabble.com> References: <1467270963310-5739005.post@n5.nabble.com> Message-ID: Robert, It's needed for QVTKWidget here [1]. The code is not new, I just fixed it to depend on the proper module and use correct #fidef conditions in case of Qt 5. Utkarsh [1] https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/Qt/QVTKWidget.cxx#L221-224 On Thu, Jun 30, 2016 at 3:16 AM, RobertS wrote: > Hello all, > when building VTK from git I noticed that when building with Qt5 there is > new dependency on Qt5X11extras library. This library is not installed on > most distributions by default and I'm trying to create "portable" binary > using static VTK libraries that will be able to run on at least ubuntu > family without the need to install additional libraries. Is it possible to > remove this dependency by disabling some module while still being able to > build VTK with Qt5? > Thanks, > Robert > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/Qt5X11extras-dependency-tp5739005.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers From pbernardes at uaum.uminho.pt Thu Jun 30 07:38:03 2016 From: pbernardes at uaum.uminho.pt (Paulo Bernardes) Date: Thu, 30 Jun 2016 12:38:03 +0100 Subject: [vtkusers] Associate 2 different vtkSliderWidget to 2 different vtkRenderer Message-ID: Dear all, I need to associate 2 vtkSliderWidget to 2 different vtkRenderer (leftRenderer & rightRenderer). I have to put one slider over the leftRenderer and the other slider over the rightRenderer. This I can manage, however I can?t interact with the slider over the rightRenderer. Can anyone give me some help with this? Thank you! Yours, Paulo -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 30 07:54:49 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 13:54:49 +0200 Subject: [vtkusers] CMake best practice for using VTK? In-Reply-To: References: Message-ID: 2016-06-30 13:16 GMT+02:00 Elvis Stansvik : > 2016-06-27 22:10 GMT+02:00 David Gobbi : > >> >> >> On Mon, Jun 27, 2016 at 1:44 PM, Elvis Stansvik < >> elvis.stansvik at orexplore.com> wrote: >> >>> I'm using the trio >>> >>> find_package(VTK REQUIRED) >>> >>> include(${VTK_USE_FILE}) >>> >>> target_link_libraries(myapp ${VTK_LIBRARIES}) >>> >>> in my CMakeLists.txt, to find and link against VTK, like is done in the >>> VTK examples. >>> >>> I'm surprised by two things: >>> >>> 1. The shear amount of libraries that are linked against. Are all these >>> really necessary, or is it possible to more selective somehow? Is there >>> something like Qt's CMake system, where you can pull in just a certain Qt >>> module with target_link_libraries(myapp Qt5::Widgets) ? >>> >>> 2. How come the .so files are specified directly as inputs, with their >>> full paths? Isn't the common method to just add the appropriate -l (and >>> possibly -L if needed) flags? >>> >> >> I build my own list that contains only the libraries that I need, and I >> also try to be careful about public vs. private linkage. For example: >> >> set(VTK_LIBS vtkCommonCore vtkCommonDataModel vtkImagingCore >> vtkIOImage) >> # Also link vtkIOMPIImage if present, it has factories for vtkIOImage >> list(FIND VTK_LIBRARIES vtkIOMPIImage TMP_INDEX) >> if(TMP_INDEX GREATER -1) >> set(VTK_LIBS ${VTK_LIBS} vtkIOMPIImage) >> endif() >> >> target_link_libraries(${LIB_NAME} LINK_PUBLIC ${VTK_LIBS}) >> # target_link_libraries(${LIB_NAME} LINK_PRIVATE ) >> >> To find out what modules you need to link, the script >> VTK/Utilities/Maintenance/WhatModulesVTK.py can be of some use. >> > > The script seems to work fine, but has some limitations. It seems it only > considers headers that start with "vtk", so if I include QVTKWidget.h, it > won't pick up that I need the vtkGUISupportQt module. > I made this pull request to make it also consider QVTK* headers: https://gitlab.kitware.com/vtk/vtk/merge_requests/1604 Elvis > > Elvis > > >> >> I know this doesn't cover all of your points, but unfortunately this is >> as complete an answer as I have time to give right now. Hopefully someone >> else can jump in and provide more details. >> >> - David >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.boeckel at kitware.com Thu Jun 30 08:19:28 2016 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 30 Jun 2016 08:19:28 -0400 Subject: [vtkusers] CMake best practice for using VTK? In-Reply-To: References: Message-ID: <20160630121928.GA30959@megas.kitware.com> On Mon, Jun 27, 2016 at 21:44:14 +0200, Elvis Stansvik wrote: > 1. The shear amount of libraries that are linked against. Are all these > really necessary, or is it possible to more selective somehow? Is there > something like Qt's CMake system, where you can pull in just a certain Qt > module with target_link_libraries(myapp Qt5::Widgets) ? Use find_package(VTK REQUIRED COMPONENTS ${libraries_you_want}). Then link using ${vtkModuleName_LIBRARIES}. The way you are finding VTK gets all libraries. You may also be interested in the VTK_ENABLE_KITS option which reduces the number of libraries VTK creates. > 2. How come the .so files are specified directly as inputs, with their full > paths? Isn't the common method to just add the appropriate -l (and possibly > -L if needed) flags? CMake prefers full paths. The example is when you have this: /path/A/libA.so /path/A/libB.so /path/B/libB.so and you want to link /path/A/libA.so and /path/B/libB.so. Getting -L and -l right is finicky and hard to get right, so just using full paths is safer and easier. This usually occurs with setups where you want a newer version of A from Homebrew/Macports, but the system B where Homebrew/Macports just happens to also have a copy of B. --Ben From clinton at elemtech.com Thu Jun 30 08:31:57 2016 From: clinton at elemtech.com (clinton at elemtech.com) Date: Thu, 30 Jun 2016 06:31:57 -0600 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: Message-ID: <0583b421-6015-40fd-9f94-0710bb69c221@email.android.com> An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 30 08:59:09 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 14:59:09 +0200 Subject: [vtkusers] CMake best practice for using VTK? In-Reply-To: <20160630121928.GA30959@megas.kitware.com> References: <20160630121928.GA30959@megas.kitware.com> Message-ID: 2016-06-30 14:19 GMT+02:00 Ben Boeckel : > On Mon, Jun 27, 2016 at 21:44:14 +0200, Elvis Stansvik wrote: > > 1. The shear amount of libraries that are linked against. Are all these > > really necessary, or is it possible to more selective somehow? Is there > > something like Qt's CMake system, where you can pull in just a certain Qt > > module with target_link_libraries(myapp Qt5::Widgets) ? > > Use find_package(VTK REQUIRED COMPONENTS ${libraries_you_want}). Then > link using ${vtkModuleName_LIBRARIES}. The way you are finding VTK gets > all libraries. > Ah yes, thanks. > You may also be interested in the VTK_ENABLE_KITS option which reduces > the number of libraries VTK creates. > Alright, I might look into that. > > > 2. How come the .so files are specified directly as inputs, with their > full > > paths? Isn't the common method to just add the appropriate -l (and > possibly > > -L if needed) flags? > > CMake prefers full paths. The example is when you have this: > > /path/A/libA.so > /path/A/libB.so > /path/B/libB.so > > and you want to link /path/A/libA.so and /path/B/libB.so. Getting -L and > -l right is finicky and hard to get right, so just using full paths is > safer and easier. This usually occurs with setups where you want a newer > version of A from Homebrew/Macports, but the system B where > Homebrew/Macports just happens to also have a copy of B. > Yep, I actually went to #cmake on Freenode asking about this and got a good explanation. I thought that the names contained in ${VTK_LIBRARIES} et.c. were plain library names (which would result in -l / -L), but realize now that they are names of imported targets from VTK's installed CMake files, making cmake generate full paths. Elvis > > --Ben > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.chen at gmail.com Thu Jun 30 08:59:37 2016 From: elvis.chen at gmail.com (Elvis Chen) Date: Thu, 30 Jun 2016 08:59:37 -0400 Subject: [vtkusers] pyqt/vtk6 windows? Message-ID: Greetings, since VTK6 binary distribution comes with python binding, is there a guide on how to integrate pyqt into vtk/qt on windows platform? regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 30 09:05:08 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 15:05:08 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: <0583b421-6015-40fd-9f94-0710bb69c221@email.android.com> References: <0583b421-6015-40fd-9f94-0710bb69c221@email.android.com> Message-ID: 2016-06-30 14:31 GMT+02:00 : > > On Jun 30, 2016 1:19 AM, Elvis Stansvik > wrote: > > > > 2016-06-29 22:52 GMT+02:00 : > >> > >> > >> > >> ----- On Jun 29, 2016, at 10:45 AM, Elvis Stansvik < > elvis.stansvik at orexplore.com> wrote: > >>> > >>> > >>> Den 29 juni 2016 6:07 em skrev "Shawn Waldon" < > shawn.waldon at kitware.com>: > >>> >> > >>> >> > >>> >> I see, I may have misunderstood the role of QVTKWidget2 is vs > QVTKWidget. I thought QVTKWidget2 was essentially a newer replacement for > QVTKWidget, and to be preferred in new code. > >>> >> > >>> >> I've also misunderstood a little how the two widgets work. I knew > QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying > to make a similar Python class just recently, which uses QOpenGLWidget, but > ran into some problems). But I also wrongly thought that QVTKWidget used > QGLWidget, looking at the code I see now that it doesn't. > >>> >> > >>> >> So in short: I have no great need for QVTKWidget2, > functionality-wise. So if using it precludes using the OpenGL2 backend, > I'll use QVTKWidget instead. > >>> >> > >>> >> One thing I did like was that the code in QVTKWidget2 looked a > little simpler/cleaner than the one QVTKWidget. It's always nice to be able > to quickly check how something work. > >>> >> > >>> >> An officially supported widget, based on QOpenGLWidget and > supporting the OpenGL2 backend, would be the absolutely best of course. In > fact, there's an answer on StackOverflow where a user posted his > QVTKWidget2 hacked to work with QOpenGLWidget [1], perhaps it could be used > as a starting point? > >>> > > >>> > > >>> > So just to throw this out there, here is the situation as I > understand it. Ben (cc'd) can correct what I get wrong since he was one of > the last to touch QVTKWidget2. > >>> > > >>> > QVTKWidget works fine with OpenGL2 if you are building against Qt4. > But when you build for Qt5 there are issues with creating the OpenGL > context and letting Qt know the context is there and so some features of > the OpenGL2 backend don't work right. > >>> > >>> Do you know which features and if this is being worked out? > >> > >> > >> I'm aware of some issues, and have looked briefly at Linux specific > issues. > >> For instance, QVTKWidget::x11_setup_window is disabled for Qt5 and > there has not been a replacement for that yet. > > > > > > Alright, good to know, thanks. > > > >> > >> > >> One possible workaround is to do something like the following in your > main() before the QApplication is constructed. > >> > >> QSurfaceFormat fmt; > >> > >> fmt.setDepthBufferSize(8); > >> > >> fmt.setSamples(1); > >> > >> fmt.setAlphaBufferSize(8); > >> > >> fmt.setStereo(1); > >> > >> fmt.setStencilBufferSize(8); > >> QSurfaceFormat::setDefaultFormat(fmt); > >> > >> > > > > Hm, but isn't QSurfaceFormat only about the context set up by the new > (or well, somewhat new) QOpenGLWidget? If you mean you are using a context > from QGLWidget (through QVTKWidget2), then shouldn't QGLFormat be used > instead? > > QSurfaceFormat is about creating a QWindow (this corresponds to an x11 > window created by xcb_create_window) that supports the requested features. > Setting the default surface format fixes what looked like a broken depth > buffer under some combinations of xserver settings and opengl drivers. > Getting a good QWindow is needed for QVTKWidget. > > That setup is in addition to setting a format for an opengl context. > Aha, thanks for clarifying. I had missed that QSurfaceFormat has this broader purpose. > > > >> > >> It does fix some issues I'm able to replicate with the OpenGL backend. > >> For OpenGL2 backend, and possibly applicable to any platform, perhaps > you could try adding a > >> > >> fmt.setMajorVersion(3); > >> > >> fmt.setMajorVersion(2); > > > > > > Yes, this is what I did (and also > fmt.setProfile(QSurfaceFormat.CompatibilityProfile) when experimenting with > trying to get a QOpenGLWidget-backed widget working from Python (? la > http://stackoverflow.com/questions/26944831/using-qvtkwidget-and-qopenglwidget-in-the-same-ui/26946040#26946040), > in order for VTK to accept the context. > > > >> > >> However, that may not be necessary because in the case of QVTKWidget, > VTK is creating OpenGL contexts, not Qt. > > > > > > Right, that's what I also found out when looking at the code. > > > >> > >> > >> I do not yet see a way for that information to be passed from > vtkRenderWindow to QVTKWidget and down to Qt after the QApplication has > been constructed. > > > > > > With "that information", do you mean information about what OpenGL > version the render needs? No I guess not, I guess you just have to target a > certain VTK version and use fixed numbers in the calls to > .setMajor/MinorVersion. > > > > But, like you say, with QVTKWidget, VTK is creating the OpenGL context, > so there's nothing to .setMajorMinor/Version on, or am I missing something? > > > >> > >> Anyway, perhaps these workarounds will help. > > > > > > I'm not sure, if QSurfaceFormat is only for QOpenGLWidget, I would have > to have a working QOpenGLWidget-based VTK widget first. But it was > interesting that you set the depth/alpha/stencil buffers as well, since I > only used it to set the number of samples when I experimented with > QOpenGLWidget. Perhaps I should give it a try again. > > > > In the implementation for QOpenGLWidget, they may extract a QSurfaceFormat > from the QGLFormat you give. So, it's possible It may not change anything. > Yea, I guess it might. > > In the end, I would still be very interested to hear if anyone knows > what would be the best backend + VTK widget to use given the hardware I > need to support. > > > > I don't have enough experience with some of those combinations to give a > suggestion. > Alright, I guess the best thing is to just try. > My hope with the QSurfaceFormat suggestion is to give you a better working > Qt5 + QVTKWidget + OpenGL/OpenGL2 combination due to a bit of un-ported > code. > Yep, thanks a lot, I'll have to do some tests. Elvis > Clint > -------------- next part -------------- An HTML attachment was scrubbed... URL: From enzo.matsumiya at gmail.com Thu Jun 30 09:25:24 2016 From: enzo.matsumiya at gmail.com (Enzo Matsumiya) Date: Thu, 30 Jun 2016 10:25:24 -0300 Subject: [vtkusers] Custom cursor shapes In-Reply-To: <1467271001238-5739006.post@n5.nabble.com> References: <91D8CC7A-821C-4A5E-9519-97A8A3611E45@gmail.com> <1467271001238-5739006.post@n5.nabble.com> Message-ID: David, I am using Qt. Daniel, what type is your myVTKPanel? I have my visualization stack as a separate dynamic library. When I set the cursor on the application's mainwindow, it works fine, but the cursor will be the one I chose in every portion of the app. I tried setting the cursor to my QVTKWidget (within my library) to create the "mouse over" feeling which, I think, should activate such cursor only when within its bounds. But it didn't work. Now I don't know if I should take it to Qt's side or if it's indeed within VTK. Thanks! > On Jun 30, 2016, at 04:16, -Daniel- wrote: > > Hi Enzo, > > I'm using Java, where I added my own cursor as follows: > Cursor c = Toolkit.getDefaultToolkit().createCustomCursor( > CursorImageAsGIF, new Point(10,10), "Cursorname" ); > myVTKPanel.setCursor(c); > > Maybe it helps you... > > > > > -- > View this message in context: http://vtk.1045678.n5.nabble.com/Custom-cursor-shapes-tp5738967p5739006.html > Sent from the VTK - Users mailing list archive at Nabble.com. > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.gobbi at gmail.com Thu Jun 30 09:59:56 2016 From: david.gobbi at gmail.com (David Gobbi) Date: Thu, 30 Jun 2016 07:59:56 -0600 Subject: [vtkusers] Custom cursor shapes In-Reply-To: References: <91D8CC7A-821C-4A5E-9519-97A8A3611E45@gmail.com> <1467271001238-5739006.post@n5.nabble.com> Message-ID: On Thu, Jun 30, 2016 at 7:25 AM, Enzo Matsumiya wrote: > > Now I don't know if I should take it to Qt's side or if it's indeed within > VTK. > I've done it by simply calling setCursor() on the widget. You will have to disable any VTK code that you used to use for setting the cursor. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From enzo.matsumiya at gmail.com Thu Jun 30 10:16:00 2016 From: enzo.matsumiya at gmail.com (Enzo Matsumiya) Date: Thu, 30 Jun 2016 11:16:00 -0300 Subject: [vtkusers] Custom cursor shapes In-Reply-To: References: <91D8CC7A-821C-4A5E-9519-97A8A3611E45@gmail.com> <1467271001238-5739006.post@n5.nabble.com> Message-ID: <01785DB4-99CF-4E9B-93BF-7F05282F9F25@gmail.com> That didn't work. The only code I modified was vtkResliceCursorWidget::SetCursor() to act according to my needs. I don't have any other direct calls to RequestCursorShape(). Now I commented the whole method body and widget's setCursor() still didn't work. > On Jun 30, 2016, at 10:59, David Gobbi wrote: > > On Thu, Jun 30, 2016 at 7:25 AM, Enzo Matsumiya > wrote: > > Now I don't know if I should take it to Qt's side or if it's indeed within VTK. > > I've done it by simply calling setCursor() on the widget. You will have to disable any VTK code that you used to use for setting the cursor. > > - David -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi.charrier at gmail.com Thu Jun 30 11:32:23 2016 From: remi.charrier at gmail.com (Remi Charrier) Date: Thu, 30 Jun 2016 17:32:23 +0200 Subject: [vtkusers] Which Vtk Module to build to have access to "vtkButterflySubdivisionFilter.h" , "vtkLoopSubdivisionFilter.h" and "vtkLinearSubdivisionFilter.h" Message-ID: Hi, I would like to try the following filters: "vtkButterflySubdivisionFilter.h" "vtkLoopSubdivisionFilter.h" "vtkLinearSubdivisionFilter.h" in order to increase the number of cells in my 3D models. I have the source files but they didn't compile as I probably did not include them in the CMake process. However I still don't understand where to find to which vtkmodule a specific file is linked. I thought it was based on the folders name but in this case, the path is : VTK-7.0.0\Filters\Modeling in the cmakelist.txt of this folder I find that it may be associated with vtkFiltersModeling But I don't have this module or entry in the Cmake window. Any help would be welcome. Thanks in advance R?mi -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcus.hanwell at kitware.com Thu Jun 30 11:33:06 2016 From: marcus.hanwell at kitware.com (Marcus D. Hanwell) Date: Thu, 30 Jun 2016 11:33:06 -0400 Subject: [vtkusers] About Pitfalls section in smart pointers tutorial In-Reply-To: References: Message-ID: On Thu, Jun 30, 2016 at 3:02 AM, Elvis Stansvik wrote: > 2016-06-29 21:42 GMT+02:00 Marcus D. Hanwell : >> >> On Wed, Jun 29, 2016 at 3:28 PM, Elvis Stansvik >> wrote: >> > At >> > >> > http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers#Pitfalls >> > >> > is this warning: >> > >> > "If you create an object and then change where it is pointing, the >> > reference >> > count will be incorrect. e.g. >> > >> > vtkSmartPointer Polydata = >> > vtkSmartPointer::New(); >> > Polydata = Reader->GetOutput(); >> > >> > In this case, memory is allocated for Polydata, but then we change >> > Polydata >> > to point to the output of Reader rather than the memory we just >> > allocated. >> > Instead, we should have done simply: >> > >> > vtkPolyData* Polydata = Reader->GetOutput(); >> > >> > It was not necessary to use a smart pointer because we did not actually >> > create any new objects" >> > >> > I fail to see how the refcount would be incorrect in the first approach. >> > First a new object is created and its refcount increased to 1, then when >> > Reader->GetOutput() (a raw pointer) is assigned to Polydata, wouldn't >> > the >> > smart pointer take care of decreasing the refcount for the object it >> > already >> > points to (so it would go to 0), before it starts managing the new >> > pointer? >> > Or is that not how it will work? >> > >> I have the same interpretation, it looks like it was added by David >> Doria in 2009. It is silly to allocate a new object, and then >> immediately point to something else without ever using that object, >> but the reference count for that object should be correctly >> decremented and so deleted as far as I can see. > > > Yes, I forgot to say: I of course also think it's silly, I was just curious > about the wording of that warning since it didn't make sense to me. > I removed the section from the wiki article, it would be better to balance it with the other smart pointer types too possibly. All vtkObject derived classes are implicitly reference counted for better or worse, so the behavior is different to the STL smart pointers. They interact with the objects reference count, I am a little biased as I wrote it, but https://blog.kitware.com/a-tour-of-vtk-pointer-classes/ (linked at the top of that wiki page) provides a broad overview of the different smart pointers and when/where they might be used. From bill.lorensen at gmail.com Thu Jun 30 11:40:32 2016 From: bill.lorensen at gmail.com (Bill Lorensen) Date: Thu, 30 Jun 2016 11:40:32 -0400 Subject: [vtkusers] Which Vtk Module to build to have access to "vtkButterflySubdivisionFilter.h" , "vtkLoopSubdivisionFilter.h" and "vtkLinearSubdivisionFilter.h" In-Reply-To: References: Message-ID: Please post your CMakeLists.txt file for your project. On Thu, Jun 30, 2016 at 11:32 AM, Remi Charrier wrote: > Hi, > > I would like to try the following filters: > "vtkButterflySubdivisionFilter.h" > "vtkLoopSubdivisionFilter.h" > "vtkLinearSubdivisionFilter.h" > in order to increase the number of cells in my 3D models. > > I have the source files but they didn't compile as I probably did not > include them in the CMake process. However I still don't understand where to > find to which vtkmodule a specific file is linked. I thought it was based on > the folders name but in this case, the path is : > VTK-7.0.0\Filters\Modeling > in the cmakelist.txt of this folder I find that it may be associated with > vtkFiltersModeling > But I don't have this module or entry in the Cmake window. > Any help would be welcome. > Thanks in advance > R?mi > > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=vtkusers > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/vtkusers > -- Unpaid intern in BillsBasement at noware dot com From elvis.stansvik at orexplore.com Thu Jun 30 12:09:29 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 18:09:29 +0200 Subject: [vtkusers] About Pitfalls section in smart pointers tutorial In-Reply-To: References: Message-ID: 2016-06-30 17:33 GMT+02:00 Marcus D. Hanwell : > On Thu, Jun 30, 2016 at 3:02 AM, Elvis Stansvik > wrote: > > 2016-06-29 21:42 GMT+02:00 Marcus D. Hanwell >: > >> > >> On Wed, Jun 29, 2016 at 3:28 PM, Elvis Stansvik > >> wrote: > >> > At > >> > > >> > http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers#Pitfalls > >> > > >> > is this warning: > >> > > >> > "If you create an object and then change where it is pointing, the > >> > reference > >> > count will be incorrect. e.g. > >> > > >> > vtkSmartPointer Polydata = > >> > vtkSmartPointer::New(); > >> > Polydata = Reader->GetOutput(); > >> > > >> > In this case, memory is allocated for Polydata, but then we change > >> > Polydata > >> > to point to the output of Reader rather than the memory we just > >> > allocated. > >> > Instead, we should have done simply: > >> > > >> > vtkPolyData* Polydata = Reader->GetOutput(); > >> > > >> > It was not necessary to use a smart pointer because we did not > actually > >> > create any new objects" > >> > > >> > I fail to see how the refcount would be incorrect in the first > approach. > >> > First a new object is created and its refcount increased to 1, then > when > >> > Reader->GetOutput() (a raw pointer) is assigned to Polydata, wouldn't > >> > the > >> > smart pointer take care of decreasing the refcount for the object it > >> > already > >> > points to (so it would go to 0), before it starts managing the new > >> > pointer? > >> > Or is that not how it will work? > >> > > >> I have the same interpretation, it looks like it was added by David > >> Doria in 2009. It is silly to allocate a new object, and then > >> immediately point to something else without ever using that object, > >> but the reference count for that object should be correctly > >> decremented and so deleted as far as I can see. > > > > > > Yes, I forgot to say: I of course also think it's silly, I was just > curious > > about the wording of that warning since it didn't make sense to me. > > > I removed the section from the wiki article, it would be better to > balance it with the other smart pointer types too possibly. All > vtkObject derived classes are implicitly reference counted for better > or worse, so the behavior is different to the STL smart pointers. > > They interact with the objects reference count, I am a little biased > as I wrote it, but > https://blog.kitware.com/a-tour-of-vtk-pointer-classes/ (linked at the > top of that wiki page) provides a broad overview of the different > smart pointers and when/where they might be used. > Yep, I read that before I came across the tutorial page in the wiki actually. It was very good. Elvis -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 30 14:11:45 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 20:11:45 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: <0583b421-6015-40fd-9f94-0710bb69c221@email.android.com> Message-ID: 2016-06-30 15:05 GMT+02:00 Elvis Stansvik : > 2016-06-30 14:31 GMT+02:00 : > >> >> On Jun 30, 2016 1:19 AM, Elvis Stansvik >> wrote: >> > >> > 2016-06-29 22:52 GMT+02:00 : >> >> >> >> >> >> >> >> ----- On Jun 29, 2016, at 10:45 AM, Elvis Stansvik < >> elvis.stansvik at orexplore.com> wrote: >> >>> >> >>> >> >>> Den 29 juni 2016 6:07 em skrev "Shawn Waldon" < >> shawn.waldon at kitware.com>: >> >>> >> >> >>> >> >> >>> >> I see, I may have misunderstood the role of QVTKWidget2 is vs >> QVTKWidget. I thought QVTKWidget2 was essentially a newer replacement for >> QVTKWidget, and to be preferred in new code. >> >>> >> >> >>> >> I've also misunderstood a little how the two widgets work. I knew >> QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying >> to make a similar Python class just recently, which uses QOpenGLWidget, but >> ran into some problems). But I also wrongly thought that QVTKWidget used >> QGLWidget, looking at the code I see now that it doesn't. >> >>> >> >> >>> >> So in short: I have no great need for QVTKWidget2, >> functionality-wise. So if using it precludes using the OpenGL2 backend, >> I'll use QVTKWidget instead. >> >>> >> >> >>> >> One thing I did like was that the code in QVTKWidget2 looked a >> little simpler/cleaner than the one QVTKWidget. It's always nice to be able >> to quickly check how something work. >> >>> >> >> >>> >> An officially supported widget, based on QOpenGLWidget and >> supporting the OpenGL2 backend, would be the absolutely best of course. In >> fact, there's an answer on StackOverflow where a user posted his >> QVTKWidget2 hacked to work with QOpenGLWidget [1], perhaps it could be used >> as a starting point? >> >>> > >> >>> > >> >>> > So just to throw this out there, here is the situation as I >> understand it. Ben (cc'd) can correct what I get wrong since he was one of >> the last to touch QVTKWidget2. >> >>> > >> >>> > QVTKWidget works fine with OpenGL2 if you are building against >> Qt4. But when you build for Qt5 there are issues with creating the OpenGL >> context and letting Qt know the context is there and so some features of >> the OpenGL2 backend don't work right. >> >>> >> >>> Do you know which features and if this is being worked out? >> >> >> >> >> >> I'm aware of some issues, and have looked briefly at Linux specific >> issues. >> >> For instance, QVTKWidget::x11_setup_window is disabled for Qt5 and >> there has not been a replacement for that yet. >> > >> > >> > Alright, good to know, thanks. >> > >> >> >> >> >> >> One possible workaround is to do something like the following in your >> main() before the QApplication is constructed. >> >> >> > Here's my experience with these flags after testing a little with QVTKWidget + Qt5 + OpenGL2 backend: > >> QSurfaceFormat fmt; >> >> >> >> fmt.setDepthBufferSize(8); >> > I haven't found a need for this one yet. > >> >> >> fmt.setSamples(1); >> > This one I changed to 8, to get anti-aliased output. But it's nice to know that I now have a place to control it. > >> >> >> fmt.setAlphaBufferSize(8); >> > Haven't found a need for this one yet either. > >> >> >> fmt.setStereo(1); >> > I don't have a need for stereo rendering I think, and on my old Sandybridge (HD 3000 graphics) laptop at work I got a segfault when winId was called by QVTKWidget to configure the render window: (gdb) bt #0 0x00007fffb9436119 in ?? () from /usr/lib/qt/plugins/xcbglintegrations/libqxcb-glx-integration.so #1 0x00007fffbba09726 in QXcbWindow::create() () from /usr/lib/libQt5XcbQpa.so.5 #2 0x00007fffbb9f5da0 in QXcbIntegration::createPlatformWindow(QWindow*) const () from /usr/lib/libQt5XcbQpa.so.5 #3 0x00007fffe53c6d39 in QWindowPrivate::create(bool) () from /usr/lib/libQt5Gui.so.5 #4 0x00007fffe5b89ba3 in QWidgetPrivate::create_sys(unsigned long long, bool, bool) () from /usr/lib/libQt5Widgets.so.5 #5 0x00007fffe5b893ad in QWidget::create(unsigned long long, bool, bool) () from /usr/lib/libQt5Widgets.so.5 #6 0x00007fffe5b897ac in QWidgetPrivate::createWinId() () from /usr/lib/libQt5Widgets.so.5 #7 0x00007fffe5b89819 in QWidget::winId() const () from /usr/lib/libQt5Widgets.so.5 #8 0x00007fffe5b899a8 in ?? () from /usr/lib/libQt5Widgets.so.5 #9 0x00007fffe5b89bf8 in QWidgetPrivate::create_sys(unsigned long long, bool, bool) () from /usr/lib/libQt5Widgets.so.5 #10 0x00007fffe5b893ad in QWidget::create(unsigned long long, bool, bool) () from /usr/lib/libQt5Widgets.so.5 #11 0x00007fffe5b897ac in QWidgetPrivate::createWinId() () from /usr/lib/libQt5Widgets.so.5 #12 0x00007fffe5b89819 in QWidget::winId() const () from /usr/lib/libQt5Widgets.so.5 #13 0x00007fffe5b899a8 in ?? () from /usr/lib/libQt5Widgets.so.5 #14 0x00007fffe5b89bf8 in QWidgetPrivate::create_sys(unsigned long long, bool, bool) () from /usr/lib/libQt5Widgets.so.5 #15 0x00007fffe5b893ad in QWidget::create(unsigned long long, bool, bool) () from /usr/lib/libQt5Widgets.so.5 #16 0x00007fffe5b896c8 in QWidgetPrivate::createWinId() () from /usr/lib/libQt5Widgets.so.5 #17 0x00007fffe5b896c8 in QWidgetPrivate::createWinId() () from /usr/lib/libQt5Widgets.so.5 #18 0x00007fffe5b89819 in QWidget::winId() const () from /usr/lib/libQt5Widgets.so.5 #19 0x00007fffe64b958b in QVTKWidget::SetRenderWindow(vtkRenderWindow*) () from /usr/lib/libvtkGUISupportQt.so.1 #20 0x00007fffe64b87e0 in QVTKWidget::GetRenderWindow() () from /usr/lib/libvtkGUISupportQt.so.1 #21 0x00000000004069f9 in SampleWidget::SampleWidget(QWidget*, QFlags) () #22 0x0000000000406040 in Ui_MainWindow::setupUi(QMainWindow*) () #23 0x00000000004058f9 in MainWindow::MainWindow(QWidget*) () #24 0x000000000040569f in main () (gdb) On my newer Haswell (HD 4400) laptop at work it worked without problems. I don't know if this is a Qt bug, or just a limitation of the weak graphics in my home laptop, or something else. > >> >> >> fmt.setStencilBufferSize(8); >> > This one indeed made a difference, because without it I got weird rendering with the poly cylinder I was testing with: It was as if you could see "into" the cylinder. I also noticed I could do auto window = windowHandle(); if (window) { QSurfaceFormat surfaceFormat = window->format(); surfaceFormat.setDepthBufferSize(8); surfaceFormat.setSamples(8); surfaceFormat.setAlphaBufferSize(8); surfaceFormat.setStencilBufferSize(8); surfaceFormat.setStereo(1); window->setFormat(surfaceFormat); } else { qWarning("Can't set surface format: No associated QWindow"); } in the constructor of my QVTKWidget base class, instead of setting the default surface format before the QApplication is constructed. Elvis >> QSurfaceFormat::setDefaultFormat(fmt); >> >> >> >> >> > >> > Hm, but isn't QSurfaceFormat only about the context set up by the new >> (or well, somewhat new) QOpenGLWidget? If you mean you are using a context >> from QGLWidget (through QVTKWidget2), then shouldn't QGLFormat be used >> instead? >> >> QSurfaceFormat is about creating a QWindow (this corresponds to an x11 >> window created by xcb_create_window) that supports the requested features. >> Setting the default surface format fixes what looked like a broken depth >> buffer under some combinations of xserver settings and opengl drivers. >> Getting a good QWindow is needed for QVTKWidget. >> >> That setup is in addition to setting a format for an opengl context. >> > Aha, thanks for clarifying. I had missed that QSurfaceFormat has this > broader purpose. > >> > >> >> >> >> It does fix some issues I'm able to replicate with the OpenGL backend. >> >> For OpenGL2 backend, and possibly applicable to any platform, perhaps >> you could try adding a >> >> >> >> fmt.setMajorVersion(3); >> >> >> >> fmt.setMajorVersion(2); >> > >> > >> > Yes, this is what I did (and also >> fmt.setProfile(QSurfaceFormat.CompatibilityProfile) when experimenting with >> trying to get a QOpenGLWidget-backed widget working from Python (? la >> http://stackoverflow.com/questions/26944831/using-qvtkwidget-and-qopenglwidget-in-the-same-ui/26946040#26946040), >> in order for VTK to accept the context. >> > >> >> >> >> However, that may not be necessary because in the case of QVTKWidget, >> VTK is creating OpenGL contexts, not Qt. >> > >> > >> > Right, that's what I also found out when looking at the code. >> > >> >> >> >> >> >> I do not yet see a way for that information to be passed from >> vtkRenderWindow to QVTKWidget and down to Qt after the QApplication has >> been constructed. >> > >> > >> > With "that information", do you mean information about what OpenGL >> version the render needs? No I guess not, I guess you just have to target a >> certain VTK version and use fixed numbers in the calls to >> .setMajor/MinorVersion. >> > >> > But, like you say, with QVTKWidget, VTK is creating the OpenGL context, >> so there's nothing to .setMajorMinor/Version on, or am I missing something? >> > >> >> >> >> Anyway, perhaps these workarounds will help. >> > >> > >> > I'm not sure, if QSurfaceFormat is only for QOpenGLWidget, I would have >> to have a working QOpenGLWidget-based VTK widget first. But it was >> interesting that you set the depth/alpha/stencil buffers as well, since I >> only used it to set the number of samples when I experimented with >> QOpenGLWidget. Perhaps I should give it a try again. >> > >> >> In the implementation for QOpenGLWidget, they may extract a >> QSurfaceFormat from the QGLFormat you give. So, it's possible It may not >> change anything. >> > Yea, I guess it might. > >> > In the end, I would still be very interested to hear if anyone knows >> what would be the best backend + VTK widget to use given the hardware I >> need to support. >> > >> >> I don't have enough experience with some of those combinations to give a >> suggestion. >> > Alright, I guess the best thing is to just try. > >> My hope with the QSurfaceFormat suggestion is to give you a better >> working Qt5 + QVTKWidget + OpenGL/OpenGL2 combination due to a bit of >> un-ported code. >> > Yep, thanks a lot, I'll have to do some tests. > > Elvis > > >> Clint >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Thu Jun 30 14:15:19 2016 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Thu, 30 Jun 2016 20:15:19 +0200 Subject: [vtkusers] Find reason for exclusion of vtkGUISupportQtOpenGL in build output? In-Reply-To: References: <0583b421-6015-40fd-9f94-0710bb69c221@email.android.com> Message-ID: 2016-06-30 20:11 GMT+02:00 Elvis Stansvik : > 2016-06-30 15:05 GMT+02:00 Elvis Stansvik : > >> 2016-06-30 14:31 GMT+02:00 : >> >>> >>> On Jun 30, 2016 1:19 AM, Elvis Stansvik >>> wrote: >>> > >>> > 2016-06-29 22:52 GMT+02:00 : >>> >> >>> >> >>> >> >>> >> ----- On Jun 29, 2016, at 10:45 AM, Elvis Stansvik < >>> elvis.stansvik at orexplore.com> wrote: >>> >>> >>> >>> >>> >>> Den 29 juni 2016 6:07 em skrev "Shawn Waldon" < >>> shawn.waldon at kitware.com>: >>> >>> >> >>> >>> >> >>> >>> >> I see, I may have misunderstood the role of QVTKWidget2 is vs >>> QVTKWidget. I thought QVTKWidget2 was essentially a newer replacement for >>> QVTKWidget, and to be preferred in new code. >>> >>> >> >>> >>> >> I've also misunderstood a little how the two widgets work. I knew >>> QVTKWidget2 makes use of the deprecated QGLWidget (and was in fact trying >>> to make a similar Python class just recently, which uses QOpenGLWidget, but >>> ran into some problems). But I also wrongly thought that QVTKWidget used >>> QGLWidget, looking at the code I see now that it doesn't. >>> >>> >> >>> >>> >> So in short: I have no great need for QVTKWidget2, >>> functionality-wise. So if using it precludes using the OpenGL2 backend, >>> I'll use QVTKWidget instead. >>> >>> >> >>> >>> >> One thing I did like was that the code in QVTKWidget2 looked a >>> little simpler/cleaner than the one QVTKWidget. It's always nice to be able >>> to quickly check how something work. >>> >>> >> >>> >>> >> An officially supported widget, based on QOpenGLWidget and >>> supporting the OpenGL2 backend, would be the absolutely best of course. In >>> fact, there's an answer on StackOverflow where a user posted his >>> QVTKWidget2 hacked to work with QOpenGLWidget [1], perhaps it could be used >>> as a starting point? >>> >>> > >>> >>> > >>> >>> > So just to throw this out there, here is the situation as I >>> understand it. Ben (cc'd) can correct what I get wrong since he was one of >>> the last to touch QVTKWidget2. >>> >>> > >>> >>> > QVTKWidget works fine with OpenGL2 if you are building against >>> Qt4. But when you build for Qt5 there are issues with creating the OpenGL >>> context and letting Qt know the context is there and so some features of >>> the OpenGL2 backend don't work right. >>> >>> >>> >>> Do you know which features and if this is being worked out? >>> >> >>> >> >>> >> I'm aware of some issues, and have looked briefly at Linux specific >>> issues. >>> >> For instance, QVTKWidget::x11_setup_window is disabled for Qt5 and >>> there has not been a replacement for that yet. >>> > >>> > >>> > Alright, good to know, thanks. >>> > >>> >> >>> >> >>> >> One possible workaround is to do something like the following in your >>> main() before the QApplication is constructed. >>> >> >>> >> > Here's my experience with these flags after testing a little with > QVTKWidget + Qt5 + OpenGL2 backend: > >> >> QSurfaceFormat fmt; >>> >> >>> >> fmt.setDepthBufferSize(8); >>> >> I haven't found a need for this one yet. > >> >> >>> >> fmt.setSamples(1); >>> >> This one I changed to 8, to get anti-aliased output. But it's nice to > know that I now have a place to control it. > >> >> >>> >> fmt.setAlphaBufferSize(8); >>> >> Haven't found a need for this one yet either. > >> >> >>> >> fmt.setStereo(1); >>> >> I don't have a need for stereo rendering I think, and on my old > Sandybridge (HD 3000 graphics) laptop at work I got a segfault when winId > was called by QVTKWidget to configure the render window: > Sorry I should have been clearer: I got the below segfault when I ran with setStereo(1). Elvis > (gdb) bt > #0 0x00007fffb9436119 in ?? () from > /usr/lib/qt/plugins/xcbglintegrations/libqxcb-glx-integration.so > #1 0x00007fffbba09726 in QXcbWindow::create() () from > /usr/lib/libQt5XcbQpa.so.5 > #2 0x00007fffbb9f5da0 in QXcbIntegration::createPlatformWindow(QWindow*) > const () from /usr/lib/libQt5XcbQpa.so.5 > #3 0x00007fffe53c6d39 in QWindowPrivate::create(bool) () from > /usr/lib/libQt5Gui.so.5 > #4 0x00007fffe5b89ba3 in QWidgetPrivate::create_sys(unsigned long long, > bool, bool) () from /usr/lib/libQt5Widgets.so.5 > #5 0x00007fffe5b893ad in QWidget::create(unsigned long long, bool, bool) > () from /usr/lib/libQt5Widgets.so.5 > #6 0x00007fffe5b897ac in QWidgetPrivate::createWinId() () from > /usr/lib/libQt5Widgets.so.5 > #7 0x00007fffe5b89819 in QWidget::winId() const () from > /usr/lib/libQt5Widgets.so.5 > #8 0x00007fffe5b899a8 in ?? () from /usr/lib/libQt5Widgets.so.5 > #9 0x00007fffe5b89bf8 in QWidgetPrivate::create_sys(unsigned long long, > bool, bool) () from /usr/lib/libQt5Widgets.so.5 > #10 0x00007fffe5b893ad in QWidget::create(unsigned long long, bool, bool) > () from /usr/lib/libQt5Widgets.so.5 > #11 0x00007fffe5b897ac in QWidgetPrivate::createWinId() () from > /usr/lib/libQt5Widgets.so.5 > #12 0x00007fffe5b89819 in QWidget::winId() const () from > /usr/lib/libQt5Widgets.so.5 > #13 0x00007fffe5b899a8 in ?? () from /usr/lib/libQt5Widgets.so.5 > #14 0x00007fffe5b89bf8 in QWidgetPrivate::create_sys(unsigned long long, > bool, bool) () from /usr/lib/libQt5Widgets.so.5 > #15 0x00007fffe5b893ad in QWidget::create(unsigned long long, bool, bool) > () from /usr/lib/libQt5Widgets.so.5 > #16 0x00007fffe5b896c8 in QWidgetPrivate::createWinId() () from > /usr/lib/libQt5Widgets.so.5 > #17 0x00007fffe5b896c8 in QWidgetPrivate::createWinId() () from > /usr/lib/libQt5Widgets.so.5 > #18 0x00007fffe5b89819 in QWidget::winId() const () from > /usr/lib/libQt5Widgets.so.5 > #19 0x00007fffe64b958b in QVTKWidget::SetRenderWindow(vtkRenderWindow*) () > from /usr/lib/libvtkGUISupportQt.so.1 > #20 0x00007fffe64b87e0 in QVTKWidget::GetRenderWindow() () from > /usr/lib/libvtkGUISupportQt.so.1 > #21 0x00000000004069f9 in SampleWidget::SampleWidget(QWidget*, > QFlags) () > #22 0x0000000000406040 in Ui_MainWindow::setupUi(QMainWindow*) () > #23 0x00000000004058f9 in MainWindow::MainWindow(QWidget*) () > #24 0x000000000040569f in main () > (gdb) > > On my newer Haswell (HD 4400) laptop at work it worked without problems. I > don't know if this is a Qt bug, or just a limitation of the weak graphics > in my home laptop, or something else. > >> >> >>> >> fmt.setStencilBufferSize(8); >>> >> This one indeed made a difference, because without it I got weird > rendering with the poly cylinder I was testing with: It was as if you could > see "into" the cylinder. > > I also noticed I could do > > auto window = windowHandle(); > > if (window) { > QSurfaceFormat surfaceFormat = window->format(); > surfaceFormat.setDepthBufferSize(8); > surfaceFormat.setSamples(8); > surfaceFormat.setAlphaBufferSize(8); > surfaceFormat.setStencilBufferSize(8); > surfaceFormat.setStereo(1); > window->setFormat(surfaceFormat); > } else { > qWarning("Can't set surface format: No associated QWindow"); > } > > in the constructor of my QVTKWidget base class, instead of setting the > default surface format before the QApplication is constructed. > > Elvis > > >> QSurfaceFormat::setDefaultFormat(fmt); >>> >> >>> >> >>> > >>> > Hm, but isn't QSurfaceFormat only about the context set up by the new >>> (or well, somewhat new) QOpenGLWidget? If you mean you are using a context >>> from QGLWidget (through QVTKWidget2), then shouldn't QGLFormat be used >>> instead? >>> >>> QSurfaceFormat is about creating a QWindow (this corresponds to an x11 >>> window created by xcb_create_window) that supports the requested features. >>> Setting the default surface format fixes what looked like a broken depth >>> buffer under some combinations of xserver settings and opengl drivers. >>> Getting a good QWindow is needed for QVTKWidget. >>> >>> That setup is in addition to setting a format for an opengl context. >>> >> Aha, thanks for clarifying. I had missed that QSurfaceFormat has this >> broader purpose. >> >>> > >>> >> >>> >> It does fix some issues I'm able to replicate with the OpenGL backend. >>> >> For OpenGL2 backend, and possibly applicable to any platform, perhaps >>> you could try adding a >>> >> >>> >> fmt.setMajorVersion(3); >>> >> >>> >> fmt.setMajorVersion(2); >>> > >>> > >>> > Yes, this is what I did (and also >>> fmt.setProfile(QSurfaceFormat.CompatibilityProfile) when experimenting with >>> trying to get a QOpenGLWidget-backed widget working from Python (? la >>> http://stackoverflow.com/questions/26944831/using-qvtkwidget-and-qopenglwidget-in-the-same-ui/26946040#26946040), >>> in order for VTK to accept the context. >>> > >>> >> >>> >> However, that may not be necessary because in the case of QVTKWidget, >>> VTK is creating OpenGL contexts, not Qt. >>> > >>> > >>> > Right, that's what I also found out when looking at the code. >>> > >>> >> >>> >> >>> >> I do not yet see a way for that information to be passed from >>> vtkRenderWindow to QVTKWidget and down to Qt after the QApplication has >>> been constructed. >>> > >>> > >>> > With "that information", do you mean information about what OpenGL >>> version the render needs? No I guess not, I guess you just have to target a >>> certain VTK version and use fixed numbers in the calls to >>> .setMajor/MinorVersion. >>> > >>> > But, like you say, with QVTKWidget, VTK is creating the OpenGL >>> context, so there's nothing to .setMajorMinor/Version on, or am I missing >>> something? >>> > >>> >> >>> >> Anyway, perhaps these workarounds will help. >>> > >>> > >>> > I'm not sure, if QSurfaceFormat is only for QOpenGLWidget, I would >>> have to have a working QOpenGLWidget-based VTK widget first. But it was >>> interesting that you set the depth/alpha/stencil buffers as well, since I >>> only used it to set the number of samples when I experimented with >>> QOpenGLWidget. Perhaps I should give it a try again. >>> > >>> >>> In the implementation for QOpenGLWidget, they may extract a >>> QSurfaceFormat from the QGLFormat you give. So, it's possible It may not >>> change anything. >>> >> Yea, I guess it might. >> >>> > In the end, I would still be very interested to hear if anyone knows >>> what would be the best backend + VTK widget to use given the hardware I >>> need to support. >>> > >>> >>> I don't have enough experience with some of those combinations to give a >>> suggestion. >>> >> Alright, I guess the best thing is to just try. >> >>> My hope with the QSurfaceFormat suggestion is to give you a better >>> working Qt5 + QVTKWidget + OpenGL/OpenGL2 combination due to a bit of >>> un-ported code. >>> >> Yep, thanks a lot, I'll have to do some tests. >> >> Elvis >> >> >>> Clint >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaumetauzin.ut at gmail.com Thu Jun 30 19:52:38 2016 From: guillaumetauzin.ut at gmail.com (Guillaume Tauzin) Date: Fri, 1 Jul 2016 01:52:38 +0200 Subject: [vtkusers] Proper use of vtkXMLPRectilinearGGridWriter with MPI Message-ID: /Hi, I am working on a C++ CFD parallel code on HPC architecture for vizualization with Paraview and I would like to use the vtk C++ library along with MPI. I have been trying to use the vtkXMLPRectilinearGridWriter without any success so far. I encountered the following problems: - The extent of the piece in the .pvtr file and of each .vtr file is wrong - When I correct the extents manually, I cannot open it in paraview as it seems it cannot properly represent the boundaries between each piece. Below is a small test code: Please note that locatl dimension dimX_l = dimX_g / mpi_size and dimY_l, dimZ_l = dimY_g, dimZ_g (1D domain partitioning) void writePVTR(const int mpi_rank, const int mpi_size, std::string& fileName, vtkSmartPointer scalarArray) { int startX = mpi_rank * dimX_l; std::cout << startX << std::endl; vtkSmartPointer rectilinearGrid = vtkSmartPointer::New(); rectilinearGrid->SetDimensions(dimX_l, dimY_l, dimZ_l); rectilinearGrid->SetExtent(startX, startX+dimX_l-1, 0, dimY_l-1, 0, dimZ_l-1); rectilinearGrid->GetPointData()->AddArray(scalarArray); vtkSmartPointer xArray = vtkSmartPointer::New(); xArray->SetName("X"); for(unsigned int iX = startX; iX < startX+dimX_l; ++iX) { xArray->InsertNextValue(iX); } rectilinearGrid->SetXCoordinates(xArray); vtkSmartPointer yArray = vtkSmartPointer::New(); yArray->SetName("Y"); for(unsigned int iY = 0; iY < dimY_l; ++iY) { yArray->InsertNextValue(iY); } rectilinearGrid->SetYCoordinates(yArray); vtkSmartPointer zArray = vtkSmartPointer::New(); zArray->SetName("Z"); for(unsigned int iZ = 0; iZ < dimZ_l; ++iZ) { zArray->InsertNextValue(iZ); } rectilinearGrid->SetZCoordinates(zArray); std::string parallel_fileName = fileName + ".pvtr"; vtkSmartPointer pwriter = vtkSmartPointer::New(); pwriter->SetNumberOfPieces(mpi_size); pwriter->SetStartPiece(0); pwriter->SetEndPiece(mpi_size-1); pwriter->SetFileName(parallel_fileName.c_str()); pwriter->SetInputData(rectilinearGrid); pwriter->Write(); } Does anyone have insights on how to use vtkXMLPRectilinearGridWriter with MPI properly? If anyone has any working example and would like to share, that would be greatly appreciated Thank you for your help, Guillaume -- - Guillaume -------------- next part -------------- An HTML attachment was scrubbed... URL: