반응형
 

DCMTK: dcmnet: a networking library and utility apps

This module contains a collection of functions that implement DICOM network communication, i.e. the DICOM Upper Layer Finite State Machine, the Association Control Service Element (ACSE) and the DICOM Message Service Element (DIMSE). The main interfaces ar

support.dcmtk.org

#include "dcmtk/dcmnet/assoc.h"
#include "dcmtk/dcmnet/dimse.h"


	T_ASC_Network* net; // network struct, contains DICOM upper layer FSM etc.
    ASC_initializeNetwork(NET_REQUESTOR, 0, 1000 /* timeout */, &net);

    T_ASC_Parameters* params; // parameters of association request
    ASC_createAssociationParameters(&params, ASC_DEFAULTMAXPDU);

    // set calling and called AE titles
    ASC_setAPTitles(params, "ECHOSCU", "Bunny", NULL);

    // the DICOM server accepts connections at server.nowhere.com port 104
    ASC_setPresentationAddresses(params, "localhost", "127.0.0.1:3000");

    // list of transfer syntaxes, only a single entry here
    const char* ts[] = { UID_LittleEndianImplicitTransferSyntax };

    // add presentation context to association request
    ASC_addPresentationContext(params, 1, UID_VerificationSOPClass, ts, 1);

    // request DICOM association
    T_ASC_Association* assoc;
    if (ASC_requestAssociation(net, params, &assoc).good())
    {
        if (ASC_countAcceptedPresentationContexts(params) == 1)
        {
            // the remote SCP has accepted the Verification Service Class
            DIC_US id = assoc->nextMsgID++; // generate next message ID
            DIC_US status; // DIMSE status of C-ECHO-RSP will be stored here
            DcmDataset* sd = NULL; // status detail will be stored here
            // send C-ECHO-RQ and handle response
            DIMSE_echoUser(assoc, id, DIMSE_BLOCKING, 0, &status, &sd);
            delete sd; // we don't care about status detail
        }
    }
    ASC_releaseAssociation(assoc); // release association
    ASC_destroyAssociation(&assoc); // delete assoc structure
    ASC_dropNetwork(&net); // delete net structure
반응형

'[====== Development ======] > DICOM' 카테고리의 다른 글

[DCMTK] Send DICOM  (0) 2021.07.29
[DCMTK] Simple StoreSCP  (0) 2021.07.29
[DCMTK] decompress DICOM  (0) 2021.07.27
Open Source DICOM Web Viewer  (0) 2021.07.07
VR Patient Name (PN) 정리  (0) 2021.07.07

+ Recent posts