Help to send DICOM file

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
DICOMNICO
Posts: 12
Joined: Thu, 2008-04-24, 09:22

Help to send DICOM file

#1 Post by DICOMNICO »

Hi I'am a newbie with DCMTK and I'm writing a small application that deals to send DICOM file using DCMTK libraries.
At this moment, I load the file in memory usinf dcm.loadFile(), but how can I do to send it?
I have tried to network example or tutorial, and I also
compiled ECHOSCU example but I have no idea for what I have to write.

DcmFileFormat dcm;
OFCondition cond;
cond = dcm.loadFile("/Users/Nicolo/DICOM_TESTFILE.dcm"); //dcm contains the dicom file
if (cond.bad()) {
printf("%s\n", cond.text());
} else {
std::cout << "DICOM load status: " << cond.text() << endl;
}

T_ASC_Network *net;
ASC_initializeNetwork(NET_REQUESTOR, 0, 1000 /* timeout */, &net);

T_ASC_Parameters *params;
ASC_createAssociationParameters(&params, ASC_DEFAULTMAXPDU);
ASC_setAPTitles(params, "STORESCU", "NICO", NULL);
ASC_setPresentationAddresses(params, "157.27.31.90", "157.27.31.90:11112");
const char* ts[] = { UID_LittleEndianImplicitTransferSyntax };
ASC_addPresentationContext(params, 1, UID_VerificationSOPClass, ts, 1);
T_ASC_Association *assoc;
if (ASC_requestAssociation(net, params, &assoc).good()){
if (ASC_countAcceptedPresentationContexts(params) == 1){
DIC_US id = assoc->nextMsgID++; // generate next message ID
DIC_US status;
DcmDataset *sd = NULL;
DIMSE_echoUser(assoc, id, DIMSE_BLOCKING, 0, &status, &sd);
delete sd;
}
}
ASC_releaseAssociation(assoc);
ASC_destroyAssociation(&assoc);
ASC_dropNetwork(&net);

Thank you a lot for your help!!

Aimevous
Posts: 37
Joined: Thu, 2008-05-15, 11:02

#2 Post by Aimevous »

Hi,

You are looking at the wrong example I think. You have to look at StoreSCU instead. I'm trying to learn this also.

What I did was to trace through the entire program to pick out the parts that I need. Perhaps you can refer to this thread:

viewtopic.php?p=5670&highlight=#5670

DICOMNICO
Posts: 12
Joined: Thu, 2008-04-24, 09:22

#3 Post by DICOMNICO »

I Try to study and modify the storescu code but mu compiler returns lot of errors during the building.... one of these is:

/usr/local/dicom/include/dcmtk/ofstd/ofstream.h:77:2: error: #error DCMTK needs stringstream or strstream type

Anyone can help me?

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1437
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#4 Post by Marco Eichelberg »

Read the installation instructions in file INSTALL in the main directory of the DCMTK source code distribution.

DICOMNICO
Posts: 12
Joined: Thu, 2008-04-24, 09:22

#5 Post by DICOMNICO »

Problem solved!

jcferranti
Posts: 4
Joined: Mon, 2008-09-08, 21:24

#6 Post by jcferranti »

DICOMNICO wrote:Problem solved!
I have the same problem. How you resolve it?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], George, Google [Bot] and 1 guest