GDCM 3.2.1

FindAllPatientName.py
1
14"""
15 This example shows how one can use the gdcm.CompositeNetworkFunctions class
16 for executing a C-FIND query
17 It will print the list of patient name found
18
19 Usage:
20
21 python FindAllPatientName.py
22
23"""
24
25 import gdcm
26
27# Patient Name
28tag = gdcm.Tag(0x10,0x10)
29de = gdcm.DataElement(tag)
30
31# Search all patient name where string match 'F*'
32de.SetByteStringValue('F*')
33
34ds = gdcm.DataSet()
35ds.Insert(de)
36
37cnf = gdcm.CompositeNetworkFunctions()
38theQuery = cnf.ConstructQuery (gdcm.ePatientRootType,gdcm.ePatient,ds)
39
40#print theQuery.ValidateQuery()
41
42# prepare the variable for output
43ret = gdcm.DataSetArrayType()
44
45# Execute the C-FIND query
46cnf.CFind('dicom.example.com',11112,theQuery,ret,'GDCM_PYTHON','ANY-SCP')
47
48 for i in range(0,ret.size()):
49 print "Patient #",i
50 print ret[i]
gdcm::CompositeNetworkFunctions
Composite Network Functions.
Definition gdcmCompositeNetworkFunctions.h:49
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39