ctkDICOMTester.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010
  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 __ctkDICOMTester_h
  15. #define __ctkDICOMTester_h
  16. // Qt includes
  17. #include <QObject>
  18. class QProcess;
  19. // CTKDICOMCore includes
  20. #include "ctkDICOMCoreExport.h"
  21. class ctkDICOMTesterPrivate;
  22. /// \ingroup DICOM_Core
  23. ///
  24. /// \brief Utility class to test DICOM network applications
  25. /// A simple DICOM archive server can be run (startDCMQRSCP()), and images
  26. /// can be stored into the server using storeData(). It internally uses
  27. /// storeSCU.
  28. ///
  29. class CTK_DICOM_CORE_EXPORT ctkDICOMTester : public QObject
  30. {
  31. Q_OBJECT
  32. Q_PROPERTY(QString dcmqrscpExecutable READ dcmqrscpExecutable WRITE setDCMQRSCPExecutable)
  33. Q_PROPERTY(QString dcmqrscpConfigFile READ dcmqrscpConfigFile WRITE setDCMQRSCPConfigFile)
  34. Q_PROPERTY(QString storeSCUExecutable READ storeSCUExecutable WRITE setStoreSCUExecutable)
  35. Q_PROPERTY(QString storeSCPExecutable READ storeSCPExecutable WRITE setStoreSCPExecutable)
  36. Q_PROPERTY(int dcmqrscpPort READ dcmqrscpPort WRITE setDCMQRSCPPort)
  37. public:
  38. ctkDICOMTester(QObject* parent = 0);
  39. explicit ctkDICOMTester(const QString& dcmqrscp, const QString& configFile, QObject* parent = 0);
  40. virtual ~ctkDICOMTester();
  41. void setDCMQRSCPExecutable(const QString& dcmqrscp);
  42. QString dcmqrscpExecutable()const;
  43. void setDCMQRSCPConfigFile(const QString& configFile);
  44. QString dcmqrscpConfigFile()const;
  45. void setStoreSCUExecutable(const QString& storescu);
  46. QString storeSCUExecutable()const;
  47. void setStoreSCPExecutable(const QString& storescp);
  48. QString storeSCPExecutable()const;
  49. /// Port number [0,65365] where the dcmqrscp and storescu communicate.
  50. /// Changing the port won't change the port of any running process.
  51. /// You must stop and restart any process you want to have its port changed
  52. ///
  53. void setDCMQRSCPPort(int port);
  54. int dcmqrscpPort()const;
  55. /// Starts a new DCMQRSCP as a separate process. The process is running until
  56. /// stopDCMQRSCP is called or ctkDICOMTester is destroyed.
  57. /// Only one process of DCMQRSCP can be running at a time.
  58. /// Calling startDCMQRSCP() while a DCMQRSCP process is already running
  59. /// results into a no-op. The return value is 0.
  60. /// \sa QProcess::start(),
  61. ///
  62. Q_INVOKABLE QProcess* startDCMQRSCP();
  63. /// Stop the running DCMQRSCP process. Returns it's exit status or false if
  64. /// there is no running process.
  65. ///
  66. Q_INVOKABLE bool stopDCMQRSCP();
  67. /// Pushes data (DCM images referred to by file name in data list) using DCMTK
  68. /// storeSCU app. It creates a separate process and waits for its termination.
  69. /// To be working, dcmqrscp must be running
  70. /// \sa startDCMQRSCP()
  71. ///
  72. Q_INVOKABLE bool storeData(const QStringList& data);
  73. protected:
  74. QScopedPointer<ctkDICOMTesterPrivate> d_ptr;
  75. private:
  76. Q_DECLARE_PRIVATE(ctkDICOMTester);
  77. Q_DISABLE_COPY(ctkDICOMTester);
  78. };
  79. #endif