Skip to content

Commit 38ce76d

Browse files
committed
new 'endpoint' arg to upload_files_dicom_web
1 parent 1ba92b2 commit 38ce76d

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

orthanc_api_client/api_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ def upload_folder_return_details(self, folder_path: str, unzip_before_upload: bo
244244

245245
return dicom_ids_set, orthanc_ids_set, rejected_files_list
246246

247-
def upload_files_dicom_web(self, paths: List[str], ignore_errors: bool = False) -> any:
248-
"""Uploads a file to Orthanc through its DicomWeb API (only DICOM files, no zip files)
247+
def upload_files_dicom_web(self, paths: List[str], ignore_errors: bool = False, endpoint: str = "dicom-web/studies") -> any:
248+
"""Uploads files to Orthanc through its DicomWeb API (only DICOM files, no zip files)
249249
250250
Parameters
251251
----------
@@ -262,7 +262,7 @@ def upload_files_dicom_web(self, paths: List[str], ignore_errors: bool = False)
262262
counter += 1
263263

264264
body, content_type = encode_multipart_related(fields=files)
265-
r = self.post(endpoint="dicom-web/studies",
265+
r = self.post(endpoint=endpoint,
266266
data=body,
267267
headers = {
268268
'Accept':'application/json',

release-notes.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
1+
v 0.18.5
2+
========
3+
4+
- New `endpoint` argument to `upload_files_dicom_web` method.
25
- #7: fix wrong exception handling
36

47
v 0.18.4

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# For a discussion on single-sourcing the version across setup.py and the
2929
# project code, see
3030
# https://packaging.python.org/guides/single-sourcing-package-version/
31-
version='0.18.4', # Required
31+
version='0.18.5', # Required
3232

3333
# This is a one-line description or tagline of what your project does. This
3434
# corresponds to the "Summary" metadata field:

tests/test_api_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,18 @@ def test_upload_folder_return_details_error_case(self):
259259

260260
def test_upload_file_dicom_web(self):
261261
self.oa.delete_all_content()
262-
263262
self.oa.upload_files_dicom_web([here / "stimuli/CT_small.dcm"])
263+
self.assertEqual(1, len(self.oa.studies.get_all_ids()))
264+
265+
266+
def test_upload_file_dicom_web_study_level(self):
267+
self.oa.delete_all_content()
268+
269+
self.oa.upload_files_dicom_web([here / "stimuli/MR/Brain/1/IM0"])
270+
self.oa.upload_files_dicom_web([here / "stimuli/MR/Brain/1/IM1"], endpoint="dicom-web/studies/2.16.840.1.113669.632.20.1211.10000357775")
264271

265272
self.assertEqual(1, len(self.oa.studies.get_all_ids()))
273+
self.assertEqual(2, len(self.oa.instances.get_all_ids()))
266274

267275

268276
def test_generate_and_upload_test_file_find_study(self):

0 commit comments

Comments
 (0)