DICOM networking modules

Query-retrieve module

Query function

(task)openrem.remapp.netdicom.qrscu.qrscu(qr_scp_pk=None, store_scp_pk=None, implicit=False, explicit=False, move=False, query_id=None, date_from=None, date_until=None, modalities=None, inc_sr=False, remove_duplicates=True, filters=None, get_toshiba_images=False, *args, **kwargs)

Query retrieve service class user function

Queries a pre-configured remote query retrieve service class provider for dose metric related objects, making use of the filter parameters provided. Can automatically trigger a c-move (retrieve) operation.

Parameters:
  • qr_scp_pk (int, optional) – Database ID/pk of the remote QR SCP (Default value = None)
  • store_scp_pk (int, optional) – Database ID/pk of the local store SCP (Default value = None)
  • implicit (bool, optional) – Prefer implicit transfer syntax (preference possibly not implemented) (Default value = False)
  • explicit (bool, optional) – Prefer explicit transfer syntax (preference possibly not implemented) (Default value = False)
  • move (bool, optional) – Automatically trigger move request when query is complete (Default value = False)
  • query_id (str, optional) – UID of query if generated by web interface (Default value = None)
  • date_from (str, optional) – Date to search from, format yyyy-mm-dd (Default value = None)
  • date_until (str, optional) – Date to search until, format yyyy-mm-dd (Default value = None)
  • modalities (list, optional) – Modalities to search for, options are CT, MG, DX and FL (Default value = None)
  • inc_sr (bool, optional) – Only include studies that only have structured reports in (unknown modality) (Default value = False)
  • remove_duplicates (bool, optional) – If True, studies that already exist in the database are removed from the query results (Default value = True)
  • filters (dictionary list, optional) – include and exclude lists for StationName and StudyDescription (Default value = None)
  • get_toshiba_images (bool, optional) – Whether to try to get Toshiba dose summary images
  • *args
  • **kwargs
Returns:

Series Instance UIDs are stored as rows in the database to be used by a move request. Move request is optionally triggered automatically.

Move function

(task)openrem.remapp.netdicom.qrscu.movescu(query_id)

C-Move request element of query-retrieve service class user :param query_id: UUID of query in the DicomQuery table :return: None

openrem_qr.py script

Query remote server and retrieve to OpenREM

usage: openrem_qr.py [-h] [-ct] [-mg] [-fl] [-dx] [-f yyyy-mm-dd]
                     [-t yyyy-mm-dd] [-e string] [-i string] [-sne string]
                     [-sni string] [-toshiba] [-sr] [-dup]
                     qr_id store_id

Positional Arguments

qr_id Database ID of the remote QR node
store_id Database ID of the local store node

Named Arguments

-ct

Query for CT studies. Do not use with -sr

Default: False

-mg

Query for mammography studies. Do not use with -sr

Default: False

-fl

Query for fluoroscopy studies. Do not use with -sr

Default: False

-dx

Query for planar X-ray studies. Do not use with -sr

Default: False

-f, --dfrom Date from, format yyyy-mm-dd
-t, --duntil Date until, format yyyy-mm-dd
-e, --desc_exclude
 Terms to exclude in study description, comma separated, quote whole string
-i, --desc_include
 Terms that must be included in study description, comma separated, quote whole string
-sne, --stationname_exclude
 Terms to exclude in station name, comma separated, quote whole string
-sni, --stationname_include
 Terms to include in station name, comma separated, quote whole string
-toshiba

Advanced: Attempt to retrieve CT dose summary objects and one image from each series

Default: False

-sr

Advanced: Use if store has RDSRs only, no images. Cannot be used with -ct, -mg, -fl, -dx

Default: False

-dup

Advanced: Retrieve duplicates (objects that have been processed before)

Default: False

NetDICOM common functions

openrem.remapp.netdicom.tools.echoscu(scp_pk=None, store_scp=False, qr_scp=False, *args, **kwargs)

Function to check if built-in Store SCP or remote Query-Retrieve SCP returns a DICOM echo :param scp_pk: Primary key if either Store or QR SCP in database :param store_scp: True if checking Store SCP :param qr_scp: True if checking QR SCP :param args: :param kwargs: :return: ‘AssocFail’, Success or ?

openrem.remapp.netdicom.tools.create_ae(aet, port=None, sop_scu=None, sop_scp=None, transfer_syntax=None)

Function to create an application entity :param aet: string, AE Title :param sop_classes: list of supported SOP classes from netdicom.SOPclass to override default set :param transfer_syntax: list of supported transfer syntax from dicom.UID to override default set :return: application entity object ready to be started