I am developing an iPad application using dcmtk lib to view DICOM images. my code from getting the connection to PACS, to sendMoveRequest is here :
Code: Select all
#define APPLICATIONTITLE "TEST-SCU"
// host name of the peer machine
#define PEERHOSTNAME "www.dicomserver.co.uk"
// TCP/IP port to connect to the peer machine
#define PEERPORT 11112
// application entity title of the peer machine
#define PEERAPPLICATIONTITLE "MOVESCP"
// MOVE destination AE Title
#define MOVEAPPLICATIONTITLE "MOVESCP"
in main :
DcmSCU scu;
// set AE titles
scu.setAETitle(APPLICATIONTITLE);
scu.setPeerHostName(PEERHOSTNAME);
scu.setPeerPort(PEERPORT);
scu.setPeerAETitle(PEERAPPLICATIONTITLE);
// Use presentation context for FIND/MOVE in study root, propose all uncompressed transfer syntaxes
OFList<OFString> ts;
ts.push_back(UID_LittleEndianExplicitTransferSyntax);
ts.push_back(UID_BigEndianExplicitTransferSyntax);
ts.push_back(UID_LittleEndianImplicitTransferSyntax);
scu.addPresentationContext(UID_FINDStudyRootQueryRetrieveInformationModel, ts);
scu.addPresentationContext(UID_MOVEStudyRootQueryRetrieveInformationModel, ts);
scu.addPresentationContext(UID_VerificationSOPClass, ts);
/* Initialize network */
OFCondition result = scu.initNetwork();
if (result.bad())
{
DCMNET_ERROR("Unable to set up the network: " << result.text());
return ;
}
/* Negotiate Association */
result = scu.negotiateAssociation();
if (result.bad())
{
DCMNET_ERROR("Unable to negotiate association: " << result.text());
return ;
}
/* Let's look whether the server is listening:
Assemble and send C-ECHO request
*/
result = scu.sendECHORequest(0);
if (result.bad())
{
DCMNET_ERROR("Could not process C-ECHO with the server: " << result.text());
return ;
}
//Construction et envoi d'une requete C-FIND, pour trouver les examens
OFList<QRResponse*> OFfindResponses;
DcmDataset req;
req.putAndInsertOFStringArray(DCM_QueryRetrieveLevel, "STUDY");
req.putAndInsertOFStringArray(DCM_StudyInstanceUID, "");
req.putAndInsertOFStringArray( DCM_PatientID, "TEST2");
T_ASC_PresentationContextID presID = findUncompressedPC(UID_FINDStudyRootQueryRetrieveInformationModel, scu);
if (presID == 0)
{
DCMNET_ERROR("There is no uncompressed presentation context for Study Root FIND");
return ;
}
result = scu.sendFINDRequest(presID, &req, &OFfindResponses);
if (result.bad())
{
DCMNET_ERROR("There is no uncompressed presentation context for Study Root FIND");
return ;
}
else
{
}
//Construction et envoi d'une requete C-MOVE, pour tous les examens identifiés au dessus
presID = findUncompressedPC(UID_MOVEStudyRootQueryRetrieveInformationModel, scu);
if (presID == 0)
{
DCMNET_ERROR("There is no uncompressed presentation context for Study Root FIND");
return ;
}
OFListIterator(QRResponse*) study = OFfindResponses.begin();
Uint32 studyCount = 1;
OFBool failed = OFFalse;
while (study != OFfindResponses.end() && result.good())
{
// Pour chaque boucle en réponse, soit chaque examen, toutes les images seront récupérées
OFList<RetrieveResponse*> moveResponses;//MOVEResponses moveResponses;
if ( (*study)->m_dataset != NULL) //Il faut etre certain que ce n'est pas la derniere réponse, elle ne contient pas d'information
{
OFString studyInstanceUID;
result = (*study)->m_dataset->findAndGetOFStringArray(DCM_StudyInstanceUID, studyInstanceUID);
// only try to get study if we actually have study instance uid, otherwise skip it
if (result.good())
{
req.putAndInsertOFStringArray(DCM_StudyInstanceUID, studyInstanceUID);
// fetches all images of this particular study
OFString OFmonAet = OFmonAet;
result = scu.sendMOVERequest(presID, MOVEAPPLICATIONTITLE, &req, NULL /* we are not interested into responses*/);
if (result.good())
{
DCMNET_INFO("Received study #" << std::setw(7) << studyCount << ": " << studyInstanceUID);
studyCount++;
}
}
}
study++;
}
if (result.bad())
{
DCMNET_ERROR("Unable to retrieve all studies: " << result.text());
}
while (!OFfindResponses.empty())
{
delete OFfindResponses.front();
OFfindResponses.pop_front();
}
I have 3 questions here :
First is : if my MOVEAPPLICATIONTITLE is "MOVESCP" ,by running this code i am getting the "Move destination unknown" error in console.
and if MOVEAPPLICATIONTITLE is "TEST-SCU" i m getting the error : "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 61.12.14.178:11112] # 202, 1 ErrorComment"
what should be the Proper MOVEAPPLICATIONTITLE should be here? and what should i do to stop it?
Second is: I know that DcmSCU.sendMoveRequest(....), can only tell the PACS to send the data somewhere, to a place we tell the PACS by giving an AE title. but there I just read an statement :
"When a PACS receives this move request, it internally looks up (in the configuration) the ip adress and port of the system with the AE title you specified (thus, every receiver has to be configured on the PACS) and then opens up a _new_ association to that adress and port. On that second connection, the images are sent with C-STORE then. "
can you just clarify it some more, by giving any example.and what does that mean "receiver has to be configured on the PACS"?
Third is which is mostly related to Second : to download images, that is, to listen from PACS we need storescp. but i didn't find any example of how to use it. can you please provide an example of what is storescp and how to use it to listen from PACS, and download images for ipad.