How to read findResponses ?
Moderator: Moderator Team
-
- Posts: 85
- Joined: Sun, 2010-12-26, 17:34
How to read findResponses ?
Hi,
I am implementing a CFind Request using DCMScu class
FINDResponses responses;
FindSCU.sendFINDRequest(cxID, &findParams, &responses);
but i cann't figure out how to use the responses to Read the Find Responses
any sample code will be appreciated.
Thanks in Advance
I am implementing a CFind Request using DCMScu class
FINDResponses responses;
FindSCU.sendFINDRequest(cxID, &findParams, &responses);
but i cann't figure out how to use the responses to Read the Find Responses
any sample code will be appreciated.
Thanks in Advance
-
- DCMTK Developer
- Posts: 2051
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Here is a short (pseudo code) example, which I did not test but generally shows what to do:
Best regards,
Michael
Code: Select all
FINDResponses responses;
FindSCU.sendFINDRequest(cxID, &findParams, &responses);
DcmDataset *dset;
OFListIterator(FINDResponse*) it = responses.begin();
while (it != responses.end())
{
FindResponse* rsp = *it;
dset = rsp->getDataset();
// print dataset or whatever you want to do with it
it++;
}
Michael
Thank you for your quick answer, I had the same problem and I used your code, modified to compile:
But I still have a problem: the last response in the iterator is always null (I should have 3 responses and I got 4, so I had to test if the dataset is null) is it normal?
Code: Select all
FINDResponses responses;
OFCondition bRet=poScu->sendFINDRequest(cxID, &findParams, &responses);
if(bRet.bad())
{
cout << "Error sendFindRequest: "<< bRet.text() << endl;
}
cout<<responses.numResults()<<" responses found."<<endl;
DcmDataset *dset;
OFListIterator(FINDResponse*) it = responses.begin();
while (it != responses.end())
{
FINDResponse* rsp = *it;
dset = rsp->m_dataset;
if(dset!=NULL)
{
oStatus=dset->findAndGetOFString(DCM_PatientName, oOfStringItem);
if (oStatus.bad())
{
cout<<"ERROR: Failed to find patient name"<<endl;
}else{
cout<<"Patient Name: "<<oOfStringItem.data()<<endl;
}
it++;
}
-
- DCMTK Developer
- Posts: 2051
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Hi,
yes, the last C-FIND response you get from the server should (by definition in DICOM itself) not contain any dataset but just returns the status SUCCESS (=0) in case everything goes fine.
Thus, you have to test each response indeed for a dataset. From the standard's point of view, only the last one will not contain any but I would never rely on that...
Best regards,
Michael
yes, the last C-FIND response you get from the server should (by definition in DICOM itself) not contain any dataset but just returns the status SUCCESS (=0) in case everything goes fine.
Thus, you have to test each response indeed for a dataset. From the standard's point of view, only the last one will not contain any but I would never rely on that...
Best regards,
Michael
-
- DCMTK Developer
- Posts: 2051
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Hi,
sendFINDRequest() is the newer approach since it belongs to the C++ DcmSCU class which hides most of the dirty network C API.
performQuery is from the findscu code which was originally done in C but after some time was quickly "hacked" into a class for a project. performQuery() should work fine (many people use findscu) but the code is not elegant and well re-usable. Therefore I recommend you to build your application based on DcmSCU instead (and therefore, sendFINDRequest()).
Michael
sendFINDRequest() is the newer approach since it belongs to the C++ DcmSCU class which hides most of the dirty network C API.
performQuery is from the findscu code which was originally done in C but after some time was quickly "hacked" into a class for a project. performQuery() should work fine (many people use findscu) but the code is not elegant and well re-usable. Therefore I recommend you to build your application based on DcmSCU instead (and therefore, sendFINDRequest()).
Michael
-
- DCMTK Developer
- Posts: 2051
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Hi,
so far we do not have an equivalent for MOVESCU. However, you can expect that within the next days. The changes will then be available from ourgit repository and probably in a new DCMTK snapshot version.
Best regards,
Michael
so far we do not have an equivalent for MOVESCU. However, you can expect that within the next days. The changes will then be available from ourgit repository and probably in a new DCMTK snapshot version.
Best regards,
Michael
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest