ctkDICOMIndexer.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 __ctkDICOMIndexer_h
  15. #define __ctkDICOMIndexer_h
  16. // Qt includes
  17. #include <QObject>
  18. #include <QSqlDatabase>
  19. #include "ctkDICOMCoreExport.h"
  20. #include "ctkDICOMDatabase.h"
  21. class ctkDICOMIndexerPrivate;
  22. /// \ingroup DICOM_Core
  23. ///
  24. /// \brief Indexes DICOM images located in local directory into an Sql database
  25. ///
  26. class CTK_DICOM_CORE_EXPORT ctkDICOMIndexer : public QObject
  27. {
  28. Q_OBJECT
  29. public:
  30. explicit ctkDICOMIndexer(QObject *parent = 0);
  31. virtual ~ctkDICOMIndexer();
  32. ///
  33. /// \brief Adds directory to database and optionally copies files to
  34. /// destinationDirectory.
  35. ///
  36. /// Scan the directory using Dcmtk and populate the database with all the
  37. /// DICOM images accordingly.
  38. ///
  39. Q_INVOKABLE void addDirectory(ctkDICOMDatabase& database, const QString& directoryName,
  40. const QString& destinationDirectoryName = "");
  41. ///
  42. /// \brief Adds directory to database by using DICOMDIR and optionally copies files to
  43. /// destinationDirectory.
  44. /// Scan the directory using Dcmtk and populate the database with all the
  45. /// DICOM images accordingly.
  46. /// \return Returns false if there was an error while processing the DICOMDIR file.
  47. ///
  48. Q_INVOKABLE bool addDicomdir(ctkDICOMDatabase& database, const QString& directoryName,
  49. const QString& destinationDirectoryName = "");
  50. ///
  51. /// \brief Adds a QStringList containing the file path to database and optionally copies files to
  52. /// destinationDirectory.
  53. ///
  54. /// Scan the directory using Dcmtk and populate the database with all the
  55. /// DICOM images accordingly.
  56. ///
  57. Q_INVOKABLE void addListOfFiles(ctkDICOMDatabase& database, const QStringList& listOfFiles,
  58. const QString& destinationDirectoryName = "");
  59. ///
  60. /// \brief Adds a file to database and optionally copies the file to
  61. /// destinationDirectory.
  62. ///
  63. /// Scan the file using Dcmtk and populate the database with all the
  64. /// DICOM fields accordingly.
  65. ///
  66. Q_INVOKABLE void addFile(ctkDICOMDatabase& database, const QString filePath,
  67. const QString& destinationDirectoryName = "");
  68. Q_INVOKABLE void refreshDatabase(ctkDICOMDatabase& database, const QString& directoryName);
  69. ///
  70. /// \brief Deprecated - no op.
  71. /// \deprecated
  72. /// Previously ensured that the QFuture threads have all finished indexing
  73. /// before returning control.
  74. ///
  75. Q_INVOKABLE void waitForImportFinished();
  76. Q_SIGNALS:
  77. void foundFilesToIndex(int);
  78. void indexingFileNumber(int);
  79. void indexingFilePath(QString);
  80. void progress(int);
  81. void indexingComplete();
  82. public Q_SLOTS:
  83. void cancel();
  84. protected:
  85. QScopedPointer<ctkDICOMIndexerPrivate> d_ptr;
  86. private:
  87. Q_DECLARE_PRIVATE(ctkDICOMIndexer);
  88. Q_DISABLE_COPY(ctkDICOMIndexer);
  89. };
  90. #endif