ctkDICOMRetrieve.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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();
  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. void setCallingAETitle( const QString& callingAETitle );
  42. 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. void setCalledAETitle( const QString& calledAETitle );
  46. QString calledAETitle() const;
  47. /// peer hostname being connected to
  48. void setHost( const QString& host );
  49. QString host() const;
  50. /// [0, 65365] port on peer host - e.g. 11112
  51. void setPort( int port );
  52. 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. void setMoveDestinationAETitle( const QString& moveDestinationAETitle );
  57. QString moveDestinationAETitle() const;
  58. /// prefer to keep using the existing association to peer host when doing
  59. /// multiple requests (default true)
  60. void setKeepAssociationOpen(const bool keepOpen);
  61. bool keepAssociationOpen();
  62. /// did someone cancel us during operation?
  63. /// (default false)
  64. void setWasCanceled(const bool wasCanceled);
  65. bool wasCanceled();
  66. /// where to insert new data sets obtained via get (must be set for
  67. /// get to succeed
  68. Q_INVOKABLE void setDatabase(QSharedPointer<ctkDICOMDatabase> dicomDatabase);
  69. Q_INVOKABLE QSharedPointer<ctkDICOMDatabase> database()const;
  70. public Q_SLOTS:
  71. /// Use CMOVE to ask peer host to store data to move destination
  72. bool moveSeries( const QString& studyInstanceUID,
  73. const QString& seriesInstanceUID );
  74. /// Use CMOVE to ask peer host to store data to move destination
  75. bool moveStudy( const QString& studyInstanceUID );
  76. /// Use CGET to ask peer host to store data to us
  77. bool getSeries( const QString& studyInstanceUID,
  78. const QString& seriesInstanceUID );
  79. /// Use CGET to ask peer host to store data to us
  80. bool getStudy( const QString& studyInstanceUID );
  81. /// Cancel the current operation
  82. void cancel();
  83. Q_SIGNALS:
  84. /// Signal is emitted inside the retrieve() function. It ranges from 0 to 100.
  85. /// In case of an error, you are assured that the progress value 100 is fired
  86. void progress(int progress);
  87. /// Signal is emitted inside the retrieve() function. It sends the different step
  88. /// the function is at.
  89. void progress(const QString& message);
  90. /// Signal is emitted inside the retrieve() function. It sends
  91. /// detailed feedback for debugging
  92. void debug(const QString& message);
  93. /// Signal is emitted inside the retrieve() function. It send any error messages
  94. void error(const QString& message);
  95. /// Signal is emitted inside the retrieve() function when finished with value
  96. /// true for success or false for error
  97. void done(const bool& error);
  98. protected:
  99. QScopedPointer<ctkDICOMRetrievePrivate> d_ptr;
  100. private:
  101. Q_DECLARE_PRIVATE(ctkDICOMRetrieve);
  102. Q_DISABLE_COPY(ctkDICOMRetrieve);
  103. friend class ctkDICOMRetrieveSCUPrivate; // for access to status signals
  104. };
  105. #endif