ctkDICOMAppWidget.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkDICOMAppWidget_h
  15. #define __ctkDICOMAppWidget_h
  16. // Qt includes
  17. #include <QWidget>
  18. #include "ctkDICOMWidgetsExport.h"
  19. class ctkDICOMAppWidgetPrivate;
  20. class ctkThumbnailLabel;
  21. class QModelIndex;
  22. class ctkDICOMDatabase;
  23. /// \ingroup DICOM_Widgets
  24. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMAppWidget : public QWidget
  25. {
  26. Q_OBJECT
  27. Q_PROPERTY(ctkDICOMDatabase* database READ database)
  28. Q_PROPERTY(QString databaseDirectory READ databaseDirectory WRITE setDatabaseDirectory)
  29. Q_PROPERTY(bool searchWidgetPopUpMode READ searchWidgetPopUpMode WRITE setSearchWidgetPopUpMode)
  30. Q_PROPERTY(QStringList tagsToPrecache READ tagsToPrecache WRITE setTagsToPrecache)
  31. Q_PROPERTY(bool displayImportSummary READ displayImportSummary WRITE setDisplayImportSummary)
  32. public:
  33. typedef QWidget Superclass;
  34. explicit ctkDICOMAppWidget(QWidget* parent=0);
  35. virtual ~ctkDICOMAppWidget();
  36. /// Directory being used to store the dicom database
  37. QString databaseDirectory() const;
  38. /// See ctkDICOMDatabase for description - these accessors
  39. /// delegate to the corresponding routines of the internal
  40. /// instance of the database.
  41. /// @see ctkDICOMDatabase
  42. void setTagsToPrecache(const QStringList tags);
  43. const QStringList tagsToPrecache();
  44. /// Updates schema of loaded database to match the one
  45. /// coded by the current version of ctkDICOMDatabase.
  46. /// Also provides a dialog box for progress
  47. void updateDatabaseSchemaIfNeeded();
  48. /// Setting search widget pop-up mode
  49. /// Default value is false. Setting it to true will make
  50. /// search widget to be displayed as pop-up widget
  51. void setSearchWidgetPopUpMode(bool flag);
  52. bool searchWidgetPopUpMode();
  53. ctkDICOMDatabase* database();
  54. /// Option to show or not import summary dialog.
  55. /// Since the summary dialog is modal, we give the option
  56. /// of disabling it for batch modes or testing.
  57. void setDisplayImportSummary(bool);
  58. bool displayImportSummary();
  59. /// Accessors to status of last directory import operation
  60. int patientsAddedDuringImport();
  61. int studiesAddedDuringImport();
  62. int seriesAddedDuringImport();
  63. int instancesAddedDuringImport();
  64. public Q_SLOTS:
  65. void setDatabaseDirectory(const QString& directory);
  66. void onFileIndexed(const QString& filePath);
  67. void openImportDialog();
  68. void openExportDialog();
  69. void openQueryDialog();
  70. void onRemoveAction();
  71. void suspendModel();
  72. void resumeModel();
  73. void resetModel();
  74. /// Import a directory - this is used when the user selects a directory
  75. /// from the Import Dialog, but can also be used externally to trigger
  76. /// an import (i.e. for testing or to support drag-and-drop)
  77. void onImportDirectory(QString directory);
  78. /// slots to capture status updates from the database during an
  79. /// import operation
  80. void onPatientAdded(int, QString, QString, QString);
  81. void onStudyAdded(QString);
  82. void onSeriesAdded(QString);
  83. void onInstanceAdded(QString);
  84. Q_SIGNALS:
  85. /// Emited when directory is changed
  86. void databaseDirectoryChanged(const QString&);
  87. /// Emited when query/retrieve operation has happened
  88. void queryRetrieveFinished();
  89. /// Emited when the directory import operation has completed
  90. void directoryImported();
  91. protected:
  92. QScopedPointer<ctkDICOMAppWidgetPrivate> d_ptr;
  93. protected Q_SLOTS:
  94. void onModelSelected(const QModelIndex& index);
  95. /// To be called when a thumbnail in thumbnail list widget is selected
  96. void onThumbnailSelected(const ctkThumbnailLabel& widget);
  97. /// To be called when a thumbnail in thumbnail list widget is double-clicked
  98. void onThumbnailDoubleClicked(const ctkThumbnailLabel& widget);
  99. /// To be called when previous and next buttons are clicked
  100. void onNextImage();
  101. void onPreviousImage();
  102. void onNextSeries();
  103. void onPreviousSeries();
  104. void onNextStudy();
  105. void onPreviousStudy();
  106. /// To be called when dialog finishes
  107. void onQueryRetrieveFinished();
  108. /// To be called when an entry of the tree list is collapsed
  109. void onTreeCollapsed(const QModelIndex& index);
  110. /// To be called when an entry of the tree list is expanded
  111. void onTreeExpanded(const QModelIndex& index);
  112. /// To be called when auto-play checkbox state changed
  113. void onAutoPlayCheckboxStateChanged(int state);
  114. /// Called by timer for auto-play functionality
  115. void onAutoPlayTimer();
  116. /// To be called when the value of thumbnail size slider bar is changed
  117. void onThumbnailWidthSliderValueChanged(int val);
  118. /// To be called when search parameters in query widget changed
  119. void onSearchParameterChanged();
  120. /// To be called after image preview displayed an image
  121. void onImagePreviewDisplayed(int imageID, int count);
  122. private Q_SLOTS:
  123. void onSearchPopUpButtonClicked();
  124. void onSearchWidgetTopLevelChanged(bool topLevel);
  125. private:
  126. Q_DECLARE_PRIVATE(ctkDICOMAppWidget);
  127. Q_DISABLE_COPY(ctkDICOMAppWidget);
  128. };
  129. #endif