Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for statismo python wrapper module #265

Open
normanius opened this issue Jan 5, 2018 · 0 comments
Open

Improvements for statismo python wrapper module #265

normanius opened this issue Jan 5, 2018 · 0 comments

Comments

@normanius
Copy link
Contributor

On MacOS, when building the wrapper, I end up with two files _statismo_VTK.so and statismo_VTK.py under build/modules/VTK/wrapping.

What I currently do to use the python wrapper is the following:

  • Create a folder statismo or statismo_VTK under my python's module directory (.../lib/python2.7/site-packages/statismo)
  • Copy _statismo_VTK.so and statismo_VTK.py to that location
  • Create an __init__.py file with the following line (from statismo_VTK.py import *)

This way I can import the statismo library and all is good.

For better usage, I'd suggest however the following improvements:

  • cmake installation target to bundle the relevant files into a python module statismo
  • because it always is a hassle an extra entry: fix dependencies for installed binaries in cmake
  • Just a matter of preference: try to hide the ugly _vtk and _vtkPD postfixes by either one of the suggestions:
    • Create a new namespace/submodule vtk where it is clear that only vtkPolyData stuff is used. One would use that module as something like import statismo.vtk as statismo
    • Similar as for vtkStandardMeshRepresenter, just prefix all statismo objects created for vtk with vtk*, a prefix a vtk users are pretty familiar with
    • Just entirely skip it, unless there is the plan to further expand to other container types
    • Hide the specializations by using some data managing layer when creating the object, for instance
    if isinstance(representer, vtkStandardMeshRepresenter): 
        return statismo.DataManager_vtkPD.Create(representer)

Not sure if I have time to fix this myself, just making suggestions which I would pick up in case I continue to work with statismo for bit... :)

@normanius normanius changed the title How to use the statismo python wrapper module? Improvements for statismo python wrapper module Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant