Issue with Setting the Command Set in N_CREATE Response, pydicom

325 views Asked by At

I'm working on a MPPS SCP as described here: MPPS SCP as a basic framework.

I've been able to test it a bit with DVTk, with some tools that are available here: DVTk

Most of it seems to be working correctly, but the issue I seem to be having is that the response is suppose to have tags with group 0000 returned in the "Command Set" and not in the returned DataSet itself: I actually did set them in the DataSet just to verify that I am getting the correct values, e.g.:

python_mpps_1         | (0000, 0000) Command Group Length  ????
python_mpps_1         | (0000, 0002) Affected SOP Class UID              UI: Modality Performed Procedure Step SOP Class
python_mpps_1         | (0000, 0100) Command Field                       US: 33088
python_mpps_1         | (0000, 0120) Message ID Being Responded To       US: 2
python_mpps_1         | (0000, 0800) Command Data Set Type               US: 0
python_mpps_1         | (0000, 0900) Status                              US: 0
python_mpps_1         | (0008, 0016) SOP Class UID                       UI: Modality Performed Procedure Step SOP Class

I'm not exactly sure what Command Group Length, Command Field and Command Data Set Type should be, but more importantly, I do not know how to set them appropriately. I do not think they should be set in the Dataset, but part of the Command Set object for the N_CREATE response:

#     'N-CREATE-RSP': (
#         'CommandGroupLength', 'AffectedSOPClassUID', 'CommandField',
#         'MessageIDBeingRespondedTo', 'CommandDataSetType', 'Status',
#         'AffectedSOPInstanceUID',
#         'ErrorID', 'ErrorComment'
#     ),

Using DVTk as a testing tool, the MPPS.SCU script in their example scripts, everything seems to work except for the Command Set values not being sent in the response. After a little digging, I think those have to be set in another way, but I am not sure how.

The pynetdicom documentation might have some further info about that (first link), but I've been unable to find it.

1

There are 1 answers

7
Markus Sabin On BEST ANSWER

The Command Group Length (0000,0000) is the total number of bytes of your binary encoded message. This should usually be set by the toolkit that you are using (see comment from Scaramillion).

Your command type is an N-CREATE Response, and usually this comes without any dataset. Not knowing the DVT script, I assume that your script does not expect a dataset being attached to the command set.

I.e. SOP Class UID (0008, 0016) should not be present (it is already part of the Command Set as Affected SOP Class UID (0000,0002)), and Command Data Set Type (0000, 0800) should be set to 0x0101 to indicate that no data set is following the command set.

At least this counts for a successful N-CREATE operation.