// python wrapper for vtkDijkstraImageGeodesicPath // #define VTK_WRAPPING_CXX #define VTK_STREAMS_FWD_ONLY #include "vtkPythonArgs.h" #include "vtkPythonOverload.h" #include "vtkConfigure.h" #include #include #include "vtkVariant.h" #include "vtkIndent.h" #include "vtkDijkstraImageGeodesicPath.h" extern "C" { VTK_ABI_EXPORT void PyVTKAddFile_vtkDijkstraImageGeodesicPath(PyObject *); } extern "C" { VTK_ABI_EXPORT PyObject *PyvtkDijkstraImageGeodesicPath_ClassNew(); } #ifndef DECLARED_PyvtkDijkstraGraphGeodesicPath_ClassNew extern "C" { PyObject *PyvtkDijkstraGraphGeodesicPath_ClassNew(); } #define DECLARED_PyvtkDijkstraGraphGeodesicPath_ClassNew #endif static const char *PyvtkDijkstraImageGeodesicPath_Doc = "vtkDijkstraImageGeodesicPath - Dijkstra algorithm to compute the\ngraph geodesic.\n\n" "Superclass: vtkDijkstraGraphGeodesicPath\n\n" "Takes as input a polyline and an image representing a 2D cost\n" "function and performs a single source shortest path calculation.\n" "Dijkstra's algorithm is used. The implementation is similar to the\n" "one described in Introduction to Algorithms (Second Edition) by\n" "Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Cliff\n" "Stein, published by MIT Press and McGraw-Hill. Some minor enhancement\n" "are added though. All vertices are not pushed on the heap at start,\n" "instead a front set is maintained. The heap is implemented as a\n" "binary heap. The output of the filter is a set of lines describing\n" "the shortest path from StartVertex to EndVertex. See parent class\n" "vtkDijkstraGraphGeodesicPath for the implementation.\n\n" "@warning\n" "The input cost image must have only VTK_PIXEL cells: i.e., a 2D image\n" "or slice of a 3D volume. A cost function for a gray scale image might\n" "be generated by the following pipeline:\n" "vtkImageData->vtkImageGradientMagnitude->vtkImageShiftScale wherein\n" "the gradient magnitude image is inverted so that strong edges have\n" "low cost value. Costs in moving from a vertex v to a vertex u are\n" "calculated using a weighted additive sheme: cost = Iw*f(I) +\n" "Ew*f(u,v) + Cw*f(t,u,v) where Iw is the weight associated with f(I):\n" "the normalized image cost, Ew is the weight associated with f(u,v):\n" "the normalized distance between vertices u and v, and Cw is the\n" "weight associated with f(t,u,v): the normalized curvature calculated\n" "from the vertex t which precedes vertex u, and vertices u and v. All\n" "weights range from 0 to 1.\n\n" "@par Thanks: The class was contributed by Dean Inglis.\n\n"; static PyObject * PyvtkDijkstraImageGeodesicPath_IsTypeOf(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "IsTypeOf"); char *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = vtkDijkstraImageGeodesicPath::IsTypeOf(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_IsA(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "IsA"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); char *temp0 = nullptr; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = (ap.IsBound() ? op->IsA(temp0) : op->vtkDijkstraImageGeodesicPath::IsA(temp0)); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_SafeDownCast(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "SafeDownCast"); vtkObjectBase *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetVTKObject(temp0, "vtkObjectBase")) { vtkDijkstraImageGeodesicPath *tempr = vtkDijkstraImageGeodesicPath::SafeDownCast(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_NewInstance(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "NewInstance"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { vtkDijkstraImageGeodesicPath *tempr = (ap.IsBound() ? op->NewInstance() : op->vtkDijkstraImageGeodesicPath::NewInstance()); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); if (result && PyVTKObject_Check(result)) { PyVTKObject_GetObject(result)->UnRegister(0); PyVTKObject_SetFlag(result, VTK_PYTHON_IGNORE_UNREGISTER, 1); } } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_SetInputData(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetInputData"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); vtkDataObject *temp0 = nullptr; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetVTKObject(temp0, "vtkDataObject")) { if (ap.IsBound()) { op->SetInputData(temp0); } else { op->vtkDijkstraImageGeodesicPath::SetInputData(temp0); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_GetInputAsImageData(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetInputAsImageData"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { vtkImageData *tempr = (ap.IsBound() ? op->GetInputAsImageData() : op->vtkDijkstraImageGeodesicPath::GetInputAsImageData()); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_SetImageWeight(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetImageWeight"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); double temp0; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { if (ap.IsBound()) { op->SetImageWeight(temp0); } else { op->vtkDijkstraImageGeodesicPath::SetImageWeight(temp0); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_GetImageWeight(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetImageWeight"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { double tempr = (ap.IsBound() ? op->GetImageWeight() : op->vtkDijkstraImageGeodesicPath::GetImageWeight()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_SetEdgeLengthWeight(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetEdgeLengthWeight"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); double temp0; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { if (ap.IsBound()) { op->SetEdgeLengthWeight(temp0); } else { op->vtkDijkstraImageGeodesicPath::SetEdgeLengthWeight(temp0); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_GetEdgeLengthWeight(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetEdgeLengthWeight"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { double tempr = (ap.IsBound() ? op->GetEdgeLengthWeight() : op->vtkDijkstraImageGeodesicPath::GetEdgeLengthWeight()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_SetCurvatureWeight(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "SetCurvatureWeight"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); double temp0; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { if (ap.IsBound()) { op->SetCurvatureWeight(temp0); } else { op->vtkDijkstraImageGeodesicPath::SetCurvatureWeight(temp0); } if (!ap.ErrorOccurred()) { result = ap.BuildNone(); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_GetCurvatureWeightMinValue(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetCurvatureWeightMinValue"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { double tempr = (ap.IsBound() ? op->GetCurvatureWeightMinValue() : op->vtkDijkstraImageGeodesicPath::GetCurvatureWeightMinValue()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_GetCurvatureWeightMaxValue(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetCurvatureWeightMaxValue"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { double tempr = (ap.IsBound() ? op->GetCurvatureWeightMaxValue() : op->vtkDijkstraImageGeodesicPath::GetCurvatureWeightMaxValue()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkDijkstraImageGeodesicPath_GetCurvatureWeight(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetCurvatureWeight"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkDijkstraImageGeodesicPath *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { double tempr = (ap.IsBound() ? op->GetCurvatureWeight() : op->vtkDijkstraImageGeodesicPath::GetCurvatureWeight()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyMethodDef PyvtkDijkstraImageGeodesicPath_Methods[] = { {"IsTypeOf", PyvtkDijkstraImageGeodesicPath_IsTypeOf, METH_VARARGS, "V.IsTypeOf(string) -> int\nC++: static vtkTypeBool IsTypeOf(const char *type)\n\nStandard methids for printing and determining type information.\n"}, {"IsA", PyvtkDijkstraImageGeodesicPath_IsA, METH_VARARGS, "V.IsA(string) -> int\nC++: vtkTypeBool IsA(const char *type) override;\n\nStandard methids for printing and determining type information.\n"}, {"SafeDownCast", PyvtkDijkstraImageGeodesicPath_SafeDownCast, METH_VARARGS, "V.SafeDownCast(vtkObjectBase) -> vtkDijkstraImageGeodesicPath\nC++: static vtkDijkstraImageGeodesicPath *SafeDownCast(\n vtkObjectBase *o)\n\nStandard methids for printing and determining type information.\n"}, {"NewInstance", PyvtkDijkstraImageGeodesicPath_NewInstance, METH_VARARGS, "V.NewInstance() -> vtkDijkstraImageGeodesicPath\nC++: vtkDijkstraImageGeodesicPath *NewInstance()\n\nStandard methids for printing and determining type information.\n"}, {"SetInputData", PyvtkDijkstraImageGeodesicPath_SetInputData, METH_VARARGS, "V.SetInputData(vtkDataObject)\nC++: void SetInputData(vtkDataObject *)\n\nSpecify the image object which is used as a cost function.\n"}, {"GetInputAsImageData", PyvtkDijkstraImageGeodesicPath_GetInputAsImageData, METH_VARARGS, "V.GetInputAsImageData() -> vtkImageData\nC++: vtkImageData *GetInputAsImageData()\n\nSpecify the image object which is used as a cost function.\n"}, {"SetImageWeight", PyvtkDijkstraImageGeodesicPath_SetImageWeight, METH_VARARGS, "V.SetImageWeight(float)\nC++: void SetImageWeight(double)\n\nImage cost weight.\n"}, {"GetImageWeight", PyvtkDijkstraImageGeodesicPath_GetImageWeight, METH_VARARGS, "V.GetImageWeight() -> float\nC++: virtual double GetImageWeight()\n\nImage cost weight.\n"}, {"SetEdgeLengthWeight", PyvtkDijkstraImageGeodesicPath_SetEdgeLengthWeight, METH_VARARGS, "V.SetEdgeLengthWeight(float)\nC++: void SetEdgeLengthWeight(double)\n\nEdge length cost weight.\n"}, {"GetEdgeLengthWeight", PyvtkDijkstraImageGeodesicPath_GetEdgeLengthWeight, METH_VARARGS, "V.GetEdgeLengthWeight() -> float\nC++: virtual double GetEdgeLengthWeight()\n\nEdge length cost weight.\n"}, {"SetCurvatureWeight", PyvtkDijkstraImageGeodesicPath_SetCurvatureWeight, METH_VARARGS, "V.SetCurvatureWeight(float)\nC++: virtual void SetCurvatureWeight(double _arg)\n\nCurvature cost weight.\n"}, {"GetCurvatureWeightMinValue", PyvtkDijkstraImageGeodesicPath_GetCurvatureWeightMinValue, METH_VARARGS, "V.GetCurvatureWeightMinValue() -> float\nC++: virtual double GetCurvatureWeightMinValue()\n\nCurvature cost weight.\n"}, {"GetCurvatureWeightMaxValue", PyvtkDijkstraImageGeodesicPath_GetCurvatureWeightMaxValue, METH_VARARGS, "V.GetCurvatureWeightMaxValue() -> float\nC++: virtual double GetCurvatureWeightMaxValue()\n\nCurvature cost weight.\n"}, {"GetCurvatureWeight", PyvtkDijkstraImageGeodesicPath_GetCurvatureWeight, METH_VARARGS, "V.GetCurvatureWeight() -> float\nC++: virtual double GetCurvatureWeight()\n\nCurvature cost weight.\n"}, {nullptr, nullptr, 0, nullptr} }; static PyTypeObject PyvtkDijkstraImageGeodesicPath_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "vtkFiltersModelingPython.vtkDijkstraImageGeodesicPath", // tp_name sizeof(PyVTKObject), // tp_basicsize 0, // tp_itemsize PyVTKObject_Delete, // tp_dealloc 0, // tp_print nullptr, // tp_getattr nullptr, // tp_setattr nullptr, // tp_compare PyVTKObject_Repr, // tp_repr nullptr, // tp_as_number nullptr, // tp_as_sequence nullptr, // tp_as_mapping nullptr, // tp_hash nullptr, // tp_call PyVTKObject_String, // tp_str PyObject_GenericGetAttr, // tp_getattro PyObject_GenericSetAttr, // tp_setattro &PyVTKObject_AsBuffer, // tp_as_buffer Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_BASETYPE, // tp_flags PyvtkDijkstraImageGeodesicPath_Doc, // tp_doc PyVTKObject_Traverse, // tp_traverse nullptr, // tp_clear nullptr, // tp_richcompare offsetof(PyVTKObject, vtk_weakreflist), // tp_weaklistoffset nullptr, // tp_iter nullptr, // tp_iternext nullptr, // tp_methods nullptr, // tp_members PyVTKObject_GetSet, // tp_getset nullptr, // tp_base nullptr, // tp_dict nullptr, // tp_descr_get nullptr, // tp_descr_set offsetof(PyVTKObject, vtk_dict), // tp_dictoffset nullptr, // tp_init nullptr, // tp_alloc PyVTKObject_New, // tp_new PyObject_GC_Del, // tp_free nullptr, // tp_is_gc nullptr, // tp_bases nullptr, // tp_mro nullptr, // tp_cache nullptr, // tp_subclasses nullptr, // tp_weaklist VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED }; static vtkObjectBase *PyvtkDijkstraImageGeodesicPath_StaticNew() { return vtkDijkstraImageGeodesicPath::New(); } PyObject *PyvtkDijkstraImageGeodesicPath_ClassNew() { PyVTKClass_Add( &PyvtkDijkstraImageGeodesicPath_Type, PyvtkDijkstraImageGeodesicPath_Methods, "vtkDijkstraImageGeodesicPath", &PyvtkDijkstraImageGeodesicPath_StaticNew); PyTypeObject *pytype = &PyvtkDijkstraImageGeodesicPath_Type; if ((pytype->tp_flags & Py_TPFLAGS_READY) != 0) { return (PyObject *)pytype; } #if !defined(VTK_PY3K) && PY_VERSION_HEX >= 0x02060000 pytype->tp_flags |= Py_TPFLAGS_HAVE_NEWBUFFER; #endif pytype->tp_base = (PyTypeObject *)PyvtkDijkstraGraphGeodesicPath_ClassNew(); PyType_Ready(pytype); return (PyObject *)pytype; } void PyVTKAddFile_vtkDijkstraImageGeodesicPath( PyObject *dict) { PyObject *o; o = PyvtkDijkstraImageGeodesicPath_ClassNew(); if (o && PyDict_SetItemString(dict, "vtkDijkstraImageGeodesicPath", o) != 0) { Py_DECREF(o); } }