Created
February 22, 2018 14:45
-
-
Save pasknel/23228327641e6fcdf1d2fb7279b0a0cc to your computer and use it in GitHub Desktop.
C-FIND request example with pynetdicom3 and pydicom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynetdicom3 import AE | |
from pydicom.dataset import Dataset | |
from pynetdicom3 import QueryRetrieveSOPClassList | |
ae = AE(scu_sop_class = QueryRetrieveSOPClassList) | |
ip = "IP ADDRESS HERE" | |
port = 104 | |
association = ae.associate(ip, port) | |
if association.is_established: | |
print('[+] Association established!') | |
dataset = Dataset() | |
dataset.PatientName = '*' | |
dataset.PatientID = '' | |
dataset.PatientSex = '' | |
dataset.PatientBirthDate = '' | |
dataset.StudyDescription = '' | |
dataset.QueryRetrieveLevel = "PATIENT" | |
results = association.send_c_find(dataset, query_model='P') | |
for (status, dataset) in results: | |
if status.status_type == 'Pending': | |
print(dataset) | |
print('') | |
association.release() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment