ITK  6.0.0
Insight Toolkit
itkPyCommand.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
19#ifndef itkPyCommand_h
20#define itkPyCommand_h
21
22#include "itkCommand.h"
23
24// The python header defines _POSIX_C_SOURCE without a preceding #undef
25#undef _POSIX_C_SOURCE
26#undef _XOPEN_SOURCE
27#include "Python.h"
28
29namespace itk
30{
31
45class ITKCommon_EXPORT PyCommand : public Command
46{
47public:
49 using Self = PyCommand;
50
53
55 itkOverrideGetNameOfClassMacro(PyCommand);
56
58 itkNewMacro(Self);
59
65 void
66 SetCommandCallable(PyObject * obj);
67
68 PyObject *
70
71 void
72 Execute(Object *, const EventObject &) override;
73 void
74 Execute(const Object *, const EventObject &) override;
75
76protected:
78 ~PyCommand() override;
79 void
81 PyCommand(const Self &); // Not implemented.
82 PyCommand &
83 operator=(const Self &); // Not implemented.
84
85private:
86 PyObject * m_Object;
88};
89
90
91} // namespace itk
92
93#endif // _itkPyCommand_h
Superclass for callback/observer methods.
Definition: itkCommand.h:46
Abstraction of the Events used to communicating among filters and with GUIs.
Base class for most ITK classes.
Definition: itkObject.h:62
Command subclass that calls a Python callable object, e.g. a Python function.
Definition: itkPyCommand.h:46
PyObject * m_EmptyArgumentList
Definition: itkPyCommand.h:87
void Execute(const Object *, const EventObject &) override
~PyCommand() override
void SetCommandCallable(PyObject *obj)
PyCommand & operator=(const Self &)
PyObject * GetCommandCallable()
PyObject * m_Object
Definition: itkPyCommand.h:86
PyCommand(const Self &)
void Execute(Object *, const EventObject &) override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....