• Questions about Building MPPS SCP with pynetdicom, N-Create Response, e

    From Stephen Douglas Scotti@21:1/5 to All on Sun Jun 27 09:49:12 2021
    I have an Orthanc server and primitive RIS under development. Orthanc does have some built-in support for MWL's, and I have that mostly working now with a live modality. Unfortunately, Orthanc does not have built-in support for MPPS. Solutions to that
    are to build or further develop the existing MWL C++ plug-in that comes bundled with Orthanc, or to develop a Python Plug-in as an "add-on" for MPPS. Python is a bit easier to work with initially, so I opted for that and starting looking into pynetdicom.
    It actually seems to work somewhat right out of the box with Orthanc and with some of the DVTk testing tools. I am able to send an N-Create message to Orthanc, and that is processed by the Python script that I slight modified from here:


    I just needed to add:

    import pydicom # https://github.com/pydicom/pydicom, sudo python3 -m pip install pydicom
    from pynetdicom import AE, evt, AllStoragePresentationContexts, build_context, debug_logger # sudo python3 -m pip install pynetdicom, https://github.com/pydicom/pynetdicom
    from pynetdicom.sop_class import ModalityPerformedProcedureStepSOPClass, CTImageStorage, MRImageStorage
    from pydicom.dataset import Dataset

    and also install the pip modules for those into my Orthanc Docker Container.

    Without going into all of the details, it works with the test script and it returns status code 0 and the following sample dataset, which is what is sent by the DVTk test script.

    In Pynet Dicom, N-CREATE
    pacs-2_1 | 1.2.826.0.1.3680043.2.1545.1.1624806391.0.467
    pacs-2_1 | Getting DataSet
    pacs-2_1 | Setting SOP UIDs
    pacs-2_1 | Updating Attributes
    pacs-2_1 | Returned 0x0000 and DataSet
    pacs-2_1 | (0008, 0016) SOP Class UID UI: Modality Performed Procedure Step SOP Class
    pacs-2_1 | (0008, 0018) SOP Instance UID UI: 1.2.826.0.1.3680043.2.1545.1.1624806391.0.467
    pacs-2_1 | (0008, 0060) Modality CS: 'CR'
    pacs-2_1 | (0008, 1032) Procedure Code Sequence 1 item(s) ---- pacs-2_1 | (0008, 0100) Code Value SH: 'PC-1'
    pacs-2_1 | (0008, 0102) Coding Scheme Designator SH: 'DVT'
    pacs-2_1 | (0008, 0104) Code Meaning LO: 'Procedure Code 1'
    pacs-2_1 | ---------
    pacs-2_1 | (0010, 0010) Patient's Name PN: 'Doe^John'
    pacs-2_1 | (0010, 0020) Patient ID LO: 'P123456'
    pacs-2_1 | (0010, 0030) Patient's Birth Date DA: '19501123'
    pacs-2_1 | (0010, 0040) Patient's Sex CS: 'M'
    pacs-2_1 | (0020, 0010) Study ID SH: 'RPID'
    pacs-2_1 | (0040, 0241) Performed Station AE Title AE: 'AE_CR1'
    pacs-2_1 | (0040, 0242) Performed Station Name SH: 'CR1'
    pacs-2_1 | (0040, 0243) Performed Location SH: 'CR_ROOM1'
    pacs-2_1 | (0040, 0244) Performed Procedure Step Start Date DA: '20210627'
    pacs-2_1 | (0040, 0245) Performed Procedure Step Start Time TM: '100631'
    pacs-2_1 | (0040, 0250) Performed Procedure Step End Date DA: '' pacs-2_1 | (0040, 0251) Performed Procedure Step End Time TM: '' pacs-2_1 | (0040, 0252) Performed Procedure Step Status CS: 'IN PROGRESS'
    pacs-2_1 | (0040, 0253) Performed Procedure Step ID SH: 'PPSID_1'
    pacs-2_1 | (0040, 0254) Performed Procedure Step Descriptio LO: 'ARM-C'
    pacs-2_1 | (0040, 0255) Performed Procedure Type Descriptio LO: '' pacs-2_1 | (0040, 0260) Performed Protocol Code Sequence 1 item(s) ----
    pacs-2_1 | (0008, 0100) Code Value SH: 'PAI-1'
    pacs-2_1 | (0008, 0102) Coding Scheme Designator SH: 'DVT'
    pacs-2_1 | (0008, 0104) Code Meaning LO: 'Performed Action Item 1'
    pacs-2_1 | ---------
    pacs-2_1 | (0040, 0270) Scheduled Step Attributes Sequence 1 item(s) ----
    pacs-2_1 | (0008, 0050) Accession Number SH: '110063115'
    pacs-2_1 | (0008, 1110) Referenced Study Sequence 1 item(s) ----
    pacs-2_1 | (0008, 1150) Referenced SOP Class UID UI: Detached Study Management SOP Class
    pacs-2_1 | (0008, 1155) Referenced SOP Instance UID UI: 1.2.826.0.1.3680043.2.1545.1.1624806391.0.467
    pacs-2_1 | ---------
    pacs-2_1 | (0020, 000d) Study Instance UID UI: 1.2.826.0.1.3680043.2.1545.1.1624806391.0.467
    pacs-2_1 | (0032, 1060) Requested Procedure Description LO: 'RPD-1'
    pacs-2_1 | (0040, 0007) Scheduled Procedure Step Descriptio LO: 'SPSD-1'
    pacs-2_1 | (0040, 0008) Scheduled Protocol Code Sequence 1 item(s) ----
    pacs-2_1 | (0008, 0100) Code Value SH: 'SAIC-1'
    pacs-2_1 | (0008, 0102) Coding Scheme Designator SH: 'DVT'
    pacs-2_1 | (0008, 0104) Code Meaning LO: 'Scheduled Action Item Code 1'
    pacs-2_1 | ---------
    pacs-2_1 | (0040, 0009) Scheduled Procedure Step ID SH: '110063119'
    pacs-2_1 | (0040, 1001) Requested Procedure ID SH: '110063117'
    pacs-2_1 | ---------
    pacs-2_1 | (0040, 0340) Performed Series Sequence 1 item(s) ----

    I am just starting out on developing this and just trying to understand how it all works. What "should" be in the dataset that is returned in the response ? Can that be modified somewhat, and then is the returned dataset used to populate the dicom tags
    of the performed procedure. I have not moved along to far yet because I need to understand how it all works and what the N-SET command does as well.

    One issue I've been having with a modality that is configured, without using MPPS, but using MWL files is that some tags (e.g. StudyDescription, ReferringPhysicianIdentificationSequence, PatientTelecomInformation) are not read / used by the modality,
    although they are in the MWL file. That is partially because the request doesn't ask for those tags, but even when I modify the request and return those tags in the response, the modality just ignores them, which is consistent with they conformance
    statement. They don't support those.

    I do have the ability to read the full MWL file from the python script in the N-Create method, so I could edit the dataset and return what I actually want them to be in the N-Create response.

    I do have a decent dev setup now with Orthanc with MWL support, a RIS running in a Docker container and the DVTk tools running in a Windows VM all on the same machine, so I can work through much of the development on the local machine before trying it
    with a live modality.

    I know there is a lot of documentation out there, some of which I've read, but this is just an outline of my current setup:

    1. MWL creation is handled by the RIS and MWL find requests are handled by Orthanc, so I really just need the MPPS support in Python or in a C++ plug-in.
    2. Modality MWL queries work, and the modality can create a study using a Scheduled Procedure form the MWL without MPPS support, but there are some limitations with that that require modifying the instance tags a bit after the study has been sent to
    3. The modality does have MPPS support, but not turned on yet because Orthanc does not support that yet. It should work though because I've tested connectivity and that works.
    4. My dev setup looks like it can be further developed to support MPPS, but I need to fully understand what should be returned in the N-Create and N-set responses and how that affects what dicom tags are in the stored instances.
    5. I do not have storage commitment enabled yet either, but can look into that later.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)