Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLCommandLineModuleNode.h
Go to the documentation of this file.
1/*=auto=========================================================================
2
3 Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4
5 See COPYRIGHT.txt
6 or http://www.slicer.org/copyright/copyright.txt for details.
7
8=========================================================================auto=*/
9
10#ifndef __vtkMRMLCommandLineModuleNode_h
11#define __vtkMRMLCommandLineModuleNode_h
12
14#include <vtkMRMLNode.h>
15
16#include "vtkMRMLCLIExport.h"
17
18class ModuleDescription;
19
26class VTK_MRML_CLI_EXPORT vtkMRMLCommandLineModuleNode : public vtkMRMLNode
27{
28public:
29 static vtkMRMLCommandLineModuleNode* New();
30 vtkTypeMacro(vtkMRMLCommandLineModuleNode, vtkMRMLNode);
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
34
36 void ReadXMLAttributes(const char** atts) override;
37
39 void WriteXML(ostream& of, int indent) override;
40
43 vtkMRMLCopyContentMacro(vtkMRMLCommandLineModuleNode);
44
46 const char* GetNodeTagName() override { return "CommandLineModule"; }
47
68
71 const ModuleDescription& GetModuleDescription() const;
72 ModuleDescription& GetModuleDescription();
73 std::string GetModuleDescriptionAsString() const;
74 void SetModuleDescription(const ModuleDescription& description);
75
103
111 void SetStatus(int status, bool modify = true);
113 int GetStatus() const;
114
117 const char* GetStatusString() const;
118
121 std::string GetDisplayableStatusString() const;
122
124
138
140
143 void SetOutputText(const std::string& text, bool modify = true);
144 std::string GetOutputText() const;
146
148
151 void SetErrorText(const std::string& text, bool modify = true);
152 std::string GetErrorText() const;
154
158 bool IsBusy() const;
159
160 int GetProgress() const;
161
165 void Cancel();
166
193
198 void SetAutoRun(bool enable);
199
202 bool GetAutoRun() const;
203
209 void SetAutoRunMode(int autoRunMode);
210
213 int GetAutoRunMode() const;
214
218 void SetAutoRunDelay(unsigned int delayInMs);
219
223 unsigned int GetAutoRunDelay() const;
224
227 vtkMTimeType GetLastRunTime() const;
228
231 vtkMTimeType GetParameterMTime() const;
232
235 vtkMTimeType GetInputMTime() const;
236
239 bool ReadParameterFile(const std::string& filename);
240
246 bool WriteParameterFile(const std::string& filename, bool withHandlesToBulkParameters = true);
247
253 bool SetParameterAsNode(const char* name, vtkMRMLNode* value);
257 bool SetParameterAsString(const char* name, const std::string& value);
261 bool SetParameterAsInt(const char* name, int value);
265 bool SetParameterAsBool(const char* name, bool value);
269 bool SetParameterAsDouble(const char* name, double value);
273 bool SetParameterAsFloat(const char* name, float value);
274
275 std::string GetParameterAsString(const char* name) const;
276
277 void SetModuleDescription(const char* name);
278 std::string GetModuleVersion() const;
279 std::string GetModuleTitle() const;
280 std::string GetModuleTarget() const;
281 std::string GetModuleType() const;
282 bool IsValidGroupId(unsigned int group) const;
283 bool IsValidParamId(unsigned int group, unsigned int param) const;
284 unsigned int GetNumberOfParameterGroups() const;
285 unsigned int GetNumberOfParametersInGroup(unsigned int group) const;
286 std::string GetParameterGroupLabel(unsigned int group) const;
287 std::string GetParameterGroupDescription(unsigned int group) const;
288 std::string GetParameterGroupAdvanced(unsigned int group) const;
289 std::string GetParameterTag(unsigned int group, unsigned int param) const;
290 std::string GetParameterType(unsigned int group, unsigned int param) const;
291 std::string GetParameterArgType(unsigned int group, unsigned int param) const;
292 std::string GetParameterName(unsigned int group, unsigned int param) const;
293 std::string GetParameterLongFlag(unsigned int group, unsigned int param) const;
294 std::string GetParameterLabel(unsigned int group, unsigned int param) const;
295 std::string GetParameterConstraints(unsigned int group, unsigned int param) const;
296 std::string GetParameterMaximum(unsigned int group, unsigned int param) const;
297 std::string GetParameterMinimum(unsigned int group, unsigned int param) const;
298 std::string GetParameterDescription(unsigned int group, unsigned int param) const;
299 std::string GetParameterChannel(unsigned int group, unsigned int param) const;
300 std::string GetParameterIndex(unsigned int group, unsigned int param) const;
302 std::string GetParameterDefault(unsigned int group, unsigned int param) const;
303 std::string GetParameterValue(unsigned int group, unsigned int param) const;
304 std::string GetParameterFlag(unsigned int group, unsigned int param) const;
305 std::string GetParameterMultiple(unsigned int group, unsigned int param) const;
306 std::string GetParameterFileExtensions(unsigned int group, unsigned int param) const;
307 std::string GetParameterCoordinateSystem(unsigned int group, unsigned int param) const;
308
312 bool IsInputDefaultValue(const std::string& value) const;
313
316 static const char* GetRegisteredModuleNameByIndex(int idx);
317 static void RegisterModuleDescription(ModuleDescription md);
318 static bool HasRegisteredModule(const std::string& name);
319 static ModuleDescription GetRegisteredModuleDescription(const std::string& name);
320
322 void Modified() override;
323
324protected:
326 void ProcessMRMLEvents(vtkObject* caller, unsigned long event, void* callData) override;
327
329
330private:
334 void operator=(const vtkMRMLCommandLineModuleNode&) = delete;
335
336 class vtkInternal;
337 vtkInternal* Internal;
338};
339
340#endif
MRML node for representing the parameters allowing to run a command line interface module (CLI)....
bool IsValidGroupId(unsigned int group) const
std::string GetParameterChannel(unsigned int group, unsigned int param) const
std::string GetParameterGroupLabel(unsigned int group) const
std::string GetModuleDescriptionAsString() const
static const char * GetRegisteredModuleNameByIndex(int idx)
static vtkMRMLCommandLineModuleNode * New()
std::string GetParameterMultiple(unsigned int group, unsigned int param) const
std::string GetParameterGroupAdvanced(unsigned int group) const
bool IsValidParamId(unsigned int group, unsigned int param) const
bool SetParameterAsString(const char *name, const std::string &value)
std::string GetModuleVersion() const
vtkMTimeType GetInputMTime() const
@ AutoRunOnAnyInputEvent
Trigger an auto run when an input parameter fires any event.
@ AutoRunEnabledMask
Mask used to know if auto run is configured with valid parameters.
static ModuleDescription GetRegisteredModuleDescription(const std::string &name)
void Modified() override
Reimplemented for internal reasons.
std::string GetParameterLabel(unsigned int group, unsigned int param) const
std::string GetParameterDescription(unsigned int group, unsigned int param) const
void SetAutoRun(bool enable)
bool SetParameterAsInt(const char *name, int value)
static void RegisterModuleDescription(ModuleDescription md)
void SetModuleDescription(const char *name)
bool SetParameterAsNode(const char *name, vtkMRMLNode *value)
std::string GetParameterGroupDescription(unsigned int group) const
static bool HasRegisteredModule(const std::string &name)
bool WriteParameterFile(const std::string &filename, bool withHandlesToBulkParameters=true)
bool SetParameterAsBool(const char *name, bool value)
unsigned int GetNumberOfParametersInGroup(unsigned int group) const
std::string GetParameterTag(unsigned int group, unsigned int param) const
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
std::string GetParameterValue(unsigned int group, unsigned int param) const
vtkMTimeType GetParameterMTime() const
std::string GetParameterMaximum(unsigned int group, unsigned int param) const
std::string GetParameterFlag(unsigned int group, unsigned int param) const
std::string GetParameterCoordinateSystem(unsigned int group, unsigned int param) const
const ModuleDescription & GetModuleDescription() const
vtkMRMLCopyContentMacro(vtkMRMLCommandLineModuleNode)
unsigned int GetAutoRunDelay() const
std::string GetModuleType() const
void ReadXMLAttributes(const char **atts) override
Set node attributes.
static int GetNumberOfRegisteredModules()
Methods to manage the master list of module description prototypes.
vtkMRMLNode * CreateNodeInstance() override
Create instance of the default node. Like New only virtual.
std::string GetParameterLongFlag(unsigned int group, unsigned int param) const
bool IsInputDefaultValue(const std::string &value) const
std::string GetParameterAsString(const char *name) const
std::string GetModuleTitle() const
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
Propagate events generated in mrml.
ModuleDescription & GetModuleDescription()
std::string GetModuleTarget() const
void SetAutoRunDelay(unsigned int delayInMs)
void SetModuleDescription(const ModuleDescription &description)
std::string GetParameterConstraints(unsigned int group, unsigned int param) const
std::string GetParameterIndex(unsigned int group, unsigned int param) const
void SetAutoRunMode(int autoRunMode)
bool SetParameterAsFloat(const char *name, float value)
void SetErrorText(const std::string &text, bool modify=true)
std::string GetParameterMinimum(unsigned int group, unsigned int param) const
std::string GetErrorText() const
std::string GetParameterFileExtensions(unsigned int group, unsigned int param) const
bool SetParameterAsDouble(const char *name, double value)
std::string GetParameterArgType(unsigned int group, unsigned int param) const
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
unsigned int GetNumberOfParameterGroups() const
void SetStatus(int status, bool modify=true)
std::string GetParameterType(unsigned int group, unsigned int param) const
std::string GetOutputText() const
const char * GetStatusString() const
std::string GetDisplayableStatusString() const
bool ReadParameterFile(const std::string &filename)
std::string GetParameterDefault(unsigned int group, unsigned int param) const
void SetOutputText(const std::string &text, bool modify=true)
std::string GetParameterName(unsigned int group, unsigned int param) const
void PrintSelf(ostream &os, vtkIndent indent) override
CLINodeEvent
List of events that can be fired on or by the node.
@ StatusModifiedEvent
Event invoked when the CLI changes of status.
@ Running
State when the CLI is being executed.
@ ErrorsMask
Mask applied when the CLI has been executed with errors.
@ Cancelling
State when the CLI has been requested to be cancelled.
@ CompletedWithErrors
State when the CLI has been executed with errors.
@ BusyMask
Mask used to know if the CLI is in pending mode.
@ Scheduled
State when the CLI has been requested to be executed.
vtkMTimeType GetLastRunTime() const
void operator=(const vtkMRMLNode &)