Skip to content

Commit 3d31d4b

Browse files
committed
Removes WadoRS base for WadoRSMetaData. They have too little in common
1 parent 2f66982 commit 3d31d4b

1 file changed

Lines changed: 37 additions & 27 deletions

File tree

dicomtrolley/wado_rs.py

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,6 @@
88
[DICOM part18 section 10.4]
99
(https://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_10.4.html)
1010
11-
Notes
12-
-----
13-
Models only the parts of WADO-RS directly related to downloading DICOM image data.
14-
WADO-RS also supports downloading metadata and rendered images, but these are
15-
outside the scope of the dicomtrolley project.
16-
17-
Specifically, from DICOM PS3.18 section 10.4
18-
19-
Download supported by dicomtrolley:
20-
21-
* Instance resources (download all instances)
22-
23-
Download Not Supported by dicomtrolley:
24-
25-
* Metadata resources
26-
27-
* Rendered resources
28-
29-
* Thumbnail resources
30-
31-
* Bulkdata resources
32-
33-
* Pixel Data resources
34-
3511
"""
3612
import json
3713
from itertools import chain
@@ -58,7 +34,7 @@
5834

5935

6036
class WadoRS(Downloader):
61-
"""A connection to a WADO-RS server"""
37+
"""A connection to a WADO-RS endpoints for downloading full datasets"""
6238

6339
def __init__(
6440
self, session, url, http_chunk_size=5242880, request_per_series=True
@@ -231,8 +207,42 @@ def wado_rs_instance_uri(self, reference: DICOMObjectReference):
231207
)
232208

233209

234-
class WadoRSMetaData(WadoRS):
235-
"""A WADO-RS /metadata Downloader that downloads only metadata, no PixelData"""
210+
class WadoRSMetaData(Downloader):
211+
"""A connection to WADO-RS to download only metadata, no PixelData"""
212+
213+
def __init__(self, session, url):
214+
"""
215+
Parameters
216+
----------
217+
session: requests.session
218+
A logged-in session over which WADO calls can be made
219+
url: str
220+
WADO-RS endpoint, including protocol and port. Like
221+
https://server:8080/wado
222+
"""
223+
224+
self.session = session
225+
self.url = url
226+
227+
def datasets(self, objects: Sequence[DICOMDownloadable]):
228+
"""Retrieve each instance
229+
230+
Returns
231+
-------
232+
Iterator[Dataset, None, None]
233+
234+
Raises
235+
------
236+
DICOMTrolleyError
237+
If getting does not work for some reason
238+
"""
239+
logger.debug("Getting datasets")
240+
if isinstance(objects, DICOMDownloadable):
241+
objects = [objects] # handle passing single object instead of list
242+
243+
return chain.from_iterable(
244+
self.download_iterator(obj) for obj in objects
245+
)
236246

237247
def wado_rs_instance_uri(self, reference: DICOMObjectReference):
238248
"""WADO-RS URI to request all instances contained in referenced object"""

0 commit comments

Comments
 (0)