~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/main/controllers/dcmtk/dicomnetclient.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
                this->ambitolog = ambitolog;
75
75
        };
76
76
        
77
 
        bool QueryServer(DicomServer* server, const std::string& local_aet) {
 
77
        bool QueryServer(const GNC::GCS::Ptr<DicomServer>& server, const std::string& local_aet) {
78
78
                if (server == NULL) {
79
79
                        return false;
80
80
                }
119
119
                return true;
120
120
        }
121
121
 
122
 
        bool QueryServer(DcmDataset* query, DicomServer* server, IModeloDicom* pModelo, const std::string& local_aet, CallbackType callbackType) {
 
122
        bool QueryServer(DcmDataset* query, const GNC::GCS::Ptr<DicomServer>& server, IModeloDicom* pModelo, const std::string& local_aet, CallbackType callbackType) {
123
123
                if (pModelo == NULL && callbackType != CT_None)  {
124
124
                        return false;
125
125
                }
126
 
                if (server == NULL) {
 
126
                if (!server.IsValid()) {
127
127
                        return false;
128
128
                }
129
129
 
141
141
 
142
142
                T::SetNotificadorProgreso(m_pNotificadorProgreso);
143
143
 
144
 
                LOG_DEBUG(ambitolog, "Conectando: AET = " << server->AET << ", Host = " << server->HostName << ", Puerto = " << server->Port << ", Local AET = " << local_aet << ", PDU = " << server->PDU);
 
144
                LOG_INFO(ambitolog, "Connecting: AET = " << server->AET << ", Host = " << server->HostName << ", Puerto = " << server->Port << ", Local AET = " << local_aet << ", PDU = " << server->PDU);
145
145
                CONDITION r = T::Connect(Net, server->PDU);
146
146
 
147
147
                CONDITION c = ECC_Normal;
148
148
 
149
149
                if (r.good() == true) {
150
 
                        LOG_DEBUG(ambitolog, "Enviando Objeto:" << std::endl << DumpDataset(query));
 
150
                        LOG_DEBUG(ambitolog, "Requesting object:" << std::endl << DumpDataset(query));
151
151
                        c = T::SendObject(query);
152
152
                }
153
153
                else {
154
 
                        LOG_ERROR(ambitolog, "Error al conectar:" << r.text());
 
154
                        LOG_DEBUG(ambitolog, "Error connecting:" << r.text());
155
155
                        T::Drop();
156
156
                        T::Destroy();
 
157
                        LOG_INFO(ambitolog, "Disconnected");
157
158
                        throw GIL::DICOM::PACSException(r.text());
158
159
                }
159
160
 
160
161
                if (!c.good()) {
161
 
                        LOG_ERROR(ambitolog, "Error al enviar objeto: " << c.text());
 
162
                        LOG_DEBUG(ambitolog, "Error requesting object: " << c.text());
162
163
                        T::Drop();
163
164
                        T::Destroy();
 
165
                        LOG_INFO(ambitolog, "Disconnected");
164
166
                        throw GIL::DICOM::PACSException(c.text());
165
167
                }
166
168
 
167
 
                LOG_DEBUG(ambitolog, "Cerrando asociación");
168
 
                
169
 
 
170
169
                DcmStack* result = T::GetResultStack();
171
170
                if (r.good() && c.good() && result != NULL && result->card() > 0) {
172
 
                        LOG_DEBUG(ambitolog, "Número de resultados: " << result->card());
 
171
                        LOG_DEBUG(ambitolog, "Num results: " << result->card());
173
172
 
174
173
                        for (unsigned long i = 0; i < result->card(); ++i) {
175
174
                                DcmDataset* dset = new DcmDataset( *(static_cast<DcmDataset*>(result->elem(i))) );
203
202
                }
204
203
                else {
205
204
                        if (r.bad()) {
206
 
                                LOG_ERROR(ambitolog, "Error en la conexión: " << r.text());
 
205
                                LOG_ERROR(ambitolog, "Connection error: " << r.text());
207
206
                        }
208
207
                        if (c.bad()) {
209
 
                                LOG_ERROR(ambitolog, "Error en la obtención: " << c.text());
 
208
                                LOG_ERROR(ambitolog, "Error requesting object: " << c.text());
210
209
                        }
211
210
                }
 
211
 
 
212
                LOG_INFO(ambitolog, "Disconnected");
212
213
                T::Drop();
213
 
 
214
214
                
215
215
                return r.good();
216
216
        }
255
255
                 return wxConv;
256
256
         }
257
257
 
258
 
        void OnBuscarPacientes(DcmDataset* query, DcmDataset* dset, DicomServer* server, IModeloDicom* pModelo)
 
258
        void OnBuscarPacientes(DcmDataset* query, DcmDataset* dset, const GNC::GCS::Ptr<DicomServer>& server, IModeloDicom* pModelo)
259
259
        {
260
260
                wxCSConv wxConv = GetConv(dset, server->GetDefaultCharset());
261
261
 
300
300
                pModelo->InsertarPaciente(PacienteUID, PacienteNombre, PacienteFechaNacimiento, PacienteSexo);
301
301
        }
302
302
 
303
 
        void OnBuscarSeries(DcmDataset* query, DcmDataset* dset, DicomServer* server, IModeloDicom *pModelo)
 
303
        void OnBuscarSeries(DcmDataset* query, DcmDataset* dset, const GNC::GCS::Ptr<DicomServer>& server, IModeloDicom *pModelo)
304
304
        {
305
305
                wxCSConv wxConv = GetConv(dset, server->GetDefaultCharset());
306
306
 
371
371
                pModelo->InsertarSerie(EstudioUID, SerieUID, SerieTipo, SerieFecha, SerieHora, SerieDescripcion, SerieNumero,SerieDoctor);
372
372
        }
373
373
 
374
 
    void OnBuscarImagenes(DcmDataset* query, DcmDataset *dset, DicomServer* server, IModeloDicom* pModelo) 
 
374
    void OnBuscarImagenes(DcmDataset* query, DcmDataset *dset, const GNC::GCS::Ptr<DicomServer>& server, IModeloDicom* pModelo) 
375
375
         {
376
376
                wxCSConv wxConv = GetConv(dset, server->GetDefaultCharset());
377
377
 
378
378
        OFString OFSerieUID;
379
379
        OFString OFImagenUID;
380
 
                if (dset->findAndGetOFString(DCM_SeriesInstanceUID, OFSerieUID).bad() || dset->findAndGetOFString(DCM_SOPInstanceUID, OFImagenUID).bad()) {
 
380
                OFString OFInstanceNumber;
 
381
                if (dset->findAndGetOFString(DCM_SeriesInstanceUID, OFSerieUID).bad() || dset->findAndGetOFString(DCM_SOPInstanceUID, OFImagenUID).bad()
 
382
                        || dset->findAndGetOFString(DCM_InstanceNumber, OFInstanceNumber).bad()) {
381
383
                        if (!dset->isEmpty()) {
382
384
                                LOG_ERROR(ambitolog, "El PACS no devolvió el SeriesInstanceUID o el SOPInstanceUID de la imagen. Entrada ignorada.");
383
385
                        }
386
388
 
387
389
                std::string SerieUID;
388
390
                std::string ImagenUID;
 
391
                std::string InstanceNumber;
389
392
 
390
393
                SerieUID.assign(OFSerieUID.c_str());
391
394
                ImagenUID.assign(OFImagenUID.c_str());
 
395
                InstanceNumber.assign(OFInstanceNumber.c_str());
392
396
 
393
397
                if (SerieUID.empty()) {
394
398
                        OFString OFStr;
402
406
                                ImagenUID = wxString(OFStr.c_str(), wxConv).ToUTF8();
403
407
                        }
404
408
                }
 
409
                if (InstanceNumber.empty()) {
 
410
                        OFString OFStr;
 
411
                        if (query->findAndGetOFString(DCM_InstanceNumber, OFStr).good()) {
 
412
                                InstanceNumber = wxString(OFStr.c_str(), wxConv).ToUTF8();
 
413
                        }
 
414
                }
405
415
 
406
 
                pModelo->InsertarImagen(SerieUID, ImagenUID);
 
416
                pModelo->InsertarImagen(SerieUID, ImagenUID, InstanceNumber);
407
417
 
408
418
        }
409
419
 
410
 
    void OnBuscarEstudios(DcmDataset* query, DcmDataset *dset, DicomServer* server, IModeloDicom *pModelo) {
 
420
    void OnBuscarEstudios(DcmDataset* query, DcmDataset *dset, const GNC::GCS::Ptr<DicomServer>& server, IModeloDicom *pModelo) {
411
421
                OFString OFEstudioUID;
412
422
                if (dset->findAndGetOFString(DCM_StudyInstanceUID, OFEstudioUID).bad()) {
413
423
                        if (!dset->isEmpty()) {
422
432
                std::string PacienteUID;
423
433
                if (dset->findAndGetOFString(DCM_PatientID, OFPacienteUID).good()) {
424
434
                        PacienteUID = wxString(OFPacienteUID.c_str(), wxConv).ToUTF8();
 
435
                } else {
 
436
                        if (query->findAndGetOFString(DCM_PatientID, OFPacienteUID).good()) {
 
437
                                PacienteUID = wxString(OFPacienteUID.c_str(), wxConv).ToUTF8();
 
438
                        }
425
439
                }
426
440
 
427
441
                OFString OFPacienteNombre;
486
500
                        EstudioDoctor = wxString(OFDoctor.c_str(), wxConv).ToUTF8();
487
501
                }
488
502
 
489
 
                if (PacienteUID.empty()) {
490
 
                        OFString OFStr;
491
 
                        if (query->findAndGetOFString(DCM_PatientID, OFStr).good()) {
492
 
                                PacienteUID = wxString(OFStr.c_str(), wxConv).ToUTF8();
493
 
                        }
494
 
                }
495
503
                if (EstudioUID.empty()) {
496
504
                        OFString OFStr;
497
505
                        if (query->findAndGetOFString(DCM_StudyInstanceUID, OFStr).good()) {