ctkDICOMRetrieve.h 5.0 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 __ctkDICOMRetrieve_h
  15. #define __ctkDICOMRetrieve_h
  16. // Qt includes
  17. #include <QObject>
  18. #include <QDir>
  19. #include <QSharedPointer>
  20. #include "ctkDICOMCoreExport.h"
  21. // CTK Core includes
  22. #include "ctkDICOMDatabase.h"
  23. class ctkDICOMRetrievePrivate;
  24. /// \ingroup DICOM_Core
  25. class CTK_DICOM_CORE_EXPORT ctkDICOMRetrieve : public QObject
  26. {
  27. Q_OBJECT
  28. Q_PROPERTY(QString callingAETitle READ callingAETitle WRITE setCallingAETitle);
  29. Q_PROPERTY(QString calledAETitle READ calledAETitle WRITE setCallingAETitle);
  30. Q_PROPERTY(QString host READ host WRITE setHost);
  31. Q_PROPERTY(int port READ port WRITE setPort);
  32. Q_PROPERTY(QString moveDestinationAETitle READ moveDestinationAETitle WRITE setMoveDestinationAETitle);
  33. Q_PROPERTY(bool keepAssociationOpen READ keepAssociationOpen WRITE setKeepAssociationOpen);
  34. Q_PROPERTY(bool wasCanceled READ wasCanceled WRITE setWasCanceled);
  35. public:
  36. explicit ctkDICOMRetrieve(QObject* parent = 0);
  37. virtual ~ctkDICOMRetrieve();
  38. /// Set methods for connectivity
  39. /// CTK_AE - the AE string by which the peer host might
  40. /// recognize your request
  41. Q_INVOKABLE void setCallingAETitle( const QString& callingAETitle );
  42. Q_INVOKABLE QString callingAETitle() const;
  43. /// CTK_AE - the AE of the serice of peer host that you are calling
  44. /// which tells the host what you are requesting
  45. Q_INVOKABLE void setCalledAETitle( const QString& calledAETitle );
  46. Q_INVOKABLE QString calledAETitle() const;
  47. /// peer hostname being connected to
  48. Q_INVOKABLE void setHost( const QString& host );
  49. Q_INVOKABLE QString host() const;
  50. /// [0, 65365] port on peer host - e.g. 11112
  51. Q_INVOKABLE void setPort( int port );
  52. Q_INVOKABLE int port() const;
  53. /// Typically CTK_STORE or similar - needs to be something that the
  54. /// peer host knows about and is able to move data into
  55. /// Only used when calling moveSeries or moveStudy
  56. Q_INVOKABLE void setMoveDestinationAETitle( const QString& moveDestinationAETitle );
  57. Q_INVOKABLE QString moveDestinationAETitle() const;
  58. /// prefer to keep using the existing association to peer host when doing
  59. /// multiple requests (default true)
  60. Q_INVOKABLE void setKeepAssociationOpen(const bool keepOpen);
  61. Q_INVOKABLE bool keepAssociationOpen();
  62. /// did someone cancel us during operation?
  63. /// (default false)
  64. Q_INVOKABLE void setWasCanceled(const bool wasCanceled);
  65. Q_INVOKABLE bool wasCanceled();
  66. /// where to insert new data sets obtained via get (must be set for
  67. /// get to succee
  68. Q_INVOKABLE void setDatabase(ctkDICOMDatabase& dicomDatabase);
  69. void setDatabase(QSharedPointer<ctkDICOMDatabase> dicomDatabase);
  70. Q_INVOKABLE QSharedPointer<ctkDICOMDatabase> database()const;
  71. public Q_SLOTS:
  72. /// Use CMOVE to ask peer host to store data to move destination
  73. Q_INVOKABLE bool moveSeries( const QString& studyInstanceUID,
  74. const QString& seriesInstanceUID );
  75. /// Use CMOVE to ask peer host to store data to move destination
  76. Q_INVOKABLE bool moveStudy( const QString& studyInstanceUID );
  77. /// Use CGET to ask peer host to store data to us
  78. Q_INVOKABLE bool getSeries( const QString& studyInstanceUID,
  79. const QString& seriesInstanceUID );
  80. /// Use CGET to ask peer host to store data to us
  81. Q_INVOKABLE bool getStudy( const QString& studyInstanceUID );
  82. /// Cancel the current operation
  83. Q_INVOKABLE void cancel();
  84. Q_SIGNALS:
  85. /// Signal is emitted inside the retrieve() function. It ranges from 0 to 100.
  86. /// In case of an error, you are assured that the progress value 100 is fired
  87. void progress(int progress);
  88. /// Signal is emitted inside the retrieve() function. It sends the different step
  89. /// the function is at.
  90. void progress(const QString& message);
  91. /// Signal is emitted inside the retrieve() function. It sends
  92. /// detailed feedback for debugging
  93. void debug(const QString& message);
  94. /// Signal is emitted inside the retrieve() function. It send any error messages
  95. void error(const QString& message);
  96. /// Signal is emitted inside the retrieve() function when finished with value
  97. /// true for success or false for error
  98. void done(const bool& error);
  99. protected:
  100. QScopedPointer<ctkDICOMRetrievePrivate> d_ptr;
  101. private:
  102. Q_DECLARE_PRIVATE(ctkDICOMRetrieve);
  103. Q_DISABLE_COPY(ctkDICOMRetrieve);
  104. friend class ctkDICOMRetrieveSCUPrivate; // for access to status signals
  105. };
  106. #endif