QtDcmMoveScu.h
Go to the documentation of this file.
1 /*
2  QtDcm is a C++ Qt based library for communication and conversion of Dicom images.
3  Copyright (C) 2011 Alexandre Abadie <Alexandre.Abadie@univ-rennes1.fr>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 
21 #ifndef QTDCMMOVESCU_H_
22 #define QTDCMMOVESCU_H_
23 
24 #include <QtGui>
25 #include <dcmtk/ofstd/ofstd.h>
26 #include <dcmtk/ofstd/ofconapp.h>
27 #include <dcmtk/dcmnet/dicom.h>
28 #include <dcmtk/dcmnet/dimse.h>
29 #include <dcmtk/dcmnet/diutil.h>
30 #include <dcmtk/dcmdata/dcfilefo.h>
31 #include <dcmtk/dcmdata/dcuid.h>
32 #include <dcmtk/dcmdata/dcdict.h>
33 #include <dcmtk/dcmdata/cmdlnarg.h>
34 #include <dcmtk/dcmdata/dcdeftag.h>
35 #include <dcmtk/dcmdata/dcmetinf.h>
36 #include <dcmtk/dcmdata/dcuid.h> /* for dcmtk version name */
37 #include <dcmtk/dcmdata/dcdicent.h>
38 #include <dcmtk/dcmdata/dcostrmz.h> /* for dcmZlibCompressionLevel */
39 
40 #define INCLUDE_CSTDLIB
41 #define INCLUDE_CSTDIO
42 #define INCLUDE_CSTRING
43 #define INCLUDE_CSTDARG
44 #define INCLUDE_CERRNO
45 #define INCLUDE_CCTYPE
46 #define INCLUDE_CSIGNAL
47 
48 #include <QtDcmConvert.h>
49 
50 class QtDcmMoveScu : public QThread
51 {
52  Q_OBJECT
53 
54 public:
55  typedef struct
56  {
57  T_ASC_Association *assoc;
58  T_ASC_PresentationContextID presId;
60 
61  typedef enum
62  {
66  } QueryModel;
67 
68  typedef struct
69  {
70  const char *findSyntax;
71  const char *moveSyntax;
72  } QuerySyntax;
73 
74  enum eMoveMode {
75  IMPORT = 0,
77  };
78 
79  QtDcmMoveScu ( QObject * parent = 0);
80 
81  virtual ~QtDcmMoveScu();
82 
83  void setMode ( eMoveMode eMoveMode );
84 
85  void setImageId ( const QString & id );
86 
87  void setOutputDir ( const QString & dir );
88 
89  void setImportDir ( const QString & dir );
90 
91  void setSeries ( const QStringList & series );
92 
93  void run();
94 
95 public slots:
96  void onStopMove();
97 
98 signals:
99  void updateProgress ( int i );
100  void previewSlice ( const QString & filename );
101  void serieMoved(const QString & directory, const QString & uid, int number);
102 
103 protected:
104  OFCondition move ( const QString & uid );
105 
106  void addOverrideKey ( const QString & key );
107 
108  OFCondition addPresentationContext ( T_ASC_Parameters *params, T_ASC_PresentationContextID pid, const char* abstractSyntax, E_TransferSyntax preferredTransferSyntax );
109 
110  OFCondition cmove ( T_ASC_Association * assoc, const char *fname );
111 
112  static OFCondition acceptSubAssoc ( T_ASC_Network * aNet, T_ASC_Association ** assoc );
113 
114  static OFCondition echoSCP ( T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID );
115 
116  static OFCondition storeSCP ( T_ASC_Association *assoc, T_DIMSE_Message *msg, T_ASC_PresentationContextID presID, void* subOpCallbackData );
117 
118  static void storeSCPCallback ( void* caller, T_DIMSE_StoreProgress* progress, T_DIMSE_C_StoreRQ* req, char* imageFile, DcmDataset** imageDataSet, T_DIMSE_C_StoreRSP* rsp, DcmDataset** statusDetail );
119 
120  static OFCondition subOpSCP ( T_ASC_Association **subAssoc, void * subOpCallbackData );
121 
122  static void subOpCallback ( void * /*subOpCallbackData*/, T_ASC_Network *aNet, T_ASC_Association **subAssoc );
123 
124  static void moveCallback ( void *caller, T_DIMSE_C_MoveRQ * req, int responseCount, T_DIMSE_C_MoveRSP * rsp );
125 
126  void substituteOverrideKeys ( DcmDataset &dset );
127 
128  OFCondition moveSCU ( T_ASC_Association * assoc, const char *fname );
129 
130 private:
131  class Private;
132  Private * d;
133 };
134 
135 #endif /* QTDCMMOVESCU_H_ */
136 // kate: indent-mode cstyle; space-indent on; indent-width 0;
static OFCondition storeSCP(T_ASC_Association *assoc, T_DIMSE_Message *msg, T_ASC_PresentationContextID presID, void *subOpCallbackData)
virtual ~QtDcmMoveScu()
void substituteOverrideKeys(DcmDataset &dset)
QtDcmMoveScu(QObject *parent=0)
static OFCondition echoSCP(T_ASC_Association *assoc, T_DIMSE_Message *msg, T_ASC_PresentationContextID presID)
void setImportDir(const QString &dir)
static OFCondition acceptSubAssoc(T_ASC_Network *aNet, T_ASC_Association **assoc)
void previewSlice(const QString &filename)
OFCondition move(const QString &uid)
OFCondition cmove(T_ASC_Association *assoc, const char *fname)
void setImageId(const QString &id)
void updateProgress(int i)
OFCondition moveSCU(T_ASC_Association *assoc, const char *fname)
OFCondition addPresentationContext(T_ASC_Parameters *params, T_ASC_PresentationContextID pid, const char *abstractSyntax, E_TransferSyntax preferredTransferSyntax)
static void moveCallback(void *caller, T_DIMSE_C_MoveRQ *req, int responseCount, T_DIMSE_C_MoveRSP *rsp)
T_ASC_PresentationContextID presId
Definition: QtDcmMoveScu.h:58
void serieMoved(const QString &directory, const QString &uid, int number)
T_ASC_Association * assoc
Definition: QtDcmMoveScu.h:57
static OFCondition subOpSCP(T_ASC_Association **subAssoc, void *subOpCallbackData)
void setSeries(const QStringList &series)
static void storeSCPCallback(void *caller, T_DIMSE_StoreProgress *progress, T_DIMSE_C_StoreRQ *req, char *imageFile, DcmDataset **imageDataSet, T_DIMSE_C_StoreRSP *rsp, DcmDataset **statusDetail)
void setMode(eMoveMode eMoveMode)
void setOutputDir(const QString &dir)
void addOverrideKey(const QString &key)
static void subOpCallback(void *, T_ASC_Network *aNet, T_ASC_Association **subAssoc)