How can I avoid writing to stdout?.
Code: Select all
#include <dcmtk/config/osconfig.h>
#include <dcmtk/config/cfunix.h>
#include <dcmtk/dcmnet/dfindscu.h>
#include <dcmtk/ofstd/ofstring.h>
class DcmFindSCUmyCallback: public DcmFindSCUCallback
{
public:
DcmFindSCUmyCallback(){
}
virtual ~DcmFindSCUmyCallback() {}
virtual void callback(
T_DIMSE_C_FindRQ *request,
int responseCount,
T_DIMSE_C_FindRSP *rsp,
DcmDataset *responseIdentifiers)
{
int r;
r = responseCount;
}
};
int main(int argc, char *argv[])
{
//QCoreApplication a(argc, argv);
DcmFindSCU * lFind = new DcmFindSCU();
OFCondition cond = lFind->initializeNetwork(30);
if(cond.bad())
{
return -1;
}
else
{
/* copy overridekeys to lOverrideKeys */
OFList<OFString> lOverrideKeys;
OFList<OFString> lFileNameList;
OFString word;
const char * abstractSyntax = UID_FINDModalityWorklistInformationModel;
lOverrideKeys.push_back("0010,0010=RAM*");
const char * peer = "192.168.0.129";
unsigned int port = 104;
const char * aet = "TEST";
const char * aec = "SynapseDicomSCP";
DcmFindSCUmyCallback * myCallBack = new DcmFindSCUmyCallback();
cond = lFind->performQuery(
peer, port,
aet, aec,
abstractSyntax,
EXS_Unknown,
DIMSE_BLOCKING,
0,
ASC_DEFAULTMAXPDU,
OFFalse,
OFFalse,
1,
OFFalse,
-1,
&lOverrideKeys,
myCallBack
);
OFString temp_str;
if (cond.bad())
{
DimseCondition::dump(temp_str, cond);
}
// destroy network structure
cond = lFind->dropNetwork();
if (cond.bad())
{
DimseCondition::dump(temp_str, cond);
}
}
return 0;
}
Code: Select all
I: Requesting Association
I: Association Accepted (Max Send PDV: 64988)
I: ===================== OUTGOING DIMSE MESSAGE ====================
I: Message Type : C-FIND RQ
I: Presentation Context ID : 1
I: Message ID : 1
I: Affected SOP Class UID : FINDModalityWorklistInformationModel
I: Data Set : present
I: Priority : low
I: ======================= END DIMSE MESSAGE =======================
I: Find SCU Request Identifiers:
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Unknown Transfer Syntax
I: (0010,0010) PN [RAM*] # 4, 1 PatientName
I:
I: ===================== INCOMING DIMSE MESSAGE ====================
I: Message Type : C-FIND RSP
I: Message ID Being Responded To : 1
I: Affected SOP Class UID : FINDModalityWorklistInformationModel
I: Data Set : none
I: DIMSE Status : 0xa700: Error: Refused - Out of resources
I: ======================= END DIMSE MESSAGE =======================
W: Status Detail:
W:
W: # Dicom-Data-Set
W: # Used TransferSyntax: Little Endian Implicit
W: (0000,0902) LO [CFIND:SCP ExecuteDBCmd failed] # 30, 1 ErrorComment
W:
I: Releasing Association