View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004462 | Slicer4 | Core: Scripting (Wrapping, Python) | public | 2017-10-19 11:38 | 2018-04-18 09:27 |
Reporter | pinter | Assigned To | jcfr | ||
Priority | high | Severity | block | Reproducibility | always |
Status | closed | Resolution | reopened | ||
Product Version | Slicer 4.9.0 | ||||
Target Version | Slicer 4.11.0 | Fixed in Version | Slicer 4.9.0 | ||
Summary | 0004462: Python wrapping of VTK classes in extensions does not work properly | ||||
Description | The VTK classes don’t seem to be recognized as their proper class, similarly to the vtkSegmentationCore classes without importing the python module, but this time even when I import it specifically the type is wrong (which means that their methods cannot be called):
| ||||
Steps To Reproduce | In SlicerRT:
| ||||
Tags | No tags attached. | ||||
Hi Jc, do you have any news regarding this? do we have to update the extensions in some ways or it will be handled by the wrapping macro? |
|
I'm happy to look into it if I know where to look. |
|
I guess should be related to this: https://www.slicer.org/wiki/Documentation/Labs/Qt5-and-VTK8#VTK8:_Use_hierarchy_files_for_VTK_Python_wrapping |
|
Thanks, Davide, I'll take a closer look at these hierarchy files. When I read this page, it seems I conveniently skipped through this section and thought the type macros should cut it... |
|
Hi, Hierarchy files should also be generated within extensions. See [1] I don't know what is happening yet, my understanding was that after the fix of Andras (see r26418 [2]) we were in good shape. [2] See viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26418 |
|
The hierarchy fines are indeed generated. In Slicer-build I found the SlicerRT hierarchy files, for example vtkSlicerDicomRtImportExportModuleLogicHierarchy.txt. It is very big and contains more than 4000 classes, but the classes that I mention in the issue description are there as well: vtkSlicerDicomRtImportExportModuleLogic : vtkSlicerModuleLogic ; vtkSlicerDicomRtImportExportModuleLogic.h ; vtkSlicerDicomRtImportExportModuleLogic The class however is still not recognized. I'm on a 5 days old revision, and the same thing happens as what I describe above. |
|
Hi jc and Csaba, thanks for checking it. I tested again with last version of Slicer (master at e77630416ec79c7cb6a8145c6286b39a25ebaec1) on my local build (ubuntu 17.10). import slicer I get the error: |
|
ah you found that as well (: |
|
Yep, same thing. What we need to figure out I guess is why those seemingly correct hierarchy files are ignored. |
|
Hi, I just come back from a conference, so I didn't have the time to check this further up to now. I just wanted to check again if you have any news. |
|
Unfortunately no news, I'm waiting for some pointers from Jc to have an idea where to start. |
|
Ok, thanks for letting me know. I have to say that I also have no clue where to start (: |
|
To follow up on this, I was able to reproduce the problem and I am currently investigating. |
|
Excellent, thank you Jc! Let me know if I can do something to help. |
|
This should be fixed in https://github.com/Slicer/Slicer/pull/845 If you don't have any comment on the PR, I will integrate later tonight. |
|
I can't say I can completely follow what the problem was exactly, but thank you for the fix :) Please integrate. I'll test it on Windows and Mac tomorrow. |
|
Fixed in r26649
To properly wrap classes, the "VTK wrapper" needs information associated with all types used in the public interface of classes that should be wrapped. Such information are stored in "Hierarchy" files. The commit r26649 makes sure Slicer types are all exported so that they can be used within the extension build system. For more details, see https://www.vtk.org/Wiki/VTK/WrapHierarchy |
|
@Jcfr great!!! I tested locally (ubuntu) and it works for Logic, MRML and Widget classes. I have only one issue, in SlicerAstro I have also a display manager and at compilation now I get this error during the wrapping: Shall I update https://github.com/Punzo/SlicerAstro/blob/master/AstroVolume/MRMLDM/CMakeLists.txt or include in some way the header file or something else? |
|
In addition, for SlicerMacroPythonWrapModuleVTKLibrary the Hierarchy files are generated, but again I think they are ignored, because the classes are not accessible by the python console. |
|
I just tested that the wrapping of vtkFits and vtkOpenGLFilters was not working in Qt4/VTK7 either. So maybe the issue in these two cases is my cmake files. Instead the wrapping of MRMLDM classes in Qt4/VTK7 was working. |
|
Hi Davide, Since the change only affects VTK8 or VTK9, it explains why you didn't see any changes with VTK7. I am now building SlicerAstro. |
|
Yeah I tested to be sure that was the VTK7->VTK8/9 the issue and not some bugs in my cmakes (:. Thanks a lot for investingating further this issue!!! |
|
Hi Davide, I didn't have any issues compiling against Slicer with Qt5 or Qt4. Please, note that library like vtkFits have to be imported explicitly and will not be added to the Here is the summary: SlicerAstro + Qt4 + VTK7: (1) Start Slicer using (2) Then open python console:
SlicerAstro + Qt5 + VTK9: (1) Start Slicer using (2) Then open python console: |
|
Hi Jc, thanks for looking into it. 1) MRMLDM: I did two clean builds: Qt5+VTK8 and Qt5+VTK9. For the Qt5+VTK9 everything worked perfectly. 2) vtkFits wrapping: I am an idiot, I thought they were magically included in the slicer import (: The "manual" import is completly fine. Thanks again for checking. |
|
I can confirm it works now, and Davide's issue seems to be solved as well. Closing the issue. |
|
Reopening for one last question. I found one more difference in python wrapping between VTK7 and 8. Not even sure if this was expected to work with VTK7, but it did. The source file Jc can you comment this please? If this is something to fix, or something that was never supposed to work, etc. Thanks! |
|
SlicerRtCommonPython_VTK7.cxx (14,566 bytes) SlicerRtCommonPython_VTK8.cxx (416 bytes) |
|
@pinter The support for VTK wrapping hierarchy has been fixed since you last commented on this issue, Is this still a problem ? |
|
It was fixed, thank you! Apparently you didn't read those last comments. If you have time to answer, I'll appreciate it, but if not, then feel free to close the issue. |
|
I posted the question on the VTK tracker and re-targeted the issue. |
|
Thanks, Jc for opening the issue, the advice I got solved the wrapping problem. In a nutshell, the file has to have a vtk prefix to get wrapped, despite it not being a vtk class itself. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2017-10-19 11:38 | pinter | New Issue | |
2017-10-19 11:38 | pinter | Status | new => assigned |
2017-10-19 11:38 | pinter | Assigned To | => jcfr |
2017-10-31 06:07 | Davide | Relationship added | has duplicate 0004448 |
2017-10-31 09:02 | Davide | Note Added: 0015369 | |
2017-10-31 10:58 | pinter | Note Added: 0015370 | |
2017-11-01 05:22 | Davide | Note Added: 0015371 | |
2017-11-01 09:29 | pinter | Note Added: 0015373 | |
2017-11-01 10:33 | jcfr | Note Added: 0015374 | |
2017-11-01 11:00 | pinter | Note Added: 0015375 | |
2017-11-01 11:09 | Davide | Note Added: 0015376 | |
2017-11-01 11:10 | Davide | Note Added: 0015377 | |
2017-11-01 11:11 | pinter | Note Added: 0015378 | |
2017-11-14 05:11 | Davide | Note Added: 0015405 | |
2017-11-16 10:12 | pinter | Note Added: 0015407 | |
2017-11-16 11:11 | Davide | Note Added: 0015408 | |
2017-11-20 11:36 | jcfr | Note Added: 0015414 | |
2017-11-20 11:56 | pinter | Note Added: 0015415 | |
2017-11-20 19:15 | jcfr | Note Added: 0015417 | |
2017-11-20 21:43 | pinter | Note Added: 0015418 | |
2017-11-20 22:28 | jcfr | Note Added: 0015419 | |
2017-11-20 22:28 | jcfr | Status | assigned => resolved |
2017-11-20 22:28 | jcfr | Resolution | open => fixed |
2017-11-20 22:28 | jcfr | Fixed in Version | => Slicer 4.9.0 |
2017-11-21 05:21 | Davide | Note Added: 0015420 | |
2017-11-21 05:29 | Davide | Note Edited: 0015420 | View Revisions |
2017-11-21 05:37 | Davide | Note Edited: 0015420 | View Revisions |
2017-11-21 05:59 | Davide | Note Added: 0015421 | |
2017-11-21 08:19 | Davide | Note Added: 0015422 | |
2017-11-21 09:59 | jcfr | Note Added: 0015423 | |
2017-11-21 10:07 | Davide | Note Added: 0015424 | |
2017-11-21 14:25 | jcfr | Note Added: 0015428 | |
2017-11-22 06:28 | Davide | Note Added: 0015429 | |
2017-11-23 10:49 | pinter | Status | resolved => closed |
2017-11-23 10:49 | pinter | Note Added: 0015437 | |
2017-11-28 16:02 | pinter | Status | closed => feedback |
2017-11-28 16:02 | pinter | Resolution | fixed => reopened |
2017-11-28 16:02 | pinter | Note Added: 0015447 | |
2017-11-28 16:03 | pinter | File Added: SlicerRtCommonPython_VTK7.cxx | |
2017-11-28 16:03 | pinter | File Added: SlicerRtCommonPython_VTK8.cxx | |
2018-03-22 01:13 | jcfr | Note Added: 0015589 | |
2018-03-22 08:20 | pinter | Note Added: 0015605 | |
2018-03-22 08:20 | pinter | Status | feedback => assigned |
2018-03-31 02:07 | jcfr | Target Version | Slicer 4.9.0 => Slicer 4.11.0 |
2018-03-31 02:07 | jcfr | Note Added: 0015636 | |
2018-04-18 09:27 | pinter | Note Added: 0015674 | |
2018-04-18 09:27 | pinter | Status | assigned => closed |