ctkDICOMIndexer.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 a file to database and optionally copies the file to
  43. /// destinationDirectory.
  44. ///
  45. /// Scan the file using Dcmtk and populate the database with all the
  46. /// DICOM fields accordingly.
  47. ///
  48. Q_INVOKABLE void addFile(ctkDICOMDatabase& database, const QString& filePath,
  49. const QString& destinationDirectoryName = "");
  50. Q_INVOKABLE void refreshDatabase(ctkDICOMDatabase& database, const QString& directoryName);
  51. Q_SIGNALS:
  52. void foundFilesToIndex(int);
  53. void indexingFileNumber(int);
  54. void indexingFilePath(QString);
  55. void progress(int);
  56. public Q_SLOTS:
  57. void cancel();
  58. protected:
  59. QScopedPointer<ctkDICOMIndexerPrivate> d_ptr;
  60. private:
  61. Q_DECLARE_PRIVATE(ctkDICOMIndexer);
  62. Q_DISABLE_COPY(ctkDICOMIndexer);
  63. };
  64. #endif