ctkDICOMQuery.h 4.2 KB

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