ctkDICOMBrowser.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. /// \ingroup DICOM_Widgets
  25. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMBrowser : public QWidget
  26. {
  27. Q_OBJECT
  28. Q_PROPERTY(ctkDICOMDatabase* database READ database)
  29. Q_PROPERTY(QString databaseDirectory READ databaseDirectory WRITE setDatabaseDirectory)
  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 ctkDICOMBrowser(QWidget* parent=0);
  35. virtual ~ctkDICOMBrowser();
  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. ctkDICOMDatabase* database();
  49. /// Option to show or not import summary dialog.
  50. /// Since the summary dialog is modal, we give the option
  51. /// of disabling it for batch modes or testing.
  52. void setDisplayImportSummary(bool);
  53. bool displayImportSummary();
  54. /// Accessors to status of last directory import operation
  55. int patientsAddedDuringImport();
  56. int studiesAddedDuringImport();
  57. int seriesAddedDuringImport();
  58. int instancesAddedDuringImport();
  59. public Q_SLOTS:
  60. void setDatabaseDirectory(const QString& directory);
  61. void onFileIndexed(const QString& filePath);
  62. void openImportDialog();
  63. void openExportDialog();
  64. void openQueryDialog();
  65. void onRemoveAction();
  66. /// Import a directory - this is used when the user selects a directory
  67. /// from the Import Dialog, but can also be used externally to trigger
  68. /// an import (i.e. for testing or to support drag-and-drop)
  69. void onImportDirectory(QString directory);
  70. /// slots to capture status updates from the database during an
  71. /// import operation
  72. void onPatientAdded(int, QString, QString, QString);
  73. void onStudyAdded(QString);
  74. void onSeriesAdded(QString);
  75. void onInstanceAdded(QString);
  76. Q_SIGNALS:
  77. /// Emited when directory is changed
  78. void databaseDirectoryChanged(const QString&);
  79. /// Emited when query/retrieve operation has happened
  80. void queryRetrieveFinished();
  81. /// Emited when the directory import operation has completed
  82. void directoryImported();
  83. protected:
  84. QScopedPointer<ctkDICOMBrowserPrivate> d_ptr;
  85. protected Q_SLOTS:
  86. void onModelSelected(const QItemSelection&, const QItemSelection&);
  87. /// To be called when dialog finishes
  88. void onQueryRetrieveFinished();
  89. private:
  90. Q_DECLARE_PRIVATE(ctkDICOMBrowser);
  91. Q_DISABLE_COPY(ctkDICOMBrowser);
  92. };
  93. #endif