Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerCLIModuleWidget.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerCLIModuleWidget_h
22 #define __qSlicerCLIModuleWidget_h
23 
24 // CTK includes
25 #include <ctkPimpl.h>
26 #include <ctkVTKObject.h>
27 
28 // Slicer includes
30 
31 #include "qSlicerBaseQTCLIExport.h"
32 
33 class ModuleDescription;
34 class vtkMRMLNode;
36 class qSlicerCLIModuleWidgetPrivate;
37 
38 class Q_SLICER_BASE_QTCLI_EXPORT qSlicerCLIModuleWidget : public qSlicerAbstractModuleWidget
39 {
40  Q_OBJECT
41  QVTK_OBJECT
42 public:
43 
45  qSlicerCLIModuleWidget(QWidget *parent=nullptr);
46  ~qSlicerCLIModuleWidget() override;
47 
49  Q_INVOKABLE vtkMRMLCommandLineModuleNode * currentCommandLineModuleNode()const;
50 
51  // Node editing
52  bool setEditedNode(vtkMRMLNode* node, QString role = QString(), QString context = QString()) override;
53  double nodeEditable(vtkMRMLNode* node) override;
54 
55 public slots:
57  void setCurrentCommandLineModuleNode(vtkMRMLNode* commandLineModuleNode);
58 
59  void apply(bool wait = false);
60  void cancel();
61  void reset();
62 
63  void setAutoRun(bool enable);
64  void setAutoRunWhenParameterChanged(bool enable);
65  void setAutoRunWhenInputModified(bool enable);
66  void setAutoRunOnOtherInputEvents(bool enable);
67  void setAutoRunCancelsRunningProcess(bool enable);
68 protected:
70  void setup() override;
71 
73  void enter() override;
74 
78  void run(vtkMRMLCommandLineModuleNode* parameterNode, bool waitForCompletion = false);
79 
81  void cancel(vtkMRMLCommandLineModuleNode* node);
82 protected:
83  QScopedPointer<qSlicerCLIModuleWidgetPrivate> d_ptr;
84 
85 private:
86  Q_DECLARE_PRIVATE(qSlicerCLIModuleWidget);
87  Q_DISABLE_COPY(qSlicerCLIModuleWidget);
88 };
89 
90 #endif
Q_INVOKABLE bool setEditedNode(vtkMRMLNode *node, QString role=QString(), QString context=QString()) override
Node editing.
qSlicerAbstractModuleWidget Superclass
QScopedPointer< qSlicerCLIModuleWidgetPrivate > d_ptr
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
Q_INVOKABLE double nodeEditable(vtkMRMLNode *node) override
MRML node for representing the parameters allowing to run a command line interface module (CLI)...
virtual Q_INVOKABLE void enter()