ctkDICOMQuery.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 __ctkDICOMQuery_h
  15. #define __ctkDICOMQuery_h
  16. // Qt includes
  17. #include <QObject>
  18. #include <QMap>
  19. #include <QString>
  20. #include <QSqlDatabase>
  21. // CTK includes
  22. #include <ctkPimpl.h>
  23. #include "ctkDICOMCoreExport.h"
  24. #include "ctkDICOMDatabase.h"
  25. class ctkDICOMQueryPrivate;
  26. /// \ingroup DICOM_Core
  27. class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(QString callingAETitle READ callingAETitle WRITE setCallingAETitle);
  31. Q_PROPERTY(QString calledAETitle READ calledAETitle WRITE setCallingAETitle);
  32. Q_PROPERTY(QString host READ host WRITE setHost);
  33. Q_PROPERTY(int port READ port WRITE setPort);
  34. Q_PROPERTY(bool preferCGET READ preferCGET WRITE setPreferCGET);
  35. public:
  36. explicit ctkDICOMQuery(QObject* parent = 0);
  37. virtual ~ctkDICOMQuery();
  38. /// Set methods for connectivity
  39. /// Empty by default
  40. void setCallingAETitle ( const QString& callingAETitle );
  41. QString callingAETitle()const;
  42. /// Empty by default
  43. void setCalledAETitle ( const QString& calledAETitle );
  44. QString calledAETitle()const;
  45. /// Empty by default
  46. void setHost ( const QString& host );
  47. QString host()const;
  48. /// Specify a port for the packet headers.
  49. /// \a port ranges from 0 to 65535.
  50. /// 0 by default.
  51. void setPort ( int port );
  52. int port()const;
  53. /// Prefer CGET over CMOVE for retrieval of query results
  54. /// false by default
  55. void setPreferCGET ( bool preferCGET );
  56. bool preferCGET()const;
  57. /// Query a remote DICOM Image Store SCP
  58. /// You must at least set the host and port before calling query()
  59. bool query(ctkDICOMDatabase& database);
  60. /// Access the list of study instance UIDs from the last query
  61. QStringList studyInstanceUIDQueried()const;
  62. ///
  63. /// Filters are keyword/value pairs as generated by
  64. /// the ctkDICOMWidgets in a human readable (and editable)
  65. /// format. The Query is responsible for converting these
  66. /// into the appropriate dicom syntax for the C-Find
  67. /// Currently supports the keys: Name, Study, Series, ID, Modalities,
  68. /// StartDate and EndDate
  69. /// Key DICOM Tag Type Example
  70. /// -----------------------------------------------------------
  71. /// Name DCM_PatientName QString JOHNDOE
  72. /// Study DCM_StudyDescription QString
  73. /// Series DCM_SeriesDescription QString
  74. /// ID DCM_PatientID QString
  75. /// Modalities DCM_ModalitiesInStudy QStringList CT, MR, MN
  76. /// StartDate DCM_StudyDate QString 20090101
  77. /// EndDate DCM_StudyDate QString 20091231
  78. /// No filter (empty) by default.
  79. void setFilters(const QMap<QString,QVariant>&);
  80. QMap<QString,QVariant> filters()const;
  81. Q_SIGNALS:
  82. /// Signal is emitted inside the query() function. It ranges from 0 to 100.
  83. /// In case of an error, you are assured that the progress value 100 is fired
  84. void progress(int progress);
  85. /// Signal is emitted inside the query() function. It sends the different step
  86. /// the function is at.
  87. void progress(const QString& message);
  88. /// Signal is emitted inside the query() function. It sends
  89. /// detailed feedback for debugging
  90. void debug(const QString& message);
  91. /// Signal is emitted inside the query() function. It send any error messages
  92. void error(const QString& message);
  93. /// Signal is emitted inside the query() function when finished with value
  94. /// true for success or false for error
  95. void done(const bool& error);
  96. public Q_SLOTS:
  97. void cancel();
  98. protected:
  99. QScopedPointer<ctkDICOMQueryPrivate> d_ptr;
  100. private:
  101. Q_DECLARE_PRIVATE(ctkDICOMQuery);
  102. Q_DISABLE_COPY(ctkDICOMQuery);
  103. friend class ctkDICOMQuerySCUPrivate; // for access to queryResponseHandled
  104. };
  105. #endif