{"id":13545793,"url":"https://github.com/pydicom/pynetdicom","last_synced_at":"2025-05-14T05:10:28.816Z","repository":{"id":15477716,"uuid":"69436608","full_name":"pydicom/pynetdicom","owner":"pydicom","description":"A Python implementation of the DICOM networking protocol","archived":false,"fork":false,"pushed_at":"2025-05-12T00:20:36.000Z","size":60348,"stargazers_count":536,"open_issues_count":14,"forks_count":185,"subscribers_count":32,"default_branch":"main","last_synced_at":"2025-05-13T13:07:07.194Z","etag":null,"topics":["dicom","networking","pydicom","python"],"latest_commit_sha":null,"homepage":"https://pydicom.github.io/pynetdicom","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pydicom.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-28T07:18:02.000Z","updated_at":"2025-05-12T00:17:53.000Z","dependencies_parsed_at":"2024-01-02T00:26:28.834Z","dependency_job_id":"19f96049-a96b-4066-bb77-178daa15819f","html_url":"https://github.com/pydicom/pynetdicom","commit_stats":{"total_commits":828,"total_committers":44,"mean_commits":"18.818181818181817","dds":0.1968599033816425,"last_synced_commit":"37ccf384e6a1e5a844122b81542d65b263fa0682"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpynetdicom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpynetdicom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpynetdicom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pydicom%2Fpynetdicom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pydicom","download_url":"https://codeload.github.com/pydicom/pynetdicom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948445,"owners_count":21988957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dicom","networking","pydicom","python"],"created_at":"2024-08-01T12:00:17.944Z","updated_at":"2025-05-14T05:10:28.790Z","avatar_url":"https://github.com/pydicom.png","language":"Python","funding_links":[],"categories":["Libraries","Uncategorized"],"sub_categories":["Uncategorized","Python"],"readme":"|coverage| |unit-tests| |type-hints| |docs| |black| |pypi-versions| |python-versions| |conda| |zenodo|\n\n.. |coverage| image:: https://codecov.io/gh/pydicom/pynetdicom/branch/main/graph/badge.svg\n   :target: https://codecov.io/gh/pydicom/pynetdicom\n\n.. |unit-tests| image:: https://github.com/pydicom/pynetdicom/workflows/unit-tests/badge.svg\n   :target: https://github.com/pydicom/pynetdicom/actions?query=workflow%3Aunit-tests\n\n.. |type-hints| image:: https://github.com/pydicom/pynetdicom/workflows/type-hints/badge.svg\n   :target: https://github.com/pydicom/pynetdicom/actions?query=workflow%3Atype-hints\n\n.. |docs| image:: https://circleci.com/gh/pydicom/pynetdicom/tree/main.svg?style=shield\n   :target: https://circleci.com/gh/pydicom/pynetdicom/tree/main\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n\n.. |pypi-versions| image:: https://badge.fury.io/py/pynetdicom.svg\n   :target: https://badge.fury.io/py/pynetdicom\n\n.. |python-versions| image:: https://img.shields.io/pypi/pyversions/pynetdicom.svg\n   :target: https://img.shields.io/pypi/pyversions/pynetdicom.svg\n\n.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/pynetdicom.svg\n   :target: https://anaconda.org/conda-forge/pynetdicom\n\n.. |zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3880767.svg\n   :target: https://doi.org/10.5281/zenodo.3880767\n\n\npynetdicom\n==========\n\nA Python implementation of the `DICOM \u003chttps://www.dicomstandard.org\u003e`_\nnetworking protocol, originally based on (legacy)\n`pynetdicom \u003chttps://github.com/patmun/pynetdicom_legacy\u003e`_.\n\n\nDescription\n-----------\n\n`DICOM \u003chttps://www.dicomstandard.org\u003e`_ is the international standard for\nmedical images and related information. It defines the formats and communication\nprotocols for media exchange in radiology, cardiology, radiotherapy and other\nmedical domains.\n\n*pynetdicom* is a pure Python package that implements the DICOM\nnetworking protocol. Working with\n`pydicom \u003chttps://github.com/pydicom/pydicom\u003e`_, it allows the easy creation\nof DICOM *Service Class Users* (SCUs) and *Service Class Providers* (SCPs).\n\n*pynetdicom's* main user class is\n`AE \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.ae.ApplicationEntity.html\u003e`_\nand is used to represent a DICOM Application Entity. With it you can:\n\n- Start the application as an SCP by specifying the supported presentation\n  contexts then calling\n  `AE.start_server() \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.ae.ApplicationEntity.html#pynetdicom.ae.ApplicationEntity.start_server\u003e`_\n  and waiting for incoming association requests\n- Use the application as an SCU by specifying the presentation contexts you\n  want the peer SCP to support, then requesting an association\n  via the\n  `AE.associate() \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.ae.ApplicationEntity.html#pynetdicom.ae.ApplicationEntity.associate\u003e`_\n  method, which returns an\n  `Association \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association\u003e`_\n  thread.\n\nOnce associated, the services available to the association can\nbe used by sending\n`DIMSE-C \u003chttps://dicom.nema.org/medical/dicom/current/output/html/part07.html#chapter_9\u003e`_\nand\n`DIMSE-N \u003chttps://dicom.nema.org/medical/dicom/current/output/html/part07.html#chapter_10\u003e`_\nmessages.\n\nDocumentation\n-------------\nThe *pynetdicom*\n`tutorials \u003chttps://pydicom.github.io/pynetdicom/stable/tutorials/index.html\u003e`_,\n`user guide \u003chttps://pydicom.github.io/pynetdicom/stable/user/index.html\u003e`_,\n`code examples \u003chttps://pydicom.github.io/pynetdicom/stable/examples/index.html\u003e`_,\n`application \u003chttps://pydicom.github.io/pynetdicom/stable/apps/index.html\u003e`_ and\n`API reference \u003chttps://pydicom.github.io/pynetdicom/stable/reference/index.html\u003e`_\ndocumentation is available for the\n`current release \u003chttps://pydicom.github.io/pynetdicom/\u003e`_ as well as the\n`development version \u003chttps://pydicom.github.io/pynetdicom/dev\u003e`_.\n\nInstallation\n------------\nDependencies\n~~~~~~~~~~~~\n`pydicom \u003chttps://github.com/pydicom/pydicom\u003e`_\n\nInstalling current release\n~~~~~~~~~~~~~~~~~~~~~~~~~~\nUsing pip:\n\n.. code-block:: sh\n\n    pip install -U pynetdicom\n\nUsing conda:\n\n.. code-block:: sh\n\n    conda install -c conda-forge pynetdicom\n\nFor more detailed instructions, including how to install the\ncurrent development version, please see the `installation guide\n\u003chttps://pydicom.github.io/pynetdicom/stable/tutorials/installation.html\u003e`_.\n\n\nSupported DIMSE Services\n------------------------\nSCU Services\n~~~~~~~~~~~~\n\nWhen the AE is acting as an SCU and an association has been established with a\npeer SCP, the following DIMSE-C and -N services are available:\n\n.. _assoc: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html\n.. _echo: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_c_echo\n.. _find: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_c_find\n.. _c_get: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_c_get\n.. _move: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_c_move\n.. _store: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_c_store\n.. _action: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_n_action\n.. _create: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_n_create\n.. _delete: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_n_delete\n.. _er: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_n_event_report\n.. _n_get: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_n_get\n.. _set: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html#pynetdicom.association.Association.send_n_set\n\n\n+----------------+----------------------------------------------------------------------------------------+\n| DIMSE service  | `Association \u003cassoc_\u003e`_ method                                                         |\n+================+========================================================================================+\n| C-ECHO         | `Association.send_c_echo() \u003cecho_\u003e`_                                                   |\n+----------------+----------------------------------------------------------------------------------------+\n| C-FIND         | `Association.send_c_find(dataset, query_model) \u003cfind_\u003e`_                               |\n+----------------+----------------------------------------------------------------------------------------+\n| C-GET          | `Association.send_c_get(dataset, query_model) \u003cc_get_\u003e`_                               |\n+----------------+----------------------------------------------------------------------------------------+\n| C-MOVE         | `Association.send_c_move(dataset, move_aet, query_model) \u003cmove_\u003e`_                     |\n+----------------+----------------------------------------------------------------------------------------+\n| C-STORE        | `Association.send_c_store(dataset) \u003cstore_\u003e`_                                          |\n+----------------+----------------------------------------------------------------------------------------+\n| N-ACTION       | `Association.send_n_action(dataset, action_type, class_uid, instance_uid) \u003caction_\u003e`_  |\n+----------------+----------------------------------------------------------------------------------------+\n| N-CREATE       | `Association.send_n_create(dataset, class_uid, instance_uid) \u003ccreate_\u003e`_               |\n+----------------+----------------------------------------------------------------------------------------+\n| N-DELETE       | `Association.send_n_delete(class_uid, instance_uid) \u003cdelete_\u003e`_                        |\n+----------------+----------------------------------------------------------------------------------------+\n| N-EVENT-REPORT | `Association.send_n_event_report(dataset, event_type, class_uid, instance_uid) \u003cer_\u003e`_ |\n+----------------+----------------------------------------------------------------------------------------+\n| N-GET          | `Association.send_n_get(identifier_list, class_uid, instance_uid) \u003cn_get_\u003e`_           |\n+----------------+----------------------------------------------------------------------------------------+\n| N-SET          | `Association.send_n_set(dataset, class_uid, instance_uid) \u003cset_\u003e`_                     |\n+----------------+----------------------------------------------------------------------------------------+\n\nWhere *dataset* is a pydicom\n`Dataset \u003chttps://pydicom.github.io/pydicom/stable/ref_guide.html#dataset\u003e`_\nobject, *query_model* is a UID string, *identifier_list* is a list of pydicom\n`Tag \u003chttps://pydicom.github.io/pydicom/stable/api_ref.html#pydicom.tag.Tag\u003e`_\nobjects, *event_type* and *action_type* are ints and *class_uid* and\n*instance_uid* are UID strings. See the\n`Association documentation \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.association.Association.html\u003e`_\nfor more information.\n\n\nSCP Services\n~~~~~~~~~~~~\n\nWhen the AE is acting as an SCP the following DIMSE-C and -N services are\navailable to the peer once an association has been established:\n\n.. _hecho: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_echo.html\n.. _hfind: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_find.html\n.. _hc_get: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_c_get.html\n.. _hmove: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_move.html\n.. _hstore: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_store.html\n.. _haction: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_action.html\n.. _hcreate: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_create.html\n.. _hdelete: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_delete.html\n.. _her: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_event_report.html\n.. _hn_get: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_n_get.html\n.. _hset: https://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom._handlers.doc_handle_set.html\n\n+----------------+----------------------------+---------------------------------+\n| DIMSE service  | Intervention Event         | Handler documentation           |\n+================+============================+=================================+\n| C-ECHO         | ``evt.EVT_C_ECHO``         | `Handle C-ECHO \u003checho_\u003e`_       |\n+----------------+----------------------------+---------------------------------+\n| C-FIND         | ``evt.EVT_C_FIND``         | `Handle C-FIND \u003chfind_\u003e`_       |\n+----------------+----------------------------+---------------------------------+\n| C-GET          | ``evt.EVT_C_GET``          | `Handle C-GET \u003chc_get_\u003e`_       |\n+----------------+----------------------------+---------------------------------+\n| C-MOVE         | ``evt.EVT_C_MOVE``         | `Handle C-MOVE \u003chmove_\u003e`_       |\n+----------------+----------------------------+---------------------------------+\n| C-STORE        | ``evt.EVT_C_STORE``        | `Handle C-STORE \u003chstore_\u003e`_     |\n+----------------+----------------------------+---------------------------------+\n| N-ACTION       | ``evt.EVT_N_ACTION``       | `Handle N-ACTION \u003chaction_\u003e`_   |\n+----------------+----------------------------+---------------------------------+\n| N-CREATE       | ``evt.EVT_N_CREATE``       | `Handle N-CREATE \u003chcreate_\u003e`_   |\n+----------------+----------------------------+---------------------------------+\n| N-DELETE       | ``evt.EVT_N_DELETE``       | `Handle N-DELETE \u003chdelete_\u003e`_   |\n+----------------+----------------------------+---------------------------------+\n| N-EVENT-REPORT | ``evt.EVT_N_EVENT_REPORT`` | `Handle N-EVENT-REPORT \u003cher_\u003e`_ |\n+----------------+----------------------------+---------------------------------+\n| N-GET          | ``evt.EVT_N_GET``          | `Handle N-GET \u003chn_get_\u003e`_       |\n+----------------+----------------------------+---------------------------------+\n| N-SET          | ``evt.EVT_N_SET``          | `Handle N-SET \u003chset_\u003e`_         |\n+----------------+----------------------------+---------------------------------+\n\n\nWith the exception of the C-ECHO service, a user-defined callable function,\n*handler*, must be bound to the corresponding\n`intervention event \u003chttps://pydicom.github.io/pynetdicom/stable/user/events#intervention-events\u003e`_\nin order to complete a DIMSE service request. Events\ncan be imported with ``from pynetdicom import evt`` and a handler can be\nbound to an event prior to starting an association through the *evt_handlers*\nkeyword arguments in\n`AE.start_server() \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.ae.ApplicationEntity.html#pynetdicom.ae.ApplicationEntity.start_server\u003e`_\nand\n`AE.associate() \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.ae.ApplicationEntity.html#pynetdicom.ae.ApplicationEntity.associate\u003e`_.\n\nWhen an event occurs the *handler* function is called and passed a single\nparameter, *event*, which is an\n`Event \u003chttps://pydicom.github.io/pynetdicom/stable/reference/generated/pynetdicom.events.Event.html\u003e`_\nobject whose specific attributes\nare dependent on the type of event that occurred. Handlers bound to\nintervention events must  return or yield certain values. See the\n`handler documentation \u003chttps://pydicom.github.io/pynetdicom/stable/reference/events\u003e`_\nfor information on what attributes and properties are available in ``Event``\nfor each event type and the expected returns/yields for the\ncorresponding handlers.\n\nApplications\n------------\n\nSome basic DICOM applications are included with *pynetdicom*:\n\n* `echoscp \u003chttps://pydicom.github.io/pynetdicom/stable/apps/echoscp.html\u003e`_\n* `echoscu \u003chttps://pydicom.github.io/pynetdicom/stable/apps/echoscu.html\u003e`_\n* `findscu \u003chttps://pydicom.github.io/pynetdicom/stable/apps/findscu.html\u003e`_\n* `getscu \u003chttps://pydicom.github.io/pynetdicom/stable/apps/getscu.html\u003e`_\n* `qrscp \u003chttps://pydicom.github.io/pynetdicom/stable/apps/qrscp.html\u003e`_\n  (requires `sqlalchemy \u003chttps://www.sqlalchemy.org/\u003e`_)\n* `movescu \u003chttps://pydicom.github.io/pynetdicom/stable/apps/movescu.html\u003e`_\n* `storescp \u003chttps://pydicom.github.io/pynetdicom/stable/apps/storescp.html\u003e`_\n* `storescu \u003chttps://pydicom.github.io/pynetdicom/stable/apps/storescu.html\u003e`_\n\nCode Examples\n-------------\n\nMore\n`code examples \u003chttps://pydicom.github.io/pynetdicom/stable/examples/index.html\u003e`_\nare available in the documentation.\n\nEcho SCU\n~~~~~~~~\nSend a C-ECHO request to a Verification SCP (at TCP/IP address\n*addr*, listen port number *port*):\n\n.. code-block:: python\n\n        from pynetdicom import AE\n\n        ae = AE(ae_title='MY_ECHO_SCU')\n        # Verification SOP Class has a UID of 1.2.840.10008.1.1\n        #   we can use the UID str directly when adding the requested\n        #   presentation context\n        ae.add_requested_context('1.2.840.10008.1.1')\n\n        # Associate with a peer AE\n        assoc = ae.associate(addr, port)\n\n        if assoc.is_established:\n            # Send a DIMSE C-ECHO request to the peer\n            status = assoc.send_c_echo()\n\n            # Print the response from the peer\n            if status:\n                print('C-ECHO Response: 0x{0:04x}'.format(status.Status))\n\n            # Release the association\n            assoc.release()\n\nEcho SCP\n~~~~~~~~\nCreate a blocking Echo SCP on port ``11112`` (you may optionally\nbind a handler to the ``evt.EVT_C_ECHO`` event if you want to return something\nother than an ``0x0000`` *Success* status):\n\n.. code-block:: python\n\n        from pynetdicom import AE, VerificationPresentationContexts\n\n        ae = AE(ae_title='MY_ECHO_SCP')\n        # Or we can use the inbuilt VerificationPresentationContexts list,\n        #   there's one for each of the supported Service Classes\n        # In this case, we are supporting any requests to use Verification SOP\n        #   Class in the association\n        ae.supported_contexts = VerificationPresentationContexts\n\n        # Start the SCP on (host, port) in blocking mode\n        ae.start_server((\"localhost\", 11112), block=True)\n\nAlternatively, you can start the SCP in non-blocking mode, which returns the\nrunning server instance. This can be useful when you want to run a Storage SCP\nand make C-MOVE requests within the same AE.\n\nIn the next example we'll create a non-blocking Verification SCP and bind a\nhandler for the C-ECHO service request event ``evt.EVT_C_ECHO`` that logs the\nrequestor's address and port number and the timestamp for the event.\n\n.. code-block:: python\n\n        import logging\n\n        from pynetdicom import AE, evt, debug_logger\n        from pynetdicom.sop_class import Verification\n\n        # Setup logging to use the StreamHandler at the debug level\n        debug_logger()\n\n        ae = AE(ae_title='MY_ECHO_SCP')\n        ae.add_supported_context(Verification)\n\n        # Implement the EVT_C_ECHO handler\n        def handle_echo(event, logger):\n            \"\"\"Handle a C-ECHO service request.\n\n            Parameters\n            ----------\n            event : evt.Event\n                The C-ECHO service request event, this parameter is always\n                present.\n            logger : logging.Logger\n                The logger to use, this parameter is only present because we\n                bound ``evt.EVT_C_ECHO`` using a 3-tuple.\n\n            Returns\n            -------\n            int or pydicom.dataset.Dataset\n                The status returned to the peer AE in the C-ECHO response.\n                Must be a valid C-ECHO status value as either an ``int`` or a\n                ``Dataset`` object containing an (0000,0900) *Status* element.\n            \"\"\"\n            # Every *Event* includes `assoc` and `timestamp` attributes\n            #   which are the *Association* instance the event occurred in\n            #   and the *datetime.datetime* the event occurred at\n            requestor = event.assoc.requestor\n            timestamp = event.timestamp.strftime(\"%Y-%m-%d %H:%M:%S\")\n            msg = (\n                \"Received C-ECHO service request from ({}, {}) at {}\"\n                .format(requestor.address, requestor.port, timestamp)\n            )\n            logger.info(msg)\n\n            # Return a *Success* status\n            return 0x0000\n\n        # By binding using a 3-tuple we can pass extra arguments to\n        #   the handler\n        handlers = [(evt.EVT_C_ECHO, handle_echo, [logging.getLogger('pynetdicom')])]\n\n        # Start the SCP in non-blocking mode\n        scp = ae.start_server((\"localhost\", 11112), block=False, evt_handlers=handlers)\n\n        # Associate and send a C-ECHO request to our own Verification SCP\n        ae.add_requested_context(Verification)\n        assoc = ae.associate('localhost', 11112)\n        if assoc.is_established:\n            status = assoc.send_c_echo()\n            assoc.release()\n\n        # Shutdown the SCP\n        scp.shutdown()\n\nStorage SCU\n~~~~~~~~~~~\nSend the DICOM *CT Image Storage* dataset in *file-in.dcm* to a peer Storage\nSCP (at TCP/IP address *addr*, listen port number *port*):\n\n.. code-block:: python\n\n        from pydicom import dcmread\n        from pydicom.uid import ImplicitVRLittleEndian\n\n        from pynetdicom import AE, VerificationPresentationContexts\n        from pynetdicom.sop_class import CTImageStorage, MRImageStorage\n\n        ae = AE(ae_title='MY_STORAGE_SCU')\n        # We can also do the same thing with the requested contexts\n        ae.requested_contexts = VerificationPresentationContexts\n        # Or we can use inbuilt objects like CTImageStorage.\n        # The requested presentation context's transfer syntaxes can also\n        #   be specified using a str/UID or list of str/UIDs\n        ae.add_requested_context(CTImageStorage,\n                                 transfer_syntax=ImplicitVRLittleEndian)\n        # Adding a presentation context with multiple transfer syntaxes\n        ae.add_requested_context(MRImageStorage,\n                                 transfer_syntax=[ImplicitVRLittleEndian,\n                                                  '1.2.840.10008.1.2.1'])\n\n        assoc = ae.associate(addr, port)\n        if assoc.is_established:\n            dataset = dcmread('file-in.dcm')\n            # `status` is the response from the peer to the store request\n            # but may be an empty pydicom Dataset if the peer timed out or\n            # sent an invalid dataset.\n            status = assoc.send_c_store(dataset)\n\n            assoc.release()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydicom%2Fpynetdicom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpydicom%2Fpynetdicom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpydicom%2Fpynetdicom/lists"}