SciPy 0.6.0 API Documentation Generated by Endo, 2007-10-17
VTK type converter.
This module handles conversion between VTK C++ and VTK Python objects so that one can write inline C++ code to manipulate VTK Python objects. It requires that you have VTK and the VTK-Python wrappers installed. It has been tested with VTK 4.0 and above. The code is based on wx_spec.py. You will need to call inline with include_dirs, library_dirs and often even libraries appropriately set for this to work without errors. Sometimes you might need to include additional headers.
Distributed under the SciPy License.
vtk_c_to_py_template = """
PyObject* %(type_name)s_to_py(vtkObjectBase* obj)
{
return vtkPythonGetObjectFromPointer(obj);
}
"""
vtk_py_to_c_template = """
class %(type_name)s_handler
{
public:
%(c_type)s convert_to_%(type_name)s(PyObject* py_obj, const char* name)
{
%(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s");
if (!vtk_ptr)
handle_conversion_error(py_obj,"%(type_name)s", name);
%(inc_ref_count)s
return vtk_ptr;
}
%(c_type)s py_to_%(type_name)s(PyObject* py_obj, const char* name)
{
%(c_type)s vtk_ptr = (%(c_type)s) vtkPythonGetPointerFromObject(py_obj, "%(type_name)s");
if (!vtk_ptr)
handle_bad_type(py_obj,"%(type_name)s", name);
%(inc_ref_count)s
return vtk_ptr;
}
};
%(type_name)s_handler x__%(type_name)s_handler = %(type_name)s_handler();
#define convert_to_%(type_name)s(py_obj,name) \
x__%(type_name)s_handler.convert_to_%(type_name)s(py_obj,name)
#define py_to_%(type_name)s(py_obj,name) \
x__%(type_name)s_handler.py_to_%(type_name)s(py_obj,name)
"""
| Local name | Refers to |
|---|---|
| common_base_converter | SciPy.weave.c_spec.common_base_converter |