1 /*=========================================================================
4 Module: $RCSfile: gdcmCommandPy.h,v $
6 Date: $Date: 2005/11/29 08:32:40 $
7 Version: $Revision: 1.2 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef GDCMCOMMANDPY_H
20 #define GDCMCOMMANDPY_H
22 #include "gdcmDebug.h"
23 #include "gdcmCommand.h"
28 //-----------------------------------------------------------------------------
30 * \brief CommandPy base class to react on a gdcm event
32 * \remarks The execution parameter depends on the
34 class CommandPy : public Command
36 gdcmTypeMacro(CommandPy);
39 static CommandPy *New() {return new CommandPy(); }
41 void SetCallback(PyObject *callback)
47 virtual void Execute()
49 PyObject *arglist = Py_BuildValue("()");
50 PyObject *result = PyEval_CallObject(Callback, arglist);
59 if (PyErr_ExceptionMatches(PyExc_KeyboardInterrupt))
61 std::cerr << "Caught a Ctrl-C within python, exiting program.\n";
80 /// pointer to the initialisation method for any progress bar
83 } // end namespace gdcm
85 //-----------------------------------------------------------------------------