ctkDICOMIndexer.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. ///
  23. /// \brief Indexes DICOM images located in local directory into an Sql database
  24. ///
  25. class CTK_DICOM_CORE_EXPORT ctkDICOMIndexer : public QObject
  26. {
  27. Q_OBJECT
  28. public:
  29. explicit ctkDICOMIndexer(QObject *parent = 0);
  30. virtual ~ctkDICOMIndexer();
  31. ///
  32. /// \brief Adds directory to database and optionally copies files to
  33. /// destinationDirectory.
  34. ///
  35. /// Scan the directory using Dcmtk and populate the database with all the
  36. /// DICOM images accordingly.
  37. ///
  38. Q_INVOKABLE void addDirectory(ctkDICOMDatabase& database, const QString& directoryName,
  39. const QString& destinationDirectoryName = "");
  40. ///
  41. /// \brief Adds a file to database and optionally copies the file to
  42. /// destinationDirectory.
  43. ///
  44. /// Scan the file using Dcmtk and populate the database with all the
  45. /// DICOM fields accordingly.
  46. ///
  47. Q_INVOKABLE void addFile(ctkDICOMDatabase& database, const QString& filePath,
  48. const QString& destinationDirectoryName = "");
  49. Q_INVOKABLE void refreshDatabase(ctkDICOMDatabase& database, const QString& directoryName);
  50. Q_SIGNALS:
  51. void foundFilesToIndex(int);
  52. void indexingFileNumber(int);
  53. void indexingFilePath(QString);
  54. void progress(int);
  55. protected:
  56. QScopedPointer<ctkDICOMIndexerPrivate> d_ptr;
  57. private:
  58. Q_DECLARE_PRIVATE(ctkDICOMIndexer);
  59. Q_DISABLE_COPY(ctkDICOMIndexer);
  60. };
  61. #endif