欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

DCMTK: DcmSCP, error:QueryRetrieveLevel larger remaining bytes

程序员文章站 2022-05-19 18:20:28
...

最近在DcmSCU发送一个findRequest后,DcmSCP总是报一个错误:

 

hi, all.

when i send a findRequest in DcmSCU, it will be successful to receive response.
but then the DcmServer will take place an error, as follows.

Quote:
"2012-11-03 16:12:25.758 INFO: Sending C-Find Response" 
"2012-11-03 16:12:27.795 DEBUG: C-FIND Response successfully sent" 
"2012-11-03 16:12:29.678 DEBUG: DcmDataset::read() TransferSyntax="Little Endian Implicit"" 
"2012-11-03 16:12:29.678 WARN: DcmItem: Length of element (0008,0052) is odd" 
"2012-11-03 16:12:29.679 ERROR: DcmElement: QueryRetrieveLevel (0008,0052) larger (414531) than remaining bytes (20) in file, premature end of stream" 
"2012-11-03 16:12:29.679 DEBUG: DIMSE Error, detail (if available): 0006:020d DIMSE: receiveCommand: cmdSet->read() Failed2012-11-03 16:12:29.679 DEBUG: 0001:0004 Invalid stream" 
"2012-11-03 16:12:59.681 DEBUG: DcmSCP: Association Terminated" 
"2012-11-03 16:12:59.681 DEBUG: +++++++++++++++++++++++++++++

 

最后的解决方法是:

 

I have found the anwser Something about the findscu tool

we should implement the callback function to set response->DimseStatus=STATUS_Success;

Code:
typedef void (*DIMSE_FindProviderCallback)(
        /* in */
        void *callbackData,
        OFBool cancelled, T_DIMSE_C_FindRQ *request,
        DcmDataset *requestIdentifiers, int responseCount,
        /* out */
        T_DIMSE_C_FindRSP *response,
        DcmDataset **responseIdentifiers,
        DcmDataset **statusDetail);

DCMTK_DCMNET_EXPORT OFCondition
DIMSE_findProvider(
        /* in */
        T_ASC_Association *assoc,
        T_ASC_PresentationContextID presIdCmd,
        T_DIMSE_C_FindRQ *request,
        DIMSE_FindProviderCallback callback, void *callbackData,
        /* blocking info for data set */
        T_DIMSE_BlockingMode blockMode, int timeout);



my callBack function:
Code:
void FindProviderCallback(
   /* in */ 
   void *callbackData,  
   OFBool cancelled, T_DIMSE_C_FindRQ *request, 
   DcmDataset *requestIdentifiers, int responseCount,
   /* out */
   T_DIMSE_C_FindRSP *response,
   DcmDataset **responseIdentifiers,
   DcmDataset **statusDetail)
{
   if (responseCount>1)
   {
      //*responseIdentifiers=NULL;
      response->DimseStatus=STATUS_Success;
   }
   else   
   {
      if(request->DataSetType==DIMSE_DATASET_PRESENT) //or some other conditions are met
         *responseIdentifiers=new DcmDataset(*requestIdentifiers);     
   }
}


Thanks all.