Slicer  5.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerMarkupsModuleWidget.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
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 ==============================================================================*/
17 
18 #ifndef __qSlicerMarkupsModuleWidget_h
19 #define __qSlicerMarkupsModuleWidget_h
20 
21 // Slicer includes
23 
24 // Markups widgets include
25 #include "qSlicerMarkupsModuleExport.h"
26 
27 class QItemSelection;
28 class QMenu;
29 class QModelIndex;
30 class QStringList;
31 class QTableWidgetItem;
32 class QShortcut;
33 class qMRMLMarkupsOptionsWidget;
34 class qSlicerMarkupsModuleWidgetPrivate;
35 class vtkMRMLMarkupsNode;
36 class vtkMRMLNode;
38 
40 class Q_SLICER_QTMODULES_MARKUPS_EXPORT qSlicerMarkupsModuleWidget :
42 {
43  Q_OBJECT
44 
45 public:
46 
48  qSlicerMarkupsModuleWidget(QWidget *parent=nullptr);
49  ~qSlicerMarkupsModuleWidget() override;
50 
53  void enter() override;
55  void exit() override;
56 
58  vtkSlicerMarkupsLogic *markupsLogic();
59 
63  void updateWidgetFromMRML();
67  void updateWidgetFromDisplayNode();
73  void updateMaximumScaleFromVolumes();
75  void updateRow(int m);
77  void updateRows();
78 
81  void setMRMLMarkupsNode(vtkMRMLMarkupsNode* markupsNode);
82 
84  vtkMRMLMarkupsNode* mrmlMarkupsNode();
85 
87  void updateLogicFromSettings();
88 
91  bool sliceIntersectionsVisible();
92 
93  // Set number of columns for organization of create markups buttons
94  void setCreateMarkupsButtonsColumns(unsigned int columns);
95 
96  bool setEditedNode(vtkMRMLNode* node, QString role = QString(), QString context = QString()) override;
97  double nodeEditable(vtkMRMLNode* node) override;
98 
99  // Returns the list of associated markups
100  QStringList& associatedMarkups();
101 
102  // Add additional widget
103  QList<qMRMLMarkupsOptionsWidget*>& additionalWidgets();
104 
105  Q_INVOKABLE void updateToolBar(vtkMRMLMarkupsNode* node);
106 
107 public slots:
108 
111  void onNodeAddedEvent(vtkObject* scene, vtkObject* node);
115  void onNodeRemovedEvent(vtkObject* scene, vtkObject* node);
117  void onMRMLSceneEndImportEvent();
119  void onMRMLSceneEndRestoreEvent();
122  void onMRMLSceneEndBatchProcessEvent();
124  void onMRMLSceneEndCloseEvent();
126  void onPKeyActivated();
127 
131  void checkForAnnotationFiducialConversion();
134  void convertAnnotationFiducialsToMarkups();
135 
137  void onResetToDefaultDisplayPropertiesPushButtonClicked();
138  void onSaveToDefaultDisplayPropertiesPushButtonClicked();
139 
141  void onVisibilityOnAllControlPointsInListPushButtonClicked();
142  void onVisibilityOffAllControlPointsInListPushButtonClicked();
143  void onVisibilityAllControlPointsInListToggled();
144  void onLockAllControlPointsInListPushButtonClicked();
145  void onUnlockAllControlPointsInListPushButtonClicked();
146  void onLockAllControlPointsInListToggled();
147  void onSelectAllControlPointsInListPushButtonClicked();
148  void onDeselectAllControlPointsInListPushButtonClicked();
149  void onSelectedAllControlPointsInListToggled();
150  void onAddControlPointPushButtonClicked();
151  void onMoveControlPointUpPushButtonClicked();
152  void onMoveControlPointDownPushButtonClicked();
153  void onRestoreControlPointPushButtonClicked();
154  void onResetControlPointPushButtonClicked();
155  void onUnsetControlPointPushButtonClicked();
156  void onMissingControlPointPushButtonClicked();
157  void onDeleteControlPointPushButtonClicked(bool confirm=true);
158  void onDeleteAllControlPointsInListPushButtonClicked();
159 
161  void onActiveMarkupItemChanged(vtkIdType);
162  void onActiveMarkupMRMLNodeChanged(vtkMRMLNode *markupsNode);
164  void onSelectionNodeActivePlaceNodeIDChanged();
165 
168  void onActiveMarkupMRMLNodeAdded(vtkMRMLNode *markupsNode);
169 
171  void onCreateMarkupByClass(const QString& className);
172 
174  void onListVisibileInvisiblePushButtonClicked();
175 
177  void onListLockedUnlockedPushButtonClicked();
178 
180  void onFixedNumberOfControlPointsPushButtonClicked();
181 
183  void onNameFormatLineEditTextEdited(const QString text);
184 
186  void onResetNameFormatToDefaultPushButtonClicked();
187 
191  void onRenameAllWithCurrentNameFormatPushButtonClicked();
192 
194  void onActiveMarkupTableCellChanged(int row, int column);
196  void onActiveMarkupTableCellClicked(QTableWidgetItem* item);
198  void onActiveMarkupTableCurrentCellChanged(int currentRow, int currentColumn,
199  int previousRow, int previousColumn);
201  void onRightClickActiveMarkupTableWidget(QPoint pos);
203  void addSelectedCoordinatesToMenu(QMenu *menu);
205  void onJumpSlicesActionTriggered();
207  void onRefocusCamerasActionTriggered();
208 
212  QStringList getOtherMarkupNames(vtkMRMLNode *thisMarkup);
213 
214  void cutSelectedToClipboard();
215  void copySelectedToClipboard();
216  void pasteSelectedFromClipboard();
217 
219  void onActiveMarkupsNodeModifiedEvent();
221  void onActiveMarkupsNodePointModifiedEvent(vtkObject *caller, void *callData);
223  void onActiveMarkupsNodePointAddedEvent();
225  void onActiveMarkupsNodePointRemovedEvent(vtkObject *caller, void *callData);
227  void onActiveMarkupsNodeDisplayModifiedEvent();
229  void onActiveMarkupsNodeTransformModifiedEvent();
230 
233  void onNewMarkupWithCurrentDisplayPropertiesTriggered();
234 
238  void onSliceIntersectionsVisibilityToggled(bool checked);
239 
241  void onHideCoordinateColumnsToggled(int index);
242 
244  void onTransformedCoordinatesToggled(bool checked);
245 
247  void observeMeasurementsInCurrentMarkupsNode();
249  void updateMeasurementsDescriptionLabel();
251  void populateMeasurementSettingsTable();
253  void onMeasurementsCollectionModified();
255  void onMeasurementModified(vtkObject* caller);
257  void onMeasurementEnabledCheckboxToggled(bool on);
258 
260  void onCreateMarkupsPushButtons();
261 
263  void onUpdateMarkupsOptionsWidgets();
264 
265  // Enable or disable markup table buttons
266  void enableMarkupTableButtons(bool enable);
267 
268  void updateImportExportWidgets();
269  void onImportExportApply();
270 
272  void onColorLegendCollapsibleGroupBoxToggled(bool);
273 
274  //-----------------------------------------------------------
275  // All public methods below are deprecated
276  //
277  // These methods are deprecated because they use old terms (markup instead of control point),
278 
281  {
282  qWarning("qSlicerMarkupsModuleWidget::onVisibilityOnAllMarkupsInListPushButtonClicked method is deprecated, please use onVisibilityOnAllControlPointsInListPushButtonClicked instead");
283  this->onVisibilityOnAllControlPointsInListPushButtonClicked();
284  };
287  {
288  qWarning("qSlicerMarkupsModuleWidget::onVisibilityOffAllMarkupsInListPushButtonClicked method is deprecated, please use onVisibilityOffAllControlPointsInListPushButtonClicked instead");
289  this->onVisibilityOffAllControlPointsInListPushButtonClicked();
290  };
293  {
294  qWarning("qSlicerMarkupsModuleWidget::onVisibilityAllMarkupsInListToggled method is deprecated, please use onVisibilityAllControlPointsInListToggled instead");
295  this->onVisibilityAllControlPointsInListToggled();
296  };
299  {
300  qWarning("qSlicerMarkupsModuleWidget::onLockAllMarkupsInListPushButtonClicked method is deprecated, please use onLockAllControlPointsInListPushButtonClicked instead");
301  this->onLockAllControlPointsInListPushButtonClicked();
302  };
305  {
306  qWarning("qSlicerMarkupsModuleWidget::onUnlockAllMarkupsInListPushButtonClicked method is deprecated, please use onUnlockAllControlPointsInListPushButtonClicked instead");
307  this->onUnlockAllControlPointsInListPushButtonClicked();
308  };
311  {
312  qWarning("qSlicerMarkupsModuleWidget::onLockAllMarkupsInListToggled method is deprecated, please use onLockAllControlPointsInListToggled instead");
313  this->onLockAllControlPointsInListToggled();
314  };
317  {
318  qWarning("qSlicerMarkupsModuleWidget::onSelectAllMarkupsInListPushButtonClicked method is deprecated, please use onSelectAllControlPointsInListPushButtonClicked instead");
319  this->onSelectAllControlPointsInListPushButtonClicked();
320  };
323  {
324  qWarning("qSlicerMarkupsModuleWidget::onDeselectAllMarkupsInListPushButtonClicked method is deprecated, please use onDeselectAllControlPointsInListPushButtonClicked instead");
325  this->onDeselectAllControlPointsInListPushButtonClicked();
326  };
329  {
330  qWarning("qSlicerMarkupsModuleWidget::onSelectedAllMarkupsInListToggled method is deprecated, please use onSelectedAllControlPointsInListToggled instead");
331  this->onSelectedAllControlPointsInListToggled();
332  };
335  {
336  qWarning("qSlicerMarkupsModuleWidget::onAddMarkupPushButtonClicked method is deprecated, please use onAddControlPointPushButtonClicked instead");
337  this->onAddControlPointPushButtonClicked();
338  };
341  {
342  qWarning("qSlicerMarkupsModuleWidget::onMoveMarkupUpPushButtonClicked method is deprecated, please use onMoveControlPointUpPushButtonClicked instead");
343  this->onMoveControlPointUpPushButtonClicked();
344  };
347  {
348  qWarning("qSlicerMarkupsModuleWidget::onMoveMarkupDownPushButtonClicked method is deprecated, please use onMoveControlPointDownPushButtonClicked instead");
349  this->onMoveControlPointDownPushButtonClicked();
350  };
353  {
354  qWarning("qSlicerMarkupsModuleWidget::onRestoreMarkupPushButtonClicked method is deprecated, please use onRestoreControlPointPushButtonClicked instead");
355  this->onRestoreControlPointPushButtonClicked();
356  };
359  {
360  qWarning("qSlicerMarkupsModuleWidget::onResetMarkupPushButtonClicked method is deprecated, please use onResetControlPointPushButtonClicked instead");
361  this->onResetControlPointPushButtonClicked();
362  };
365  {
366  qWarning("qSlicerMarkupsModuleWidget::onUnsetMarkupPushButtonClicked method is deprecated, please use onUnsetControlPointPushButtonClicked instead");
367  this->onUnsetControlPointPushButtonClicked();
368  };
371  {
372  qWarning("qSlicerMarkupsModuleWidget::onMissingMarkupPushButtonClicked method is deprecated, please use onMissingControlPointPushButtonClicked instead");
373  this->onMissingControlPointPushButtonClicked();
374  };
376  void onDeleteMarkupPushButtonClicked(bool confirm=true)
377  {
378  qWarning("qSlicerMarkupsModuleWidget::onDeleteMarkupPushButtonClicked method is deprecated, please use onDeleteControlPointPushButtonClicked instead");
379  this->onDeleteControlPointPushButtonClicked(confirm);
380  };
383  {
384  qWarning("qSlicerMarkupsModuleWidget::onDeleteAllMarkupsInListPushButtonClicked method is deprecated, please use onDeleteAllControlPointsInListPushButtonClicked instead");
385  this->onDeleteAllControlPointsInListPushButtonClicked();
386  };
387 
388 protected:
389  QScopedPointer<qSlicerMarkupsModuleWidgetPrivate> d_ptr;
390 
391  void setup() override;
392 
397 
398 private:
399  Q_DECLARE_PRIVATE(qSlicerMarkupsModuleWidget);
400  Q_DISABLE_COPY(qSlicerMarkupsModuleWidget);
401 };
402 
403 #endif
Q_INVOKABLE bool setEditedNode(vtkMRMLNode *node, QString role=QString(), QString context=QString()) override
Node editing.
qSlicerAbstractModuleWidget Superclass
void onDeleteMarkupPushButtonClicked(bool confirm=true)
QScopedPointer< qSlicerAbstractModuleWidgetPrivate > d_ptr
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
Q_INVOKABLE double nodeEditable(vtkMRMLNode *node) override
virtual Q_INVOKABLE void enter()
virtual Q_INVOKABLE void exit()