MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Stephen D. Scotti
Posts: 16
Joined: Fri, 2020-06-19, 07:56

MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

#1 Post by Stephen D. Scotti »

I've been working on implementing a MPPS server to be used with Orthanc and an MRI scanner that we have. It is really only the comms between the scanner and the MPPS server that I need to worry about at this point. I did some initial development by packaging up a Docker containing running Python and the MPPS server in one, MySQL in another, and Orthanc in another. I am also using the DVTk tools to do some initial testing since when I tried initially with the scanner it was able to ping the MPPS server, but it would just time out with an N_CREATE request. Since then I've done a lot more development. With DVTk, I think that the response is not quite right yet since I am seeing the following. BTW, if I can get this to work and polished up I'll make it open source. Also willing to collaborate with another developer or pay $$ to one to get through the initial stages of setup. I have it packaged up with my master project at this point, but would not be too hard to create a dedicated dev package with docker-compose that has the MPPS server, Orthanc and MySQL, and then use DVTk for testing purposes.

RESULT: PASSED
Number of Validation Errors: 0 - Number of Validation Warnings: 0
Number of User Validation Errors: 0 - Number of User Validation Warnings: 0
Number of General Errors: 0 - Number of General Warnings: 1

Warning: Unexpected DICOM Dataset received - DICOMScript does not match Product behaviour.


and the following in the DVTk output.

VALIDATE N-CREATE-RSP
Against reference Command: N-CREATE-RSP
N-CREATE-RSP

Module: N-CREATE-RSP (M)

(0000,0000) UL - 1 + 4 Group 0000 Length 0x0000007E=126
Source attribute (0000,0000) not present in reference object


(0000,0002) UI - 3 + 24 Affected SOP Class UID 1.2.840.10008.3.1.2.3.3

(0000,0100) US - 1 + 2 Command Field 0x8140=33088
Source attribute (0000,0100) not present in reference object


(0000,0120) US - 1 + 2 Message ID Being Responded To 0x0003=3
Source attribute (0000,0120) not present in reference object


(0000,0800) US - 1 + 2 Data Set Type 0x0001=1
Source attribute (0000,0800) not present in reference object


(0000,0900) US - 1 + 2 Status 0x0000=0

(0000,1000) UI - 3 + 46 Affected SOP Instance UID 1.2.826.0.1.3680043.2.1545.1.1625414781.0.351


I have the full logs and the script, but I think for starters I can post the Dataset that I printed out to the Docker Container. This is the modified slightly from the Dataset / attr_list that is sent in the request. The Command Group Length is probably wrong, and there is no MetaHeader. It seems like DVTk expects to see something in the reference object and isn't, "not present in reference object", so not sure if things are correct yet or now. I want to fine tune it with DVTk before trying it live with the MRI scanner.

I started using this script: https://pydicom.github.io/pynetdicom/st ... l#mpps-scp

But it is already modified extensively to add a database, conversion of the dataset to JSON, and some other things.

python_mpps_1 | Returned 0x0000 and DataSet
python_mpps_1 | (0000, 0000) Command Group Length UL: 2
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: 3
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
python_mpps_1 | (0008, 0018) SOP Instance UID UI: 1.2.826.0.1.3680043.2.1545.1.1625414781.0.351
python_mpps_1 | (0008, 0060) Modality CS: 'CR'
python_mpps_1 | (0008, 1032) Procedure Code Sequence 1 item(s) ----
python_mpps_1 | (0008, 0100) Code Value SH: 'PC-1'
python_mpps_1 | (0008, 0102) Coding Scheme Designator SH: 'DVT'
python_mpps_1 | (0008, 0104) Code Meaning LO: 'Procedure Code 1'
python_mpps_1 | ---------
python_mpps_1 | (0010, 0010) Patient's Name PN: 'Doe^John'
python_mpps_1 | (0010, 0020) Patient ID LO: 'P123456'
python_mpps_1 | (0010, 0030) Patient's Birth Date DA: '19501123'
python_mpps_1 | (0010, 0040) Patient's Sex CS: 'M'
python_mpps_1 | (0020, 0010) Study ID SH: 'RPID'
python_mpps_1 | (0040, 0241) Performed Station AE Title AE: 'AE_CR1'
python_mpps_1 | (0040, 0242) Performed Station Name SH: 'CR1'
python_mpps_1 | (0040, 0243) Performed Location SH: 'CR_ROOM1'
python_mpps_1 | (0040, 0244) Performed Procedure Step Start Date DA: '20210704'
python_mpps_1 | (0040, 0245) Performed Procedure Step Start Time TM: '110621'
python_mpps_1 | (0040, 0250) Performed Procedure Step End Date DA: ''
python_mpps_1 | (0040, 0251) Performed Procedure Step End Time TM: ''
python_mpps_1 | (0040, 0252) Performed Procedure Step Status CS: 'IN PROGRESS'
python_mpps_1 | (0040, 0253) Performed Procedure Step ID SH: 'PPSID_1'
python_mpps_1 | (0040, 0254) Performed Procedure Step Descriptio LO: 'ARM-C'
python_mpps_1 | (0040, 0255) Performed Procedure Type Descriptio LO: ''
python_mpps_1 | (0040, 0260) Performed Protocol Code Sequence 1 item(s) ----
python_mpps_1 | (0008, 0100) Code Value SH: 'PAI-1'
python_mpps_1 | (0008, 0102) Coding Scheme Designator SH: 'DVT'
python_mpps_1 | (0008, 0104) Code Meaning LO: 'Performed Action Item 1'
python_mpps_1 | ---------
python_mpps_1 | (0040, 0270) Scheduled Step Attributes Sequence 1 item(s) ----
python_mpps_1 | (0008, 0050) Accession Number SH: '111062125'
python_mpps_1 | (0008, 1110) Referenced Study Sequence 1 item(s) ----
python_mpps_1 | (0008, 1150) Referenced SOP Class UID UI: Detached Study Management SOP Class
python_mpps_1 | (0008, 1155) Referenced SOP Instance UID UI: 1.2.826.0.1.3680043.2.1545.1.1625414781.0.357
python_mpps_1 | ---------
python_mpps_1 | (0020, 000d) Study Instance UID UI: 1.2.826.0.1.3680043.2.1545.1.1625414781.0.357
python_mpps_1 | (0032, 1060) Requested Procedure Description LO: 'RPD-1'
python_mpps_1 | (0040, 0007) Scheduled Procedure Step Descriptio LO: 'SPSD-1'
python_mpps_1 | (0040, 0008) Scheduled Protocol Code Sequence 1 item(s) ----
python_mpps_1 | (0008, 0100) Code Value SH: 'SAIC-1'
python_mpps_1 | (0008, 0102) Coding Scheme Designator SH: 'DVT'
python_mpps_1 | (0008, 0104) Code Meaning LO: 'Scheduled Action Item Code 1'
python_mpps_1 | ---------
python_mpps_1 | (0040, 0009) Scheduled Procedure Step ID SH: '111062129'
python_mpps_1 | (0040, 1001) Requested Procedure ID SH: '111062127'
python_mpps_1 | ---------
python_mpps_1 | (0040, 0340) Performed Series Sequence 1 item(s) ----
python_mpps_1 |
python_mpps_1 | ---------

Also, just generally speaking, the MWL that we have setup seems to be working OK, but the issue I am having is that some of the tags in the MWL are ignored by the MRI scanner, even if I send them back in the MWL query response. I am able to further modify instances as they are stored in PACS, and that also works, but just kind of brute force method. I am still not too familiar with how MPPS works, but presumably, I can modify the attr_list in the N_CREATE and return the modified list to the scanner to use for the study ? That would actually solve a number problems and provide a lot of flexibility down the road. I have not moved on to the N_SET method yet because I want to get thing to pass with DVTk first.

I actually did write a thing to reconstruct the Dataset into a JSON format witht the short names instead of tag using Hex. Seems to work, but I haven't completely tested that. Just uses Pydicom and Python code for that, but had to make some sort of exception for PersonName objects.

{
"CommandGroupLength": 2,
"AffectedSOPClassUID": "1.2.840.10008.3.1.2.3.3",
"CommandField": 33088,
"MessageIDBeingRespondedTo": 3,
"CommandDataSetType": 0,
"Status": 0,
"SOPClassUID": "1.2.840.10008.3.1.2.3.3",
"SOPInstanceUID": "1.2.826.0.1.3680043.2.1545.1.1625414781.0.351",
"Modality": "CR",
"ProcedureCodeSequence": [{
"CodeValue": "PC-1",
"CodingSchemeDesignator": "DVT",
"CodeMeaning": "Procedure Code 1"
}],
"PatientName": "Doe^John^^^",
"PatientID": "P123456",
"PatientBirthDate": "19501123",
"PatientSex": "M",
"StudyID": "RPID",
"PerformedStationAETitle": "AE_CR1",
"PerformedStationName": "CR1",
"PerformedLocation": "CR_ROOM1",
"PerformedProcedureStepStartDate": "20210704",
"PerformedProcedureStepStartTime": "110621",
"PerformedProcedureStepEndDate": "",
"PerformedProcedureStepEndTime": "",
"PerformedProcedureStepStatus": "IN PROGRESS",
"PerformedProcedureStepID": "PPSID_1",
"PerformedProcedureStepDescription": "ARM-C",
"PerformedProcedureTypeDescription": "",
"PerformedProtocolCodeSequence": [{
"CodeValue": "PAI-1",
"CodingSchemeDesignator": "DVT",
"CodeMeaning": "Performed Action Item 1"
}],
"ScheduledStepAttributesSequence": [{
"AccessionNumber": "111062125",
"ReferencedStudySequence": [{
"ReferencedSOPClassUID": "1.2.840.10008.3.1.2.3.1",
"ReferencedSOPInstanceUID": "1.2.826.0.1.3680043.2.1545.1.1625414781.0.357"
}],
"StudyInstanceUID": "1.2.826.0.1.3680043.2.1545.1.1625414781.0.357",
"RequestedProcedureDescription": "RPD-1",
"ScheduledProcedureStepDescription": "SPSD-1",
"ScheduledProtocolCodeSequence": [{
"CodeValue": "SAIC-1",
"CodingSchemeDesignator": "DVT",
"CodeMeaning": "Scheduled Action Item Code 1"
}],
"ScheduledProcedureStepID": "111062129",
"RequestedProcedureID": "111062127"
}],
"PerformedSeriesSequence": [{}]
}
Last edited by Stephen D. Scotti on Sun, 2021-07-04, 18:56, edited 1 time in total.

Stephen D. Scotti
Posts: 16
Joined: Fri, 2020-06-19, 07:56

Re: MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

#2 Post by Stephen D. Scotti »

I guess that instead of using DVTk I could use dcmtk mppsscu to create some test scripts to do some testing with dcmtk from the command line or from a script directly also ?

Stephen D. Scotti
Posts: 16
Joined: Fri, 2020-06-19, 07:56

Re: MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

#3 Post by Stephen D. Scotti »

This might be relevant ?

https://forum.dcmtk.org/viewtopic.php?t=583

#2 Post by Marco Eichelberg » Mon, 2006-01-02, 14:11
Attributes of group (0000,xxxx) never belong in the dataset. These are only ever sent as part of the command set. Since you already successful assemble a command struct using the functions from dcmtk/dcmnet/dimse.h, it should be fairly easy to update your code to also set the SOP instance UID there. There is also a binary flag reflecting the fact that the optional SOP instance UID should be included in the command set.

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

#4 Post by Michael Onken »

Stephen D. Scotti wrote: Sun, 2021-07-04, 18:01 I guess that instead of using DVTk I could use dcmtk mppsscu to create some test scripts to do some testing with dcmtk from the command line or from a script directly also ?
There is no free mpssscu tool in DCMTK, but OFFIS sells it, if you're interested, see this page for details and contact.

Best,
Michael

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

#5 Post by Michael Onken »

Stephen D. Scotti wrote: Sun, 2021-07-04, 18:04 This might be relevant ?

https://forum.dcmtk.org/viewtopic.php?t=583

#2 Post by Marco Eichelberg » Mon, 2006-01-02, 14:11
Attributes of group (0000,xxxx) never belong in the dataset. These are only ever sent as part of the command set. Since you already successful assemble a command struct using the functions from dcmtk/dcmnet/dimse.h, it should be fairly easy to update your code to also set the SOP instance UID there. There is also a binary flag reflecting the fact that the optional SOP instance UID should be included in the command set.

Yes, no tags below (0008,....) are permitted in the dataset.

Best regards,
Michael

Stephen D. Scotti
Posts: 16
Joined: Fri, 2020-06-19, 07:56

Re: MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

#6 Post by Stephen D. Scotti »

Thanks for the info. Your licensed products are apparently available for a 4-month trial period ? Do I just need to the offis e-mail address to get pricing and further details ?

Thank you.

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: MPPS development with pydicom / pynetdicom, testing with DVTk, general questions

#7 Post by Michael Onken »

Hi,

yes, just mail to the address provided on the website. Note, however, that the tool does not come with test data (if I remember correctly, one or two MPPS objects are included for tryout).

Best,
Michael

Post Reply

Who is online

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