DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Thu, 2017-11-23, 13:47

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon, 2017-08-28, 18:24 
Offline

Joined: Mon, 2017-07-17, 15:33
Posts: 6
Hello,

I have a "problem" with the cancelling of an query request.

i use a DcmFindScu based implementation. When cancelling the query i sent DIMSE_sendCancelRequest from the callback. Is this correct? Are there any examples i have missed (couldn't find any).

Code:
void MyCallback::callback
( T_DIMSE_C_FindRQ *request, int responseCount, T_DIMSE_C_FindRSP *rsp,
  DcmDataset *responseIdentifiers )
{
  qDebug() << "rsp " << rsp->DimseStatus;
  /* send C-FIND-CANCEL */
  if( responseCount > m_cancelAfterNResponses )
  {
    if( !m_cancelRequestSent )
    {
      DCMNET_INFO("Sending Cancel Request (MsgID " << request->MessageID
                  << ", PresID " << OFstatic_cast(unsigned int, presId_)
                  << ")");
      OFCondition cond = DIMSE_sendCancelRequest(assoc_, presId_,
                                                 request->MessageID);
      if (cond.bad())
      {
        OFString temp_str;
        DCMNET_ERROR("Cancel Request Failed: "
                     << DimseCondition::dump(temp_str, cond));
      } else m_cancelRequestSent = true;
    }

    emit maxResponsesReached();
    return;
  }
  ...
}


After execution i get the following output:

    ...
    rsp 65280
    W: DcmItem: Invalid Element (0002,0003) found in data set
    rsp 65280
    I: Sending Cancel Request (MsgID 1, PresID 1)
    W: DcmItem: Invalid Element (0002,0003) found in data set
    rsp 65280
    ...
    W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): findUser: Status Cancel: MatchingTerminatedDueToCancelRequest, but DataSetType!=NULL
    W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): Assuming no response identifiers are present
    I: Received Final Find Response (Cancel: MatchingTerminatedDueToCancelRequest)
    I: Releasing Association
    E: Association Release Failed: 0006:0316 DUL P-Data PDU arrived

There should be different statuses of the response:

a) Success
b) Pending
c) Refused
d) Refused
e) Refused
f) Cancel
g) Failed

How can i get it? rsp->DimseStatus is always 65280.

What does the warnings:
W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): findUser: Status Cancel: MatchingTerminatedDueToCancelRequest, but DataSetType!=NULL
W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): Assuming no response identifiers are present
and error:
E: Association Release Failed: 0006:0316 DUL P-Data PDU arrived mean?

Greetings Gerd


Top
 Profile  
 
PostPosted: Tue, 2017-08-29, 12:59 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1635
Location: Oldenburg, Germany
Hi Gerd,

let's go through this:

geke wrote:
Hello,

I have a "problem" with the cancelling of an query request.

i use a DcmFindScu based implementation. When cancelling the query i sent DIMSE_sendCancelRequest from the callback. Is this correct? Are there any examples i have missed (couldn't find any).

Looks good to me at first sight.
Quote:
After execution i get the following output:
Code:
...
rsp  65280


65280 is hexadecimal FF00 which again is status PENDING according to the related section DICOM standard part 7.
That is the correct status when the server sends you a query response that is not the last one.
Quote:
Code:
W: DcmItem: Invalid Element (0002,0003) found in data set


The element 0002,0003 is the Media Storage SOP Instance UID. This is never allowed on the network, so this is a problem of the server. DCMTK does not care too much, it just warns about it.
Quote:
Code:
rsp  65280
I: Sending Cancel Request (MsgID 1, PresID 1)
W: DcmItem: Invalid Element (0002,0003) found in data set
rsp  65280
...


Another C-FIND response with status PENDING from the server, then your cancel request is sent (warning as explained above). After your C-FIND-CANCEL, another PENDING response comes in. This is permitted, since the server might have provided some responses already to the network or a software layer that it cannot "control". DICOM explicitly permits to send some remaining C-FIND responses after sending the cancel. Also note that at this point the server did not acknowledge your cancel request yet.
Quote:
Code:
W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): findUser: Status Cancel: MatchingTerminatedDueToCancelRequest, but DataSetType!=NULL
W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): Assuming no response identifiers are present


Now your code has received the cancel acknowledgement of the server. But it warns that the message announces to contain a dataset. This is not permitted in DICOM, since the cancel ack message does not contain any dataset payload per definition. Anyway, DCMTK warns about this and assumes that the announcement that a dataset is attached is wrong.
Quote:
Code:
I: Received Final Find Response (Cancel: MatchingTerminatedDueToCancelRequest)
I: Releasing Association


As expected DCMTK interprets the cancel acknowledgement as last message, since afterwards the server is not permitted to send any more responses (in status PENDING). Thus it releases the connection.
Quote:
Code:
E: Association Release Failed: 0006:0316 DUL P-Data PDU arrived


However, surprisingly, the server still sends some data, maybe the announced (but not permitted) dataset of the cancel acknowledgement. Since DCMTK assumed that there is no such dataset, it prints an error since for DCMTK such a message is not allowed after a association release.
Quote:
There should be different statuses of the response:
a) Success
b) Pending
c) Refused
d) Refused
e) Refused
f) Cancel
g) Failed

How can i get it? rsp->DimseStatus is always 65280.

...which means PENDING as explained above. If you like to see the status string, there is a function to produce that from the status code. You can find it in diutil.h/cc: DU_cfindStatusString(Uint16 status). It is also used in dfindscu.cc, for example.

As a takeaway: The server announces (and probably also sends) a dataset after its cancel acknowledgement, where it is not permitted. DCMTK assumes there is no dataset (since its against the rules) and closes the association since the C-FIND operation is done from the client's point of view. Then it gets surprised by receiving a data package instead of a release response.

All clear now :)?

Best regards,
Michael


Top
 Profile  
 
PostPosted: Wed, 2017-08-30, 15:57 
Offline

Joined: Mon, 2017-07-17, 15:33
Posts: 6
Hello Michael,

W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): findUser: Status Cancel: MatchingTerminatedDueToCancelRequest, but DataSetType!=NULL
W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): Assuming no response identifiers are present
E: Association Release Failed: 0006:0316 DUL P-Data PDU arrived

As you explained the Error seems to be of an non conformant PACS (I used Orthanc).

For further testing i now use DVTK Q&R SCP, which should be more conform.

But still in my callback i only see a pending state. The success message is written in the DCMTK log. But how can i catch the success, refused, cancel or failed state in my code?

Or better asked does it make sense to check them in the callback? But how can i detect a failed query then?

Quote:
The element 0002,0003 is the Media Storage SOP Instance UID. This is never allowed on the network, so this is a problem of the server. DCMTK does not care too much, it just warns about it.


I saw your reply at the dicom newsgroup
https://groups.google.com/forum/?hl=de# ... MrrtRWhcuU

I now use DcmDataset::removeInvalidGroups(); before the dataset is stored to PACS. I think this function is intended for the "problem" you explained at the dicom newsgroup.

Greetings Gerd


Top
 Profile  
 
PostPosted: Thu, 2017-08-31, 08:53 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1635
Location: Oldenburg, Germany
Hi Gerd,

have you tried the same thing using findscu (sending cancel?)?
If this works, dig into the findscu.cc code (which uses dfindscu.cc) to see how things work. I would also now go into that code and look it up.

Best,
Michael


Top
 Profile  
 
PostPosted: Thu, 2017-08-31, 13:55 
Offline

Joined: Mon, 2017-07-17, 15:33
Posts: 6
Hello Michael,

I tried it with findscu: It produces the same error. The problem is not my code/implementation. I will post this topic in the ORTHANC forum.

Greeting Gerd

Code:
findscu -v --cancel 10 -P -aec ORTHANC -aet MY_SCU localhost 4242 -k QueryRetrieveLevel=IMAGE


Quote:
I: Find Response: 280 (Pending)
I:
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0005) CS [ISO_IR 100] # 10, 1 SpecificCharacterSet
I: (0008,0052) CS [IMAGE ] # 6, 1 QueryRetrieveLevel
I:
W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): findUser: Status Cancel: MatchingTerminatedDueToCancelRequest, but DataSetType!=NULL
W: DIMSE Warning: (ISEEPROSTORESCP,ORTHANC): Assuming no response identifiers are present
I: Received Final Find Response (Cancel: MatchingTerminatedDueToCancelRequest)
I: Releasing Association
E: Association Release Failed: 0006:0316 DUL P-Data PDU arrived


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group