~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/api/icontroladorimportacionpacs.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Tille
  • Date: 2011-05-02 08:09:26 UTC
  • Revision ID: james.westby@ubuntu.com-20110502080926-bql5wep49c7hg91t
Tags: upstream-2.4.1.1
ImportĀ upstreamĀ versionĀ 2.4.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  
 
3
 *  $Id: icontroladorimportacionpacs.h 3665 2011-04-11 06:52:30Z tovar $
 
4
 *  Ginkgo CADx Project
 
5
 *
 
6
 *  Copyright 2008-10 MetaEmotion S.L. All rights reserved.
 
7
 *  http://ginkgo-cadx.com
 
8
 *
 
9
 *  This file is licensed under LGPL v3 license.
 
10
 *  See License.txt for details
 
11
 *
 
12
 */
 
13
#pragma once
 
14
#include <api/api.h>
 
15
#include <string.h>
 
16
#include <string>
 
17
#include <exception>
 
18
#include <ostream>
 
19
#include <list>
 
20
#include <map>
 
21
#include "icontroladormodulo.h"
 
22
#include "ivista.h"
 
23
#include "idicom.h"
 
24
#include "iproxynotificadorprogreso.h"
 
25
 
 
26
class IModeloDicom;
 
27
class DcmElement;
 
28
 
 
29
namespace GIL {
 
30
        namespace DICOM {               
 
31
 
 
32
                class PACSException : public std::exception {
 
33
                public:
 
34
                        PACSException(const std::string& msg, const std::string& componente="GIL/PACS", bool fatal = true) throw()
 
35
                        {
 
36
                                this->cause = msg;
 
37
                                this->component = componente;
 
38
                                this->fatal = fatal;
 
39
                        }
 
40
                        ~PACSException() throw()
 
41
                        {
 
42
                        }
 
43
 
 
44
                        const std::string& GetComponent() const
 
45
                        {
 
46
                                return component;
 
47
                        }
 
48
 
 
49
                        const std::string& GetCause() const {
 
50
                                return cause;
 
51
                        }
 
52
 
 
53
                        std::string GetFullCause() const {
 
54
                                return *this;
 
55
                        }
 
56
 
 
57
                        bool IsFatal()  const {
 
58
                                return fatal;
 
59
                        }
 
60
 
 
61
                        operator std::string () const {
 
62
                                return std::string("Excepcion en componente ") + GetComponent() + std::string(": ")  + GetCause();
 
63
                        }
 
64
 
 
65
                        friend std::ostream& operator<<(std::ostream& out, const PACSException& ex)
 
66
                        {
 
67
                                out << (const std::string&) ex;
 
68
                                return out;
 
69
                        }
 
70
 
 
71
                        friend std::ostream& operator<<(std::ostream& out, const PACSException* ex)
 
72
                        {
 
73
                                if (ex != NULL) {
 
74
                                        out << *ex;
 
75
                                }
 
76
                                else {
 
77
                                        out << "(NULL)";
 
78
                                }
 
79
                                return out;
 
80
                        }
 
81
 
 
82
                protected:
 
83
                        std::string cause;
 
84
                        std::string component;
 
85
                        bool fatal;
 
86
                };
 
87
 
 
88
                typedef struct ContextoResultado {
 
89
                        bool error;
 
90
                        std::string UIDPaciente;
 
91
                        std::string UIDEstudio;
 
92
                        std::list<std::string> RutaDICOM;
 
93
                        std::string ServidorPACSID;
 
94
                        bool fromPACS;
 
95
                        bool recursivo;
 
96
 
 
97
                        inline ContextoResultado()
 
98
                        {
 
99
                                error = false;
 
100
                                fromPACS=false;
 
101
                                recursivo = false;
 
102
                        }
 
103
 
 
104
                        inline ~ContextoResultado()
 
105
                        {
 
106
                        }
 
107
                } ContextoResultado;
 
108
 
 
109
                class IInspectCallBack {
 
110
                public:
 
111
 
 
112
                        virtual void ObtenerJerarquiaInserccion(TipoJerarquia& /*lista*/)
 
113
                        {
 
114
                        }
 
115
 
 
116
                        virtual void Inspect(std::string& clave, std::string& desc, std::string& valor) = 0;
 
117
                        virtual void Done() = 0;
 
118
                };
 
119
 
 
120
                typedef enum TipoTransferSyntaxEnvio {
 
121
                        SendExplicitLittleEndian,
 
122
                        SendImplicitLittleEndian,
 
123
                        SendJPEG2000Lossless,
 
124
                        SendJPEG2000Lossy10,
 
125
                        SendJPEG2000Lossy20,
 
126
                        SendJPEG2000Lossy50,
 
127
                        SendJPEGLossless,
 
128
                        SendJPEGLossy9,
 
129
                        SendJPEGLossy8,
 
130
                        SendJPEGLossy7,
 
131
                        SendDefault
 
132
                } TipoTransferSyntaxEnvio;
 
133
 
 
134
                class EXTAPI IControladorImportacionPACS {
 
135
                public:
 
136
 
 
137
                        ~IControladorImportacionPACS()
 
138
                        {
 
139
                        }
 
140
 
 
141
                        virtual IModeloDicom* BuscarPaciente(
 
142
                                void* connectionKey,
 
143
                                const std::string& serverId,
 
144
                                const std::string& idPaciente,
 
145
                                const std::string& nombrePaciente,
 
146
                                const std::string& fechaNacimiento,
 
147
                                IModeloDicom* pModelo,
 
148
                                GNC::IProxyNotificadorProgreso* pNotificador
 
149
                                ) = 0;
 
150
 
 
151
                        virtual IModeloDicom* BuscarEstudio(
 
152
                                void* connectionKey,
 
153
                                const std::string& serverId,
 
154
                                const std::string& idPaciente,
 
155
                                const std::string& nombrePaciente,
 
156
                                const std::string& idEstudio,
 
157
                                const std::string& AccNumber,
 
158
                                const std::string& modalidad,
 
159
                                const std::string& fechaDesde,
 
160
                                const std::string& fechaHasta,
 
161
                                const std::string& timeFrom,
 
162
                                const std::string& timeTo,
 
163
                                const std::string& descripcionEstudio,
 
164
                                const std::string& nombreEstacion,
 
165
                                IModeloDicom* pModelo,
 
166
                                GNC::IProxyNotificadorProgreso* pNotificador
 
167
                                ) = 0;
 
168
 
 
169
                        virtual IModeloDicom* BuscarSeries(
 
170
                                void* connectionKey,
 
171
                                const std::string& serverId,
 
172
                                const std::string& idEstudio,
 
173
                                const std::string& idSerie,
 
174
                                IModeloDicom* pModelo,
 
175
                                GNC::IProxyNotificadorProgreso* pNotificador
 
176
                                ) = 0;
 
177
 
 
178
                        virtual IModeloDicom* BuscarImagenes(
 
179
                                void* connectionKey,
 
180
                                const std::string& serverId,
 
181
                                const std::string& idSerie,
 
182
                                const std::string& idImagen,
 
183
                                IModeloDicom* pModelo,
 
184
                                GNC::IProxyNotificadorProgreso* pNotificador
 
185
                                ) = 0;
 
186
 
 
187
                        
 
188
 
 
189
                        virtual bool ObtenerEstudio(
 
190
                                void* connectionKey,
 
191
                                const std::string& serverId,
 
192
                                const std::string& uidEstudio,
 
193
                                const std::string& AccNumber,
 
194
                                IModeloDicom* pModelo,
 
195
                                GNC::IProxyNotificadorProgreso* pNotificador
 
196
                        ) = 0;
 
197
 
 
198
                        virtual bool ObtenerSerie(
 
199
                                void* connectionKey,
 
200
                                const std::string& serverId,
 
201
                                const std::string& uidSerie,
 
202
                                IModeloDicom* pModelo,
 
203
                                GNC::IProxyNotificadorProgreso* pNotificador
 
204
                        ) = 0;
 
205
 
 
206
                        virtual bool ObtenerImagen(
 
207
                                void* connectionKey,
 
208
                                const std::string& serverId,
 
209
                                const std::string& uidImagen,
 
210
                                IModeloDicom* pModelo,
 
211
                                GNC::IProxyNotificadorProgreso* pNotificador
 
212
                        ) = 0;
 
213
 
 
214
                        virtual bool QueryRetrieve(
 
215
                                void* connectionKey,
 
216
                                const std::string& serverId,
 
217
                                IModeloDicom* pModelo,
 
218
                                const GIL::DICOM::TipoJerarquia& base,
 
219
                                GNC::IProxyNotificadorProgreso* pNotificador
 
220
                        ) = 0;
 
221
 
 
222
 
 
223
 
 
224
 
 
225
                        
 
226
 
 
227
                        virtual void SubirArchivos(void* connectionKey, const std::string& serverId, const std::vector<std::string>& pathsSubida, GNC::IProxyNotificadorProgreso * pNotificador, TipoTransferSyntaxEnvio transferSyntax) =0;
 
228
 
 
229
                        virtual void  GetConnection(void* connectionKey) = 0;
 
230
 
 
231
                        virtual void  ReleaseConnection(void* connectionKey) = 0;
 
232
 
 
233
                        virtual bool LeerDicomDir(const std::string& pathDicomDir, IModeloDicom* pModelo) = 0;
 
234
 
 
235
                        virtual bool findAndGetTagFromFile(const std::string& ruta, unsigned short group, unsigned short element, std::string& value) = 0;
 
236
 
 
237
                        virtual bool EsDICOM(const std::string& path, bool accept_dicomdir, bool accept_dicomfile) = 0;
 
238
 
 
239
                        /* Devuelve la ruta en disco (asignada a la variable ruta pasada por referencia) en base a los IDs unicos de estudio y serie de una serie de imagenes obtenida*/
 
240
                        virtual bool GetRutaImagen(const std::string& uidPaciente, const std::string& uidEstudio, const std::string& uidSerie, const std::string& uidImagen, std::string& ruta, bool crearDirectorios = true) = 0;
 
241
 
 
242
                        void DumpFileElements(const std::string& rutaFichero, IInspectCallBack* callback);
 
243
 
 
244
        //region "Metodos de Dicomizacion"
 
245
 
 
246
                        virtual IDICOMImg2DCM* CrearInstanciaDeImportacion() = 0;
 
247
 
 
248
                        virtual void LiberarInstanciaDeImportacion(IDICOMImg2DCM* instancia) = 0;
 
249
 
 
250
        //endregion
 
251
 
 
252
        //region "Metodos de carga/almacenamiento de DICOMS"
 
253
 
 
254
                        virtual IDICOMManager* CrearInstanciaDeDICOMManager() = 0;
 
255
 
 
256
                        virtual void LiberarInstanciaDeDICOMManager(IDICOMManager* instancia) = 0;
 
257
 
 
258
        //endregion
 
259
 
 
260
                protected:
 
261
 
 
262
                        IControladorImportacionPACS()
 
263
                        {
 
264
                        }
 
265
                };
 
266
        }
 
267
}