GDCM
2.2.6
Main Page
Related Pages
Namespaces
Classes
Files
Examples
FindAllPatientName.py
1
############################################################################
2
#
3
# Program: GDCM (Grassroots DICOM). A DICOM library
4
#
5
# Copyright (c) 2006-2011 Mathieu Malaterre
6
# All rights reserved.
7
# See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
#
9
# This software is distributed WITHOUT ANY WARRANTY; without even
10
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11
# PURPOSE. See the above copyright notice for more information.
12
#
13
############################################################################
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
28
tag =
gdcm.Tag
(0x10,0x10)
29
de =
gdcm.DataElement
(tag)
30
31
# Search all patient name where string match 'F*'
32
de.SetByteValue(
'F*'
,
gdcm.VL
(2))
33
34
ds =
gdcm.DataSet
()
35
ds.Insert(de)
36
37
cnf =
gdcm.CompositeNetworkFunctions
()
38
theQuery = cnf.ConstructQuery (gdcm.ePatientRootType,gdcm.ePatient,ds)
39
40
#print theQuery.ValidateQuery()
41
42
# prepare the variable for output
43
ret = gdcm.DataSetArrayType()
44
45
# Execute the C-FIND query
46
cnf.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]
Generated on Sat Dec 21 2013 05:56:14 for GDCM by
1.8.5