ctkDICOMTester.h 3.3 KB

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