ctkDICOMRetrieve.h 4.7 KB

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