ctkDICOMBrowser.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 QModelIndex;
  23. class ctkDICOMDatabase;
  24. class ctkDICOMTableManager;
  25. /// \ingroup DICOM_Widgets
  26. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMBrowser : public QWidget
  27. {
  28. Q_OBJECT
  29. Q_PROPERTY(ctkDICOMDatabase* database READ database)
  30. Q_PROPERTY(QString databaseDirectory READ databaseDirectory WRITE setDatabaseDirectory)
  31. Q_PROPERTY(QStringList tagsToPrecache READ tagsToPrecache WRITE setTagsToPrecache)
  32. Q_PROPERTY(bool displayImportSummary READ displayImportSummary WRITE setDisplayImportSummary)
  33. Q_PROPERTY(ctkDICOMTableManager* dicomTableManager READ dicomTableManager)
  34. public:
  35. typedef QWidget Superclass;
  36. explicit ctkDICOMBrowser(QWidget* parent=0);
  37. virtual ~ctkDICOMBrowser();
  38. /// Directory being used to store the dicom database
  39. QString databaseDirectory() const;
  40. /// See ctkDICOMDatabase for description - these accessors
  41. /// delegate to the corresponding routines of the internal
  42. /// instance of the database.
  43. /// @see ctkDICOMDatabase
  44. void setTagsToPrecache(const QStringList tags);
  45. const QStringList tagsToPrecache();
  46. /// Updates schema of loaded database to match the one
  47. /// coded by the current version of ctkDICOMDatabase.
  48. /// Also provides a dialog box for progress
  49. void updateDatabaseSchemaIfNeeded();
  50. ctkDICOMDatabase* database();
  51. ctkDICOMTableManager* dicomTableManager();
  52. /// Option to show or not import summary dialog.
  53. /// Since the summary dialog is modal, we give the option
  54. /// of disabling it for batch modes or testing.
  55. void setDisplayImportSummary(bool);
  56. bool displayImportSummary();
  57. /// Accessors to status of last directory import operation
  58. int patientsAddedDuringImport();
  59. int studiesAddedDuringImport();
  60. int seriesAddedDuringImport();
  61. int instancesAddedDuringImport();
  62. public Q_SLOTS:
  63. void setDatabaseDirectory(const QString& directory);
  64. void onFileIndexed(const QString& filePath);
  65. void openImportDialog();
  66. void openExportDialog();
  67. void openQueryDialog();
  68. void onRemoveAction();
  69. void onRepairAction();
  70. void onTablesDensityComboBox(QString);
  71. /// Import a directory - this is used when the user selects a directory
  72. /// from the Import Dialog, but can also be used externally to trigger
  73. /// an import (i.e. for testing or to support drag-and-drop)
  74. void onImportDirectory(QString directory);
  75. /// slots to capture status updates from the database during an
  76. /// import operation
  77. void onPatientAdded(int, QString, QString, QString);
  78. void onStudyAdded(QString);
  79. void onSeriesAdded(QString);
  80. void onInstanceAdded(QString);
  81. Q_SIGNALS:
  82. /// Emited when directory is changed
  83. void databaseDirectoryChanged(const QString&);
  84. /// Emited when query/retrieve operation has happened
  85. void queryRetrieveFinished();
  86. /// Emited when the directory import operation has completed
  87. void directoryImported();
  88. protected:
  89. QScopedPointer<ctkDICOMBrowserPrivate> d_ptr;
  90. protected Q_SLOTS:
  91. void onModelSelected(const QItemSelection&, const QItemSelection&);
  92. /// To be called when dialog finishes
  93. void onQueryRetrieveFinished();
  94. private:
  95. Q_DECLARE_PRIVATE(ctkDICOMBrowser);
  96. Q_DISABLE_COPY(ctkDICOMBrowser);
  97. };
  98. #endif