13 #ifndef mitkProcessExecutor_h
14 #define mitkProcessExecutor_h
17 #include <itkObject.h>
19 #include <itksys/Process.h>
46 const char *
GetEventName()
const override {
return "ExternalProcessOutputEvent"; }
47 bool CheckEvent(const ::itk::EventObject *e)
const override {
return dynamic_cast<const Self *
>(e); }
57 #define mitkProcessExecutorEventMacro(classname) \
58 class classname : public ExternalProcessOutputEvent \
61 typedef classname Self; \
62 typedef ExternalProcessOutputEvent Superclass; \
64 explicit classname(const std::string &output) : Superclass(output) {} \
65 ~classname() override {} \
67 virtual const char *GetEventName() const override { return #classname; } \
68 virtual bool CheckEvent(const ::itk::EventObject *e) const override { return dynamic_cast<const Self *>(e); } \
69 virtual ::itk::EventObject *MakeObject() const override { return new Self(this->GetOutput()); } \
90 itkFactorylessNewMacro(
Self);
92 itkSetMacro(SharedOutputPipes,
bool);
93 itkGetConstMacro(SharedOutputPipes,
bool);
158 itksysProcess *m_ProcessID =
nullptr;
#define MITKSEGMENTATION_EXPORT
Event carrying output text from an external process.
const char * GetEventName() const override
bool CheckEvent(const ::itk::EventObject *e) const override
itk::EventObject * MakeObject() const override
std::string GetOutput() const
Returns the output text from the external process.
ExternalProcessOutputEvent(const std::string &output="")
Constructor.
~ExternalProcessOutputEvent() override
ExternalProcessOutputEvent Self
You may register an observer for an ExternalProcessOutputEvent, ExternalProcessStdOutEvent or Externa...
~ProcessExecutor() override
static std::string GetOSDependendExecutableName(const std::string &name)
Returns the OS-dependent executable name (e.g. adds ".exe" on Windows).
bool m_SharedOutputPipes
Specifies if the child process should share the output pipes (true) or not (false)....
bool Execute(const std::string &executionPath, const std::string &executableName, ArgumentListType &argumentList)
Executes an external process.
int GetExitValue()
Returns the exit value of the last executed process.
std::vector< std::string > ArgumentListType
Type for the list of command-line arguments.
virtual bool Execute(const std::string &executionPath, const ArgumentListType &argumentList)
Executes an external process.
static std::string EnsureCorrectOSPathSeparator(const std::string &path)
Converts path separators to the OS-correct form.
void KillProcess()
Kills the currently running process.
#define mitkProcessExecutorEventMacro(classname)
Find image slices visible on a given plane.