Retrieve medical images via WADO, MINT and DICOM-QR
Project description
dicomtrolley
Retrieve medical images via WADO, MINT and DICOM-QR.
Requires python 3.7, 3.8 or 3.9
Represents images as pydicom.Dataset
instances.
Usage
Basic example
# Create a logged-in http session
session = VitreaConnection(
"https://server/login").log_in(user,password,realm)
# Use this session to create a trolley using MINT and WADO
trolley = Trolley(searcher=Mint(session, "https://server/mint"),
wado=Wado(session, "https://server/wado"]))
# find some studies (using MINT)
studies = trolley.find_studies(MintQuery(patientName='B*'))
# download the fist one (using WADO)
trolley.download(studies[0], output_dir='/tmp/trolley')
Finding studies
studies = trolley.find_studies(MintQuery(patientName='B*'))
Query parameters can be found in dicomtrolley.query.Query. Valid include fields (which information gets sent back) can be found in include_fields.py:
studies = trolley.find_studies_mint(
MintQuery(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
MintQuery(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
Any study, series or instance can be downloaded
studies = trolley.find_studies(MintQuery(patientName='B*',
queryLevel=QueryLevels.INSTANCE))
path = '/tmp/trolley'
trolley.download(studies, path) # all studies
trolley.download(studies[0]), path # a single study
trolley.download(studies[0].series[0], path) # a single series
trolley.download(studies[0].series[0].instances[:3], path) # first 3 instances
More control over download: obtain pydicom.Dataset
instances directly
studies = trolley.find_studies( # find study including instances
Query(PatientID='1234',
queryLevel=QueryLevels.INSTANCE)
for ds in trolley.get_dataset(studies): # obtain Dataset for each instance
ds.save_as(f'/tmp/{ds.SOPInstanceUID}.dcm')
DICOM-QR
Trolley
can use DICOM-QR instead of MINT as a search method
dicom_qr = DICOMQR(host,port,aet,aec)
trolley = Trolley(searcher=dicom_qr, wado=wado)
# Finding is similar to MINT, but a DICOMQuery is used instead
trolley.find_studies(
query=DICOMQuery(PatientName="BAL*",
minStudyDate=datetime(year=2015, month=3, day=1),
maxStudyDate=datetime(year=2015, month=4, day=1),
includeFields=["PatientBirthDate", "SOPClassesInStudy"],
QueryRetrieveLevel=QueryRetrieveLevels.STUDY))
Examples
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
File details
Details for the file dicomtrolley-0.5.1.tar.gz
.
File metadata
- Download URL: dicomtrolley-0.5.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.10 Linux/5.4.0-1043-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 490cf46e5c12c717ec7dcb66d16e6e7e81d1f808d85e460e73265f525d844800 |
|
MD5 | d0517b94e11547f8894582342bb5e9a7 |
|
BLAKE2b-256 | db40bd92ad95fd3236d7567c0d5a57c355bae36d80e08ac7f9f0af8546e19ad2 |
File details
Details for the file dicomtrolley-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: dicomtrolley-0.5.1-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.10 Linux/5.4.0-1043-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f698938f9122834e52d98bdac39487c50f2df1b533c78df1d53aaaf0b7f0e185 |
|
MD5 | dd60847328855dda11ffbb91cf3ea12f |
|
BLAKE2b-256 | 88c557d303e8ee284c17589c01435fa4009a0442366044a13e6110a9486218ee |