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 
38 class VTKPVVTKEXTENSIONSFILTERSPYTHON_EXPORT vtkPythonProgrammableFilter
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 
158  int FillOutputPortInformation(int port, vtkInformation* info) override;
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
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkProgrammableFilter
vtkPythonProgrammableFilter::SetNumberOfInputPorts
void SetNumberOfInputPorts(int numberOfInputPorts) override
Set the number of input ports This function is explicitly exposed to enable a vtkClientServerInterpre...
Definition: vtkPythonProgrammableFilter.h:132
vtkPassInputTypeAlgorithm::RequestDataObject
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkPythonProgrammableFilter::Script
char * Script
Definition: vtkPythonProgrammableFilter.h:183
vtkInformationVector
vtkProgrammableFilter::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkProgrammableFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkProgrammableFilter.h
vtkPassInputTypeAlgorithm::FillOutputPortInformation
virtual int FillOutputPortInformation(int port, vtkInformation *info)
vtkAlgorithm::SetNumberOfInputPorts
virtual void SetNumberOfInputPorts(int n)
vtkIndent
vtkPythonProgrammableFilter::PythonPath
char * PythonPath
Definition: vtkPythonProgrammableFilter.h:187
vtkPythonProgrammableFilter::CheckNeedsUpdateScript
char * CheckNeedsUpdateScript
Definition: vtkPythonProgrammableFilter.h:186
vtkInformation
vtkProgrammableFilter::New
static vtkProgrammableFilter * New()
vtkPythonProgrammableFilter::UpdateExtentScript
char * UpdateExtentScript
Definition: vtkPythonProgrammableFilter.h:185
vtkPassInputTypeAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkPythonProgrammableFilter::InformationScript
char * InformationScript
Definition: vtkPythonProgrammableFilter.h:184
vtkPythonProgrammableFilter
Executes a user supplied python script on its input dataset to produce an output dataset.
Definition: vtkPythonProgrammableFilter.h:38
vtkPythonProgrammableFilter::NeedsUpdate
bool NeedsUpdate
Definition: vtkPythonProgrammableFilter.h:189
vtkPassInputTypeAlgorithm::ProcessRequest
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkPassInputTypeAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkPythonProgrammableFilter::OutputDataSetType
int OutputDataSetType
Definition: vtkPythonProgrammableFilter.h:188