// python wrapper for vtkPNMReader // #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 "vtkPNMReader.h" extern "C" { VTK_ABI_EXPORT void PyVTKAddFile_vtkPNMReader(PyObject *); } extern "C" { VTK_ABI_EXPORT PyObject *PyvtkPNMReader_ClassNew(); } #ifndef DECLARED_PyvtkImageReader_ClassNew extern "C" { PyObject *PyvtkImageReader_ClassNew(); } #define DECLARED_PyvtkImageReader_ClassNew #endif static const char *PyvtkPNMReader_Doc = "vtkPNMReader - read pnm (i.e., portable anymap) files\n\n" "Superclass: vtkImageReader\n\n" "vtkPNMReader is a source object that reads pnm (portable anymap)\n" "files. This includes .pbm (bitmap), .pgm (grayscale), and .ppm\n" "(pixmap) files. (Currently this object only reads binary versions of\n" "these files.)\n\n" "PNMReader creates structured point datasets. The dimension of the\n" "dataset depends upon the number of files read. Reading a single file\n" "results in a 2D image, while reading more than one file results in a\n" "3D volume.\n\n" "To read a volume, files must be of the form \"FileName.\"\n" "(e.g., foo.ppm.0, foo.ppm.1, ...). You must also specify the\n" "DataExtent. The fifth and sixth values of the DataExtent specify the\n" "beginning and ending files to read.\n\n"; static PyObject * PyvtkPNMReader_IsTypeOf(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "IsTypeOf"); char *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = vtkPNMReader::IsTypeOf(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkPNMReader_IsA(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "IsA"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkPNMReader *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->vtkPNMReader::IsA(temp0)); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkPNMReader_SafeDownCast(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "SafeDownCast"); vtkObjectBase *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetVTKObject(temp0, "vtkObjectBase")) { vtkPNMReader *tempr = vtkPNMReader::SafeDownCast(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); } } return result; } static PyObject * PyvtkPNMReader_NewInstance(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "NewInstance"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkPNMReader *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { vtkPNMReader *tempr = (ap.IsBound() ? op->NewInstance() : op->vtkPNMReader::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 * PyvtkPNMReader_CanReadFile(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "CanReadFile"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkPNMReader *op = static_cast(vp); char *temp0 = nullptr; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = (ap.IsBound() ? op->CanReadFile(temp0) : op->vtkPNMReader::CanReadFile(temp0)); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkPNMReader_GetFileExtensions(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetFileExtensions"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkPNMReader *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { const char *tempr = (ap.IsBound() ? op->GetFileExtensions() : op->vtkPNMReader::GetFileExtensions()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkPNMReader_GetDescriptiveName(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "GetDescriptiveName"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkPNMReader *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { const char *tempr = (ap.IsBound() ? op->GetDescriptiveName() : op->vtkPNMReader::GetDescriptiveName()); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyMethodDef PyvtkPNMReader_Methods[] = { {"IsTypeOf", PyvtkPNMReader_IsTypeOf, METH_VARARGS, "V.IsTypeOf(string) -> int\nC++: static vtkTypeBool IsTypeOf(const char *type)\n\nReturn 1 if this class type is the same type of (or a subclass\nof) the named class. Returns 0 otherwise. This method works in\ncombination with vtkTypeMacro found in vtkSetGet.h.\n"}, {"IsA", PyvtkPNMReader_IsA, METH_VARARGS, "V.IsA(string) -> int\nC++: vtkTypeBool IsA(const char *type) override;\n\nReturn 1 if this class is the same type of (or a subclass of) the\nnamed class. Returns 0 otherwise. This method works in\ncombination with vtkTypeMacro found in vtkSetGet.h.\n"}, {"SafeDownCast", PyvtkPNMReader_SafeDownCast, METH_VARARGS, "V.SafeDownCast(vtkObjectBase) -> vtkPNMReader\nC++: static vtkPNMReader *SafeDownCast(vtkObjectBase *o)\n\n"}, {"NewInstance", PyvtkPNMReader_NewInstance, METH_VARARGS, "V.NewInstance() -> vtkPNMReader\nC++: vtkPNMReader *NewInstance()\n\n"}, {"CanReadFile", PyvtkPNMReader_CanReadFile, METH_VARARGS, "V.CanReadFile(string) -> int\nC++: int CanReadFile(const char *fname) override;\n\nReturn non zero if the reader can read the given file name.\nShould be implemented by all sub-classes of vtkImageReader2. For\nnon zero return values the following values are to be used 1 - I\nthink I can read the file but I cannot prove it 2 - I definitely\ncan read the file 3 - I can read the file and I have validated\nthat I am the correct reader for this file\n"}, {"GetFileExtensions", PyvtkPNMReader_GetFileExtensions, METH_VARARGS, "V.GetFileExtensions() -> string\nC++: const char *GetFileExtensions() override;\n\n.pnm .pgm .ppm\n"}, {"GetDescriptiveName", PyvtkPNMReader_GetDescriptiveName, METH_VARARGS, "V.GetDescriptiveName() -> string\nC++: const char *GetDescriptiveName() override;\n\nPNM\n"}, {nullptr, nullptr, 0, nullptr} }; static PyTypeObject PyvtkPNMReader_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "vtkIOImagePython.vtkPNMReader", // 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 PyvtkPNMReader_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 *PyvtkPNMReader_StaticNew() { return vtkPNMReader::New(); } PyObject *PyvtkPNMReader_ClassNew() { PyVTKClass_Add( &PyvtkPNMReader_Type, PyvtkPNMReader_Methods, "vtkPNMReader", &PyvtkPNMReader_StaticNew); PyTypeObject *pytype = &PyvtkPNMReader_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 *)PyvtkImageReader_ClassNew(); PyType_Ready(pytype); return (PyObject *)pytype; } void PyVTKAddFile_vtkPNMReader( PyObject *dict) { PyObject *o; o = PyvtkPNMReader_ClassNew(); if (o && PyDict_SetItemString(dict, "vtkPNMReader", o) != 0) { Py_DECREF(o); } }