Retrieve medical images via DICOM-QR and DICOMweb
Project description
dicomtrolley
Retrieve medical images using DICOM WADO and MINT.
Requires python 3.7, 3.8 or 3.9
Represents images as pydicom
Datasets.
Usage
Basic example
session = log_in_to(https://server/login) # set up
trolley = Trolley(mint=Mint(session, https://server/mint),
wado=Wado(session, https://server/wado]))
studies = trolley.find_studies(
Query(patientName='B*') # find some studies
trolley.download_study( # download a study by uid
study_instance_uid=studies[0].uid,
output_dir='/tmp/trolley')
Finding studies
studies = trolley.find_studies( # simple find
Query(patientName='B*')
Query parameters can be found in mint.query.Query. Valid include fields (which information gets sent back) can be found in include_fields.py:
studies = trolley.find_studies(
Query(modalitiesInStudy='CT*',
patientSex="F",
minStudyDate=datetime(year=2015, month=3, day=1),
maxStudyDate=datetime(year=2020, month=3, day=1),
includeFields=['PatientBirthDate',
'SOPClassesInStudy']))
Finding series and instance details
To include series and instance level information as well, use the queryLevel
parameter
studies = trolley.find_studies( # find studies series and instances
Query(studyInstanceID='B*',
queryLevel=QueryLevels.INSTANCE)
a_series = studies.series[0] # studies now contain series
an_instance = a_series.instances[0] # and series contain instances
Downloading data
trolley.download_study( # simple download by uid
study_instance_uid='123',
output_dir='/tmp/trolley')
More control over download
studies = trolley.find_studies( # find study including instances
Query(PatientID='1234',
queryLevel=QueryLevels.INSTANCE)
instances = trolley.extract_instances(
studies.series[0]) # download only the first series
for instance in instances:
ds = trolley.get_dataset(instance)
ds.save_as(
f'/tmp/{ds.PatientID}') # this is a pydicom dataset
Caveats
Dicomtrolley has been developed for and tested on a Vitrea Connection 8.2.0.1 system. This claims to be consistent with WADO and MINT 1.2 interfaces, but does not implement all parts of these standards.
Certain query parameter values and restraints might be specific to Vitrea Connection 8.2.0.1. For example, the exact list of DICOM elements that can be returned from a query might be different for different servers.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dicomtrolley-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 564033b5a66de2f7516dd6fb53cb811f1e28b033d00099c325e751edecbcdc15 |
|
MD5 | 1a343211497ec1ec6d9ec53e505e61c7 |
|
BLAKE2b-256 | cdb558ed0e5f2c42ff17a98cc1e3f16960459211f5a45534a749f8ec614cb51e |