vtkPythonProgrammableFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPythonProgrammableFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
41 #ifndef vtkPythonProgrammableFilter_h
42 #define vtkPythonProgrammableFilter_h
43 
44 #include "vtkPVVTKExtensionsFiltersPythonModule.h" //needed for exports
45 #include "vtkProgrammableFilter.h"
46 
47 class vtkPythonProgrammableFilterImplementation;
48 
50  : public vtkProgrammableFilter
51 {
52 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
61  vtkSetStringMacro(Script);
62  vtkGetStringMacro(Script);
64 
66 
69  vtkSetStringMacro(InformationScript);
70  vtkGetStringMacro(InformationScript);
72 
74 
77  vtkSetStringMacro(UpdateExtentScript);
78  vtkGetStringMacro(UpdateExtentScript);
80 
82 
86  vtkSetStringMacro(CheckNeedsUpdateScript);
87  vtkGetStringMacro(CheckNeedsUpdateScript);
89 
91 
95  void SetParameterInternal(const char* name, const char* value);
96  void SetParameter(const char* name, const char* value);
97  void SetParameter(const char* name, int value);
98  void SetParameter(const char* name, double value);
99  void SetParameter(const char* name, double value1, double value2);
100  void SetParameter(const char* name, double value1, double value2, double value3);
102 
104 
107  void AddParameter(const char* name, const char* value);
108  void ClearParameter(const char* name);
110 
114  void ClearParameters();
115 
119  static void ExecuteScript(void*);
120 
122 
126  vtkSetMacro(OutputDataSetType, int);
127  vtkGetMacro(OutputDataSetType, int);
129 
131 
135  vtkSetStringMacro(PythonPath);
136  vtkGetStringMacro(PythonPath);
138 
143  void SetNumberOfInputPorts(int numberOfInputPorts) override
144  {
145  this->Superclass::SetNumberOfInputPorts(numberOfInputPorts);
146  }
147 
152  bool GetNeedsUpdate();
153 
158  vtkSetMacro(NeedsUpdate, bool);
159 
160 protected:
162  ~vtkPythonProgrammableFilter() override;
163 
167  void Exec(const char*, const char*);
168 
170 
171  // overridden to allow multiple inputs to port 0
172  int FillInputPortInformation(int port, vtkInformation* info) override;
173 
177  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
178  vtkInformationVector* outputVector) override;
179 
180  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
181  vtkInformationVector* outputVector) override;
182 
183  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
184  vtkInformationVector* outputVector) override;
185 
191  int ProcessRequest(
192  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
193 
194  char* Script;
198  char* PythonPath;
201 
202 private:
204  void operator=(const vtkPythonProgrammableFilter&) = delete;
205 
211  vtkInformation* Request;
212 
213  vtkPythonProgrammableFilterImplementation* const Implementation;
214 };
215 
216 #endif
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void PrintSelf(ostream &os, vtkIndent indent)
virtual void SetNumberOfInputPorts(int n)
info
void SetNumberOfInputPorts(int numberOfInputPorts) override
Set the number of input ports This function is explicitly exposed to enable a vtkClientServerInterpre...
virtual int FillInputPortInformation(int port, vtkInformation *info)
#define VTKPVVTKEXTENSIONSFILTERSPYTHON_EXPORT
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
static vtkProgrammableFilter * New()
Executes a user supplied python script on its input dataset to produce an output dataset.
port
void operator=(const vtkObjectBase &)
virtual int FillOutputPortInformation(int port, vtkInformation *info)