Slicer / SlicerExecutionModel

An open-source CMake-based project that provides macros and associated tools for the easy building of 3D Slicer command line interface (CLI) modules.
https://www.slicer.org/wiki/Documentation/Nightly/Developers/SlicerExecutionModel
Other
33 stars 50 forks source link

Add ITK/VTK plugin watcher utility classes #13

Open finetjul opened 11 years ago

finetjul commented 11 years ago

In order for CLI to report progress, the following output is the standard:

<filter-start>
 <filter-name>...</filter-name>
 ...
</filter-start>
<filter-progress>
...

There is in Slicer (Base/CLI) some utility classes that observe ITK and VTK filters to automatically generate such output. Such classes should be moved in SlicerExecutionModel as conveniency (and be enabled only if ITK_DIR or VTK_DIR are passed). A generic progress watcher (whose itkPluginFilterWatcher and vtkPluginFilterWatcher should derive from) should also be added.

class SEMProgressWatcher
{
public:
  SEMProgressWatcher(const char* name, const char* comment = 0, ModuleProcessInformation* inf = 0, double fraction = 1.0, double start = 0.0);
  virtual void Start();
  virtual void SetProgress(double progress);
  virtual void End();
  virtual double GetProgress();
protected:
  void ReportStart();
  void ReportEnd();
  void ReportProgress();
};
class itkPluginFilterWatcher: public itkSimpleFilterWatcher, SEMProgressWatcher
{
...
};
class vtkPluginFilterWatcher: public SEMProgressWatcher
{
...
};
jcfr commented 11 years ago

See previous discussion on the same topic: http://massmail.spl.harvard.edu/public-archives/slicer-devel/2011/006829.html