Slicer  5.3
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 
56  QString translate(const std::string& sourceText)const;
57 
58 public slots:
60  void setCurrentCommandLineModuleNode(vtkMRMLNode* commandLineModuleNode);
61 
62  void apply(bool wait = false);
63  void cancel();
64  void reset();
65 
66  void setAutoRun(bool enable);
67  void setAutoRunWhenParameterChanged(bool enable);
68  void setAutoRunWhenInputModified(bool enable);
69  void setAutoRunOnOtherInputEvents(bool enable);
70  void setAutoRunCancelsRunningProcess(bool enable);
71 protected:
73  void setup() override;
74 
76  void enter() override;
77 
81  void run(vtkMRMLCommandLineModuleNode* parameterNode, bool waitForCompletion = false);
82 
84  void cancel(vtkMRMLCommandLineModuleNode* node);
85 protected:
86  QScopedPointer<qSlicerCLIModuleWidgetPrivate> d_ptr;
87 
88 private:
89  Q_DECLARE_PRIVATE(qSlicerCLIModuleWidget);
90  Q_DISABLE_COPY(qSlicerCLIModuleWidget);
91 };
92 
93 #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()