Browse Source

Expose ctkDICOMRetrieve class and its methods to be invokable from Python

Nicholas Herlambang 12 years ago
parent
commit
d52f1469ea
2 changed files with 36 additions and 27 deletions
  1. 10 2
      Libs/DICOM/Core/ctkDICOMRetrieve.cpp
  2. 26 25
      Libs/DICOM/Core/ctkDICOMRetrieve.h

+ 10 - 2
Libs/DICOM/Core/ctkDICOMRetrieve.cpp

@@ -503,8 +503,9 @@ bool ctkDICOMRetrievePrivate::get ( const QString& studyInstanceUID,
 // ctkDICOMRetrieve methods
 
 //------------------------------------------------------------------------------
-ctkDICOMRetrieve::ctkDICOMRetrieve()
-   : d_ptr(new ctkDICOMRetrievePrivate(*this))
+ctkDICOMRetrieve::ctkDICOMRetrieve(QObject* parent)
+  : QObject(parent),
+    d_ptr(new ctkDICOMRetrievePrivate(*this))
 {
   Q_D(ctkDICOMRetrieve);
   d->SCU.retrieve = this; // give the dcmtk level access to this for emitting signals
@@ -606,6 +607,13 @@ QString ctkDICOMRetrieve::moveDestinationAETitle()const
 }
 
 //------------------------------------------------------------------------------
+void ctkDICOMRetrieve::setDatabase(ctkDICOMDatabase& dicomDatabase)
+{
+  Q_D(ctkDICOMRetrieve);
+  d->Database = QSharedPointer<ctkDICOMDatabase>(&dicomDatabase);
+}
+
+//------------------------------------------------------------------------------
 void ctkDICOMRetrieve::setDatabase(QSharedPointer<ctkDICOMDatabase> dicomDatabase)
 {
   Q_D(ctkDICOMRetrieve);

+ 26 - 25
Libs/DICOM/Core/ctkDICOMRetrieve.h

@@ -42,60 +42,61 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMRetrieve : public QObject
   Q_PROPERTY(QString calledAETitle READ calledAETitle WRITE setCallingAETitle);
   Q_PROPERTY(QString host READ host WRITE setHost);
   Q_PROPERTY(int port READ port WRITE setPort);
-  Q_PROPERTY(QString moveDestinationAETitle READ moveDestinationAETitle WRITE setMoveDestinationAETitle)
-  Q_PROPERTY(bool keepAssociationOpen READ keepAssociationOpen WRITE setKeepAssociationOpen)
-  Q_PROPERTY(bool wasCanceled READ wasCanceled WRITE setWasCanceled)
+  Q_PROPERTY(QString moveDestinationAETitle READ moveDestinationAETitle WRITE setMoveDestinationAETitle);
+  Q_PROPERTY(bool keepAssociationOpen READ keepAssociationOpen WRITE setKeepAssociationOpen);
+  Q_PROPERTY(bool wasCanceled READ wasCanceled WRITE setWasCanceled);
 
 public:
-  explicit ctkDICOMRetrieve();
+  explicit ctkDICOMRetrieve(QObject* parent = 0);
   virtual ~ctkDICOMRetrieve();
 
   /// Set methods for connectivity
   /// CTK_AE - the AE string by which the peer host might 
   /// recognize your request
-  void setCallingAETitle( const QString& callingAETitle );
-  QString callingAETitle() const;
+  Q_INVOKABLE void setCallingAETitle( const QString& callingAETitle );
+  Q_INVOKABLE QString callingAETitle() const;
   /// CTK_AE - the AE of the serice of peer host that you are calling
   /// which tells the host what you are requesting
-  void setCalledAETitle( const QString& calledAETitle );
-  QString calledAETitle() const;
+  Q_INVOKABLE void setCalledAETitle( const QString& calledAETitle );
+  Q_INVOKABLE QString calledAETitle() const;
   /// peer hostname being connected to
-  void setHost( const QString& host );
-  QString host() const;
+  Q_INVOKABLE void setHost( const QString& host );
+  Q_INVOKABLE QString host() const;
   /// [0, 65365] port on peer host - e.g. 11112
-  void setPort( int port );
-  int port() const;
+  Q_INVOKABLE void setPort( int port );
+  Q_INVOKABLE int port() const;
   /// Typically CTK_STORE or similar - needs to be something that the
   /// peer host knows about and is able to move data into
   /// Only used when calling moveSeries or moveStudy
-  void setMoveDestinationAETitle( const QString& moveDestinationAETitle );
-  QString moveDestinationAETitle() const;
+  Q_INVOKABLE void setMoveDestinationAETitle( const QString& moveDestinationAETitle );
+  Q_INVOKABLE QString moveDestinationAETitle() const;
   /// prefer to keep using the existing association to peer host when doing
   /// multiple requests (default true)
-  void setKeepAssociationOpen(const bool keepOpen);
-  bool keepAssociationOpen();
+  Q_INVOKABLE void setKeepAssociationOpen(const bool keepOpen);
+  Q_INVOKABLE bool keepAssociationOpen();
   /// did someone cancel us during operation?
   /// (default false)
-  void setWasCanceled(const bool wasCanceled);
-  bool wasCanceled();
+  Q_INVOKABLE void setWasCanceled(const bool wasCanceled);
+  Q_INVOKABLE bool wasCanceled();
   /// where to insert new data sets obtained via get (must be set for
-  /// get to succeed
-  Q_INVOKABLE void setDatabase(QSharedPointer<ctkDICOMDatabase> dicomDatabase);
+  /// get to succee
+  Q_INVOKABLE void setDatabase(ctkDICOMDatabase& dicomDatabase);
+  void setDatabase(QSharedPointer<ctkDICOMDatabase> dicomDatabase);
   Q_INVOKABLE QSharedPointer<ctkDICOMDatabase> database()const;
 
 public Q_SLOTS:
   /// Use CMOVE to ask peer host to store data to move destination
-  bool moveSeries( const QString& studyInstanceUID,
+  Q_INVOKABLE bool moveSeries( const QString& studyInstanceUID,
                        const QString& seriesInstanceUID );
   /// Use CMOVE to ask peer host to store data to move destination
-  bool moveStudy( const QString& studyInstanceUID );
+  Q_INVOKABLE bool moveStudy( const QString& studyInstanceUID );
   /// Use CGET to ask peer host to store data to us
-  bool getSeries( const QString& studyInstanceUID,
+  Q_INVOKABLE bool getSeries( const QString& studyInstanceUID,
                        const QString& seriesInstanceUID );
   /// Use CGET to ask peer host to store data to us
-  bool getStudy( const QString& studyInstanceUID );
+  Q_INVOKABLE bool getStudy( const QString& studyInstanceUID );
   /// Cancel the current operation
-  void cancel();
+  Q_INVOKABLE void cancel();
 
 Q_SIGNALS:
   /// Signal is emitted inside the retrieve() function. It ranges from 0 to 100.