# Module wrapping classes with non-VTK names

**URL:** https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905
**Category:** Support
**Created:** [August 4, 2020, 10:27am UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905 "2020-08-04T10:27:13Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![kit](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/9fc29f/32.png) [@kit](https://discourse.vtk.org/u/kit)
#### Post date: [August 4, 2020, 10:27am UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/1 "2020-08-04T10:27:14Z")

</div>

I have a VTK derived data type, that (for a variety of reasons) breaks the VTK naming convention. For example, it looks something like this

```
class myType: public vtkImageData
{
... blah blah ..
}

```

now I also have VTK derived algorithms that use that data type, for example

```
class myAlgorithm: public vtkImageDataAlgorithm
{
... blah blah ...

myType* = GetOutput(){
   return myType::SafeDownCast(this->GetOutputDataObject());
 }

... blah blah ...

}

```

The classes myType and myAlgorithm compile with the VTK module system and work fine. However, the problem comes when I try to wrap them in python, where the GetOutput method is ignored. It looks like vtkWrapPython skips the GetOutput method because the return type does not start with “vtk”.

With old versions of VTK (\<9), I handled this by having a custom hacked version of vtkWrapPython. However, I am wondering if there is now a better way using the module wrapping system?

Any input greatly appreciated.

cheers

Kit

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [August 4, 2020, 12:25pm UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/2 "2020-08-04T12:25:46Z")

</div>

I believe that classes not starting with `vtk` might be ignored somewhere. We could instead rely solely on the hierarchy information though. Could be remembering wrong too.

Thoughs @dgobbi?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [August 4, 2020, 12:42pm UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/3 "2020-08-04T12:42:57Z")

</div>

Years ago we wanted the use a different class name prefix for our VTK-based library but had to switch to “vtk” for the wrapper to work.

It could be nice if custom prefixes were usable, but overall it is not that bad that VTK style is enforced for VTK-based classes (including class name prefix).

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [August 4, 2020, 12:45pm UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/4 "2020-08-04T12:45:09Z")

</div>

The wrappers still require VTK classes to start with “vtk” in order to fully wrap. It’s something I can fix when I find time. Please submit a bug report, if it’s on my radar then I’ll get around to it eventually.

---

<div class="post-metadata">

### Author: ![kit](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/9fc29f/32.png) [@kit](https://discourse.vtk.org/u/kit)
#### Post date: [August 4, 2020, 1:23pm UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/5 "2020-08-04T13:23:16Z")

</div>

Thanks David/ Andreas/ Ben. From the discussion above it sounds like my short term options are either to hack the vtkWrapPython again or to use classes begining with vtk. Longer term, this would be good functinolaity to have (from a user perspective) even if there is just an option for the user to provide a list of prefixes for wrapping.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [August 4, 2020, 1:43pm UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/6 "2020-08-04T13:43:28Z")

</div>

Don’t forget to file a bug report.

---

<div class="post-metadata">

### Author: ![kit](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/9fc29f/32.png) [@kit](https://discourse.vtk.org/u/kit)
#### Post date: [August 4, 2020, 1:54pm UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/7 "2020-08-04T13:54:58Z")

</div>

[https://gitlab.kitware.com/vtk/vtk/-/issues/17973](https://gitlab.kitware.com/vtk/vtk/-/issues/17973)

I hope this is filed in the right place

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [August 4, 2020, 2:32pm UTC](https://discourse.vtk.org/t/module-wrapping-classes-with-non-vtk-names/3905/8 "2020-08-04T14:32:44Z")

</div>

Yes, thanks. I’ve assigned it to myself so that it stays on my to-do list.
