ctkDICOMBrowser.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 __ctkDICOMBrowser_h
  15. #define __ctkDICOMBrowser_h
  16. // Qt includes
  17. #include <QItemSelection>
  18. #include <QWidget>
  19. #include "ctkDICOMWidgetsExport.h"
  20. class ctkDICOMBrowserPrivate;
  21. class ctkThumbnailLabel;
  22. class QMenu;
  23. class QModelIndex;
  24. class ctkDICOMDatabase;
  25. class ctkDICOMTableManager;
  26. /// \ingroup DICOM_Widgets
  27. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMBrowser : public QWidget
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(ctkDICOMDatabase* database READ database)
  31. Q_PROPERTY(QString databaseDirectory READ databaseDirectory WRITE setDatabaseDirectory)
  32. Q_PROPERTY(QStringList tagsToPrecache READ tagsToPrecache WRITE setTagsToPrecache)
  33. Q_PROPERTY(bool displayImportSummary READ displayImportSummary WRITE setDisplayImportSummary)
  34. Q_PROPERTY(ctkDICOMTableManager* dicomTableManager READ dicomTableManager)
  35. public:
  36. typedef QWidget Superclass;
  37. explicit ctkDICOMBrowser(QWidget* parent=0);
  38. virtual ~ctkDICOMBrowser();
  39. /// Directory being used to store the dicom database
  40. QString databaseDirectory() const;
  41. /// See ctkDICOMDatabase for description - these accessors
  42. /// delegate to the corresponding routines of the internal
  43. /// instance of the database.
  44. /// @see ctkDICOMDatabase
  45. void setTagsToPrecache(const QStringList tags);
  46. const QStringList tagsToPrecache();
  47. /// Updates schema of loaded database to match the one
  48. /// coded by the current version of ctkDICOMDatabase.
  49. /// Also provides a dialog box for progress
  50. void updateDatabaseSchemaIfNeeded();
  51. ctkDICOMDatabase* database();
  52. ctkDICOMTableManager* dicomTableManager();
  53. /// Option to show or not import summary dialog.
  54. /// Since the summary dialog is modal, we give the option
  55. /// of disabling it for batch modes or testing.
  56. void setDisplayImportSummary(bool);
  57. bool displayImportSummary();
  58. /// Accessors to status of last directory import operation
  59. int patientsAddedDuringImport();
  60. int studiesAddedDuringImport();
  61. int seriesAddedDuringImport();
  62. int instancesAddedDuringImport();
  63. public Q_SLOTS:
  64. void setDatabaseDirectory(const QString& directory);
  65. void onFileIndexed(const QString& filePath);
  66. void openImportDialog();
  67. void openExportDialog();
  68. void openQueryDialog();
  69. void onRemoveAction();
  70. void onRepairAction();
  71. void onTablesDensityComboBox(QString);
  72. /// Import a directory - this is used when the user selects a directory
  73. /// from the Import Dialog, but can also be used externally to trigger
  74. /// an import (i.e. for testing or to support drag-and-drop)
  75. void onImportDirectory(QString directory);
  76. /// slots to capture status updates from the database during an
  77. /// import operation
  78. void onPatientAdded(int, QString, QString, QString);
  79. void onStudyAdded(QString);
  80. void onSeriesAdded(QString);
  81. void onInstanceAdded(QString);
  82. Q_SIGNALS:
  83. /// Emited when directory is changed
  84. void databaseDirectoryChanged(const QString&);
  85. /// Emited when query/retrieve operation has happened
  86. void queryRetrieveFinished();
  87. /// Emited when the directory import operation has completed
  88. void directoryImported();
  89. protected:
  90. QScopedPointer<ctkDICOMBrowserPrivate> d_ptr;
  91. /// Confirm with the user that they wish to delete the selected uids.
  92. /// Add information about the selected UIDs to a message box, checks
  93. /// for patient name, series description, study description, if all
  94. /// empty, uses the UID.
  95. /// Returns true if the user confirms the delete, false otherwise.
  96. /// Remembers if the user doesn't want to show the confirmation again.
  97. bool confirmDeleteSelectedUIDs(QStringList uids);
  98. protected Q_SLOTS:
  99. void onModelSelected(const QItemSelection&, const QItemSelection&);
  100. /// Called when a right mouse click is made in the patients table
  101. void onPatientsRightClicked(const QPoint &point);
  102. /// Called when a right mouse click is made in the studies table
  103. void onStudiesRightClicked(const QPoint &point);
  104. /// Called when a right mouse click is made in the series table
  105. void onSeriesRightClicked(const QPoint &point);
  106. /// Called to export the series associated with the selected UIDs
  107. /// \sa exportSelectedStudies, exportSelectedPatients
  108. void exportSelectedSeries(QString dirPath, QStringList uids);
  109. /// Called to export the studies associated with the selected UIDs
  110. /// \sa exportSelectedSeries, exportSelectedPatients
  111. void exportSelectedStudies(QString dirPath, QStringList uids);
  112. /// Called to export the patients associated with the selected UIDs
  113. /// \sa exportSelectedStudies, exportSelectedSeries
  114. void exportSelectedPatients(QString dirPath, QStringList uids);
  115. /// To be called when dialog finishes
  116. void onQueryRetrieveFinished();
  117. private:
  118. Q_DECLARE_PRIVATE(ctkDICOMBrowser);
  119. Q_DISABLE_COPY(ctkDICOMBrowser);
  120. };
  121. #endif