vtkPythonProgrammableFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
30 #ifndef vtkPythonProgrammableFilter_h
31 #define vtkPythonProgrammableFilter_h
32 
33 #include "vtkPVVTKExtensionsFiltersPythonModule.h" //needed for exports
34 #include "vtkProgrammableFilter.h"
35 
36 class vtkPythonProgrammableFilterImplementation;
37 
39  : public vtkProgrammableFilter
40 {
41 public:
43  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
47 
50  vtkSetStringMacro(Script);
51  vtkGetStringMacro(Script);
53 
55 
58  vtkSetStringMacro(InformationScript);
59  vtkGetStringMacro(InformationScript);
61 
63 
66  vtkSetStringMacro(UpdateExtentScript);
67  vtkGetStringMacro(UpdateExtentScript);
69 
71 
75  vtkSetStringMacro(CheckNeedsUpdateScript);
76  vtkGetStringMacro(CheckNeedsUpdateScript);
78 
80 
84  void SetParameterInternal(const char* name, const char* value);
85  void SetParameter(const char* name, const char* value);
86  void SetParameter(const char* name, int value);
87  void SetParameter(const char* name, double value);
88  void SetParameter(const char* name, double value1, double value2);
89  void SetParameter(const char* name, double value1, double value2, double value3);
91 
93 
96  void AddParameter(const char* name, const char* value);
97  void ClearParameter(const char* name);
99 
103  void ClearParameters();
104 
108  static void ExecuteScript(void*);
109 
111 
115  vtkSetMacro(OutputDataSetType, int);
116  vtkGetMacro(OutputDataSetType, int);
118 
120 
124  vtkSetStringMacro(PythonPath);
125  vtkGetStringMacro(PythonPath);
127 
132  void SetNumberOfInputPorts(int numberOfInputPorts) override
133  {
134  this->Superclass::SetNumberOfInputPorts(numberOfInputPorts);
135  }
136 
141  bool GetNeedsUpdate();
142 
147  vtkSetMacro(NeedsUpdate, bool);
148 
149 protected:
151  ~vtkPythonProgrammableFilter() override;
152 
156  void Exec(const char*, const char*);
157 
159 
160  // overridden to allow multiple inputs to port 0
161  int FillInputPortInformation(int port, vtkInformation* info) override;
162 
166  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
167  vtkInformationVector* outputVector) override;
168 
169  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
170  vtkInformationVector* outputVector) override;
171 
172  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
173  vtkInformationVector* outputVector) override;
174 
180  int ProcessRequest(
181  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
182 
183  char* Script;
187  char* PythonPath;
190 
191 private:
193  void operator=(const vtkPythonProgrammableFilter&) = delete;
194 
200  vtkInformation* Request;
201 
202  vtkPythonProgrammableFilterImplementation* const Implementation;
203 };
204 
205 #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)