Skip to content

Commit 76e85da

Browse files
committed
populator: instances_count is now applied in each series and not only MR & CT series
1 parent 4d948e2 commit 76e85da

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

Diff for: orthanc_tools/orthanc_test_db_populator.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self,
3636
api_client: OrthancApiClient,
3737
studies_count: int,
3838
series_count: int = None, # to force the number of series in a study
39-
instances_count: int = None, # to force the number of instances in a study
39+
instances_count: int = None, # to force the number of instances in each series
4040
random_seed: int = None, # to make the generation repeatable
4141
from_study_date: datetime.date = datetime.date(2000, 1, 1), # StudyDate for generated studies
4242
to_study_date: datetime.date = datetime.date(2022, 4, 21), # StudyDate for generated studies
@@ -172,6 +172,12 @@ def _generate_study_thread(self, thread_id):
172172
for series_counter in range(0, series_count):
173173
tags = self.generate_series_tags(tags, series_counter, study_counter)
174174

175+
# force MR or CT series if the instances_count is forced at large values
176+
if self._instances_count is not None and self._instances_count > 1:
177+
tags["Modality"] = random.choice(["MR", "CT"])
178+
elif self._instances_count is not None and self._instances_count == 1:
179+
tags["Modality"] = random.choice(["CR", "DX"])
180+
175181
if tags["Modality"] in ["MR", "CT"]:
176182
if self._instances_count is not None:
177183
instances_count = self._instances_count

Diff for: release-notes.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v 0.15.1
2+
========
3+
- `OrthancTestDbPopulator`: `instances_count` is now applied to every generated series
4+
and not only MR & CT series.
5+
16
v 0.15.0
27
========
38
- Added `Hl7FolderMonitor` which allows to read HL7 messages from a folder.

Diff for: setup.py

+1-1
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.15.0', # Required
31+
version='0.15.1', # Required
3232

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

Diff for: tests/test_3_orthancs.py

+8
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ def test_populator_repeatability_with_forced_quantities(self):
146146
self.assertEqual(a_ids, b_ids)
147147
self.assertEqual(len(a_ids), 2)
148148

149+
def test_populator_quantities(self):
150+
self.oa.delete_all_content()
151+
152+
populator_a = OrthancTestDbPopulator(api_client=self.oa, studies_count=2, series_count=2, instances_count=10, random_seed=42)
153+
populator_a.execute()
154+
155+
self.assertEqual(40, len(self.oa.instances.get_all_ids()))
156+
149157

150158
def test_monitor_recovery(self):
151159
with tempfile.TemporaryDirectory() as temp_dir:

0 commit comments

Comments
 (0)