DICOM networking modules

Query-retrieve module

Query function

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, single_date=False, time_from=None, time_until=None, modalities=None, inc_sr=False, remove_duplicates=True, filters=None, get_toshiba_images=False, get_empty_sr=False)

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)

  • single_date (bool, optional) – search only on date_from, allows time_from/time_until (Default value = False)

  • time_from (str, optional) – Time of day to search from, format hhmm 24 hour clock, single date only (Default value = None)

  • time_until (str, optional) – Time of day to search until, format hhmm 24 hour clock, single date only (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) – lowercase 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

  • get_empty_sr (bool, optional) – Whether to get SR series that return nothing at image level

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

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

C-Move request element of query-retrieve service class user :param query_id: ID 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] [-nm] [-f yyyy-mm-dd]
                     [-t yyyy-mm-dd] [-sd yyyy-mm-dd] [-tf hhmm] [-tt hhmm]
                     [-e string] [-i string] [-sne string] [-sni string]
                     [--stationname_study_level] [-toshiba] [-sr] [-dup]
                     [-emptysr]
                     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. Cannot be used with -sr

Default: False

-mg

Query for mammography studies. Cannot be used with -sr

Default: False

-fl

Query for fluoroscopy studies. Cannot be used with -sr

Default: False

-dx

Query for planar X-ray studies (includes panoramic X-ray studies). Cannot be used with -sr

Default: False

-nm

Query for nuclear medicine studies. Cannot be used with -sr

Default: False

-f, --dfrom

Date from, format yyyy-mm-dd. Cannot be used with –single_date

-t, --duntil

Date until, format yyyy-mm-dd. Cannot be used with –single_date

-sd, --single_date

Date, format yyy-mm-dd. Cannot be used with –dfrom or –duntil

-tf, --tfrom

Time from, format hhmm. Requires –single_date.

-tt, --tuntil

Time until, format hhmm. Requires –single_date.

-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

--stationname_study_level

Advanced: Filter station name at Study level, instead of at Series level

Default: False

-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

-emptysr

Advanced: Get SR series that return nothing at image level query

Default: False

NetDICOM common functions

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

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 :return: ‘AssocFail’, Success or ?