vtkSlicerCLIModuleLogic.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003  Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) 
00004  All Rights Reserved.
00005 
00006  See Doc/copyright/copyright.txt
00007  or http://www.slicer.org/copyright/copyright.txt for details.
00008 
00009  Program:   3D Slicer
00010 
00011 =========================================================================auto=*/
00012 
00013 #ifndef __vtkSlicerCLIModuleLogic_h
00014 #define __vtkSlicerCLIModuleLogic_h
00015 
00016 // Slicer includes
00017 #include "vtkSlicerModuleLogic.h"
00018 
00019 // MRMLCLI includes
00020 #include "vtkMRMLCommandLineModuleNode.h"
00021 
00022 // MRML include
00023 #include "vtkMRMLScene.h"
00024 
00025 // STL includes
00026 #include <string>
00027 
00028 #include "qSlicerBaseQTCLIExport.h"
00029 
00030 typedef enum { CommandLineModule, SharedObjectModule, PythonModule } CommandLineModuleType;
00031 
00032 class Q_SLICER_BASE_QTCLI_EXPORT vtkSlicerCLIModuleLogic :
00033   public vtkSlicerModuleLogic
00034 {
00035 public:
00036   static vtkSlicerCLIModuleLogic *New();
00037   vtkTypeMacro(vtkSlicerCLIModuleLogic,vtkSlicerModuleLogic);
00038   void PrintSelf(ostream& os, vtkIndent indent);
00039 
00040   // TODO: do we need to observe MRML here?
00041   virtual void ProcessMrmlEvents(vtkObject * vtkNotUsed(caller),
00042                                  unsigned long vtkNotUsed(event),
00043                                  void * vtkNotUsed(callData)){}
00044 
00045   // Description: For debugging, control deletion of temp files
00046   vtkBooleanMacro (DeleteTemporaryFiles, int);
00047   vtkSetMacro (DeleteTemporaryFiles, int);
00048   vtkGetMacro (DeleteTemporaryFiles, int);
00049 
00050   // Description: For debugging, control redirection of cout and cerr
00051   vtkBooleanMacro (RedirectModuleStreams, int);
00052   vtkSetMacro (RedirectModuleStreams, int);
00053   vtkGetMacro (RedirectModuleStreams, int);
00054   
00055   // The method that schedules the command line module to run
00056   void Apply( vtkMRMLCommandLineModuleNode* node );
00057   void ApplyAndWait ( vtkMRMLCommandLineModuleNode* node );
00058 
00059   // Set/Get the directory to use for temporary files
00060   void SetTemporaryDirectory(const char *tempdir)
00061     { this->TemporaryDirectory = tempdir; }
00062 
00063 //BTX
00064 //   void LazyEvaluateModuleTarget(ModuleDescription& moduleDescriptionObject);
00065 //ETX
00066 //   void LazyEvaluateModuleTarget(vtkMRMLCommandLineModuleNode* node) 
00067 //     { this->LazyEvaluateModuleTarget(node->GetModuleDescription()); }
00068 
00069 protected:
00070   //BTX
00071   std::string ConstructTemporaryFileName(const std::string& tag,
00072                                          const std::string& type,
00073                                          const std::string& name,
00074                                      const std::vector<std::string>& extensions,
00075                                      CommandLineModuleType commandType) const;
00076   std::string ConstructTemporarySceneFileName(vtkMRMLScene *scene);
00077   std::string FindHiddenNodeID(const ModuleDescription& d,
00078                                const ModuleParameter& p);
00079   //ETX
00080 
00081   // The method that runs the command line module
00082   void ApplyTask(void *clientdata);
00083 
00084   // Communicate progress back to the node
00085   static void ProgressCallback(void *);
00086   
00087 private:
00088   vtkSlicerCLIModuleLogic();
00089   virtual ~vtkSlicerCLIModuleLogic();
00090   vtkSlicerCLIModuleLogic(const vtkSlicerCLIModuleLogic&);
00091   void operator=(const vtkSlicerCLIModuleLogic&);
00092 
00093   int DeleteTemporaryFiles;
00094 
00095   int RedirectModuleStreams;
00096 
00097   vtkMRMLCommandLineModuleNode* CommandLineModuleNode;
00098 //BTX
00099   std::string TemporaryDirectory;
00100 //ETX
00101 };
00102 
00103 #endif
00104 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1