|
Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
00001 /*=auto========================================================================= 00002 00003 Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved. 00004 00005 See COPYRIGHT.txt 00006 or http://www.slicer.org/copyright/copyright.txt for details. 00007 00008 Program: 3D Slicer 00009 Module: $RCSfile: vtkMRMLCommandLineModuleNode.h,v $ 00010 Date: $Date: 2006/03/19 17:12:29 $ 00011 Version: $Revision: 1.3 $ 00012 00013 =========================================================================auto=*/ 00014 00015 #ifndef __vtkMRMLCommandLineModuleNode_h 00016 #define __vtkMRMLCommandLineModuleNode_h 00017 00019 #include <vtkMRMLNode.h> 00020 00021 #include "vtkMRMLCLIWin32Header.h" 00022 00023 class ModuleDescription; 00024 00031 class VTK_MRML_CLI_EXPORT vtkMRMLCommandLineModuleNode : public vtkMRMLNode 00032 { 00033 public: 00034 static vtkMRMLCommandLineModuleNode *New(); 00035 vtkTypeMacro(vtkMRMLCommandLineModuleNode, vtkMRMLNode); 00036 void PrintSelf(ostream& os, vtkIndent indent); 00037 00038 virtual vtkMRMLNode* CreateNodeInstance(); 00039 00041 virtual void ReadXMLAttributes(const char** atts); 00042 00044 virtual void WriteXML(ostream& of, int indent); 00045 00047 virtual void Copy(vtkMRMLNode *node); 00048 00050 virtual const char* GetNodeTagName() 00051 {return "CommandLineModule";} 00052 00054 enum CLINodeEvent{ 00059 ParameterChangedEvent = 17000, 00064 InputParameterEvent, 00068 AutoRunEvent, 00070 StatusModifiedEvent 00071 }; 00072 00075 const ModuleDescription& GetModuleDescription() const; 00076 ModuleDescription& GetModuleDescription(); 00077 void SetModuleDescription(const ModuleDescription& description); 00078 00079 typedef enum { 00081 Idle=0x00, 00083 Scheduled=0x01, 00085 Running=0x02, 00087 Cancelling=0x04, 00091 Cancelled=0x08, 00094 Completing=0x10, 00097 Completed=0x20, 00099 ErrorsMask=0x40, 00101 CompletedWithErrors= Completed | ErrorsMask, 00103 BusyMask = Scheduled | Running | Cancelling | Completing 00104 } StatusType; 00105 00113 void SetStatus(StatusType status, bool modify=true); 00115 int GetStatus() const; 00116 00119 const char* GetStatusString() const; 00120 00124 bool IsBusy()const; 00125 00129 void Cancel(); 00130 00133 enum AutoRunMode 00134 { 00138 AutoRunCancelsRunningProcess = 0x01, 00142 AutoRunOnChangedParameter = 0x10, 00147 AutoRunOnModifiedInputEvent = 0x20, 00150 AutoRunOnOtherInputEvents = 0x40, 00152 AutoRunOnAnyInputEvent = AutoRunOnModifiedInputEvent | AutoRunOnOtherInputEvents, 00153 // <- add here new options 00155 AutoRunEnabledMask = AutoRunOnChangedParameter | AutoRunOnAnyInputEvent 00156 }; 00157 00162 void SetAutoRun(bool enable); 00163 00166 bool GetAutoRun()const; 00167 00173 void SetAutoRunMode(int autoRunMode); 00174 00177 int GetAutoRunMode()const; 00178 00182 void SetAutoRunDelay(unsigned int delayInMs); 00183 00187 unsigned int GetAutoRunDelay()const; 00188 00191 unsigned long GetLastRunTime()const; 00192 00195 unsigned long GetParameterMTime()const; 00196 00199 unsigned long GetInputMTime()const; 00200 00203 bool ReadParameterFile(const std::string& filename); 00204 00210 bool WriteParameterFile(const std::string& filename, bool withHandlesToBulkParameters = true); 00211 00217 bool SetParameterAsNode(const char* name, vtkMRMLNode* value); 00221 bool SetParameterAsString(const char* name, const std::string& value); 00225 bool SetParameterAsInt(const char* name, int value); 00229 bool SetParameterAsBool(const char* name, bool value); 00233 bool SetParameterAsDouble(const char* name, double value); 00237 bool SetParameterAsFloat(const char* name, float value); 00238 00239 std::string GetParameterAsString(const char* name) const; 00240 00241 void SetModuleDescription(const char *name); 00242 std::string GetModuleVersion() const; 00243 std::string GetModuleTitle() const; 00244 std::string GetModuleTarget() const; 00245 std::string GetModuleType() const; 00246 bool IsValidGroupId(unsigned int group) const; 00247 bool IsValidParamId(unsigned int group, unsigned int param) const; 00248 unsigned int GetNumberOfParameterGroups() const; 00249 unsigned int GetNumberOfParametersInGroup(unsigned int group) const; 00250 std::string GetParameterGroupLabel(unsigned int group) const; 00251 std::string GetParameterGroupDescription(unsigned int group) const; 00252 std::string GetParameterGroupAdvanced(unsigned int group) const; 00253 std::string GetParameterTag(unsigned int group, unsigned int param) const; 00254 std::string GetParameterType(unsigned int group, unsigned int param) const; 00255 std::string GetParameterArgType(unsigned int group, unsigned int param) const; 00256 std::string GetParameterName(unsigned int group, unsigned int param) const; 00257 std::string GetParameterLongFlag(unsigned int group, unsigned int param) const; 00258 std::string GetParameterLabel(unsigned int group, unsigned int param) const; 00259 std::string GetParameterConstraints(unsigned int group, unsigned int param) const; 00260 std::string GetParameterMaximum(unsigned int group, unsigned int param) const; 00261 std::string GetParameterMinimum(unsigned int group, unsigned int param) const; 00262 std::string GetParameterDescription(unsigned int group, unsigned int param) const; 00263 std::string GetParameterChannel(unsigned int group, unsigned int param) const; 00264 std::string GetParameterIndex(unsigned int group, unsigned int param) const; 00265 std::string GetParameterDefault(unsigned int group, unsigned int param) const; 00266 std::string GetParameterFlag(unsigned int group, unsigned int param) const; 00267 std::string GetParameterMultiple(unsigned int group, unsigned int param) const; 00268 std::string GetParameterFileExtensions(unsigned int group, unsigned int param) const; 00269 std::string GetParameterCoordinateSystem(unsigned int group, unsigned int param) const; 00270 00274 bool IsInputDefaultValue(const std::string& value)const; 00275 00277 static int GetNumberOfRegisteredModules(); 00278 static const char* GetRegisteredModuleNameByIndex(int idx); 00279 static void RegisterModuleDescription(ModuleDescription md); 00280 static bool HasRegisteredModule(const std::string& name); 00281 static ModuleDescription GetRegisteredModuleDescription(const std::string& name); 00282 00284 virtual void Modified(); 00285 protected: 00286 void AbortProcess(); 00287 virtual void ProcessMRMLEvents(vtkObject *caller, unsigned long event, 00288 void *callData); 00289 00290 private: 00291 vtkMRMLCommandLineModuleNode(); 00292 ~vtkMRMLCommandLineModuleNode(); 00293 vtkMRMLCommandLineModuleNode(const vtkMRMLCommandLineModuleNode&); 00294 void operator=(const vtkMRMLCommandLineModuleNode&); 00295 00296 class vtkInternal; 00297 vtkInternal * Internal; 00298 }; 00299 00300 #endif
1.7.4