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

« back to all changes in this revision

Viewing changes to src/cadxcore/main/controllers/dcmtk/dicomgetassociation.cpp

  • 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:
33
33
 
34
34
GetAssociation::GetAssociation(const std::string& _ambitolog, IModeloDicom* pModelo) : FindAssociation(_ambitolog),
35
35
        m_maxReceivePDULength(ASC_DEFAULTMAXPDU),
36
 
        m_pHandler(NULL),
37
36
        m_pModelo(pModelo),
38
37
        m_numeroImagenes(0),
39
38
        m_mensaje(""),
367
366
                LOG_DEBUG("C-GET", str.c_str());
368
367
        }
369
368
 
370
 
 
371
369
        cond = MDIMSE_getUser(
372
370
                assoc,
373
371
                this,
379
377
                &rsp, &statusDetail, &rspIds);
380
378
 
381
379
        if (cond.bad()) {
382
 
                LOG_DEBUG(ambitolog, "DIMSE_getUser(): " << cond.text() );
 
380
                std::ostringstream os;
 
381
                os << DU_cgetStatusString(cond.status());
 
382
                if (statusDetail != NULL) {
 
383
                        OFString errorComment;
 
384
                        if (statusDetail->findAndGetOFString(DCM_ErrorComment, errorComment).good()) {
 
385
                                os << ". " << errorComment.c_str();
 
386
                        }
 
387
                }
 
388
                m_errorMessage = os.str();
383
389
        }
 
390
 
384
391
        if (statusDetail != NULL) {
385
392
                LOG_DEBUG(ambitolog, "DIMSE_getUser(): Estado: " << std::endl << DumpDataset(statusDetail));
386
393
                delete statusDetail;
391
398
                delete rspIds;
392
399
        }
393
400
 
394
 
        if(m_errorMessage != "")
395
 
        {
396
 
                throw GIL::DICOM::PACSException(m_errorMessage, "Acquisition");
397
 
        }
398
 
 
399
401
        return cond;
 
402
 
 
403
        /*if( rsp.DimseStatus != STATUS_Success && rsp.DimseStatus != STATUS_Pending) {
 
404
                std::ostringstream os;
 
405
                os << DU_cgetStatusString(rsp.DimseStatus);
 
406
                if (statusDetail != NULL) {
 
407
                        OFString errorComment;
 
408
                        if (statusDetail->findAndGetOFString(DCM_ErrorComment, errorComment).good()) {
 
409
                                os << ". " << errorComment.c_str();
 
410
                        }
 
411
                }
 
412
                m_errorMessage = os.str();
 
413
        }
 
414
 
 
415
        if (statusDetail != NULL) {
 
416
                LOG_DEBUG(ambitolog, "DIMSE_getUser(): Estado: " << std::endl << DumpDataset(statusDetail));
 
417
                delete statusDetail;
 
418
        }
 
419
 
 
420
        if (rspIds != NULL) {
 
421
 
 
422
                delete rspIds;
 
423
        }
 
424
 
 
425
        if(m_errorMessage != "" || rsp.NumberOfFailedSubOperations > 0 ) {
 
426
                if (m_errorMessage.size() == 0) {
 
427
                        m_errorMessage = "Some operations failed";
 
428
                }
 
429
                return makeOFCondition(OFM_dcmnet, 18, OF_error, m_errorMessage.c_str());
 
430
        }
 
431
 
 
432
        return cond;*/
400
433
}
401
434
 
402
435
void GetAssociation::getCallback(void * /*callbackData*/, T_DIMSE_C_GetRQ * /*request*/, int /*responseCount*/, T_DIMSE_C_GetRSP * /*response*/)
447
480
 
448
481
        OFCondition cond = DIMSE_receiveCommand(*subAssoc, DIMSE_BLOCKING, 0, &presID, &msg, NULL);
449
482
 
450
 
        if (cond.bad()) {
451
 
 
452
 
        }
453
 
 
454
483
        if (cond == EC_Normal) {
455
484
                switch (msg.CommandField) {
456
485
                        case DIMSE_C_STORE_RQ:
759
788
 
760
789
                        OFString OFUIDImagen;
761
790
                        std::string UIDImagen;
762
 
                        if (dset->findAndGetOFString(DCM_SOPInstanceUID, OFUIDImagen).good()) {
 
791
                        OFString OFInstanceNumber;
 
792
                        std::string InstanceNumber;
 
793
                        if (dset->findAndGetOFString(DCM_SOPInstanceUID, OFUIDImagen).good() && dset->findAndGetOFString(DCM_InstanceNumber, OFInstanceNumber).good()) {
763
794
                                UIDImagen.assign(OFUIDImagen.c_str());
764
 
                                m_pModelo->InsertarImagen(SerieUID,UIDImagen);
 
795
                                InstanceNumber.assign(OFInstanceNumber.c_str());
 
796
                                m_pModelo->InsertarImagen(SerieUID,UIDImagen, InstanceNumber, fileName);
 
797
                        } else {
 
798
                                LOG_ERROR("DCMGET", "InstanceUID or InstanceNumber not found");
765
799
                        }
766
800
                }
767
801
        }
768
 
        if (m_pHandler != NULL) {
769
 
                m_pHandler->Store(fileName, dset);
770
 
        }
771
802
}
772
803
 
773
 
void GetAssociation::SetCallbackHandler(IStoreCallBack * handler) {
774
 
        m_pHandler = handler;
775
 
}
776
804
 
777
805
float GetAssociation::TasaTransferencia(int bytesDescargados)
778
806
{