diff --git a/atlas/models.py b/atlas/models.py index 2d0ef81e..7d72474f 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -821,6 +821,39 @@ class CaseCollection(ExamOrCollectionGenericBase): kwargs={"pk": self.pk, "case_number": cases.index(case)}, ) + def get_ohif_dicom_json(self, case_title_as_patient_name = True): + studies = [] + for n, case in enumerate(self.cases.all()): + series_json = [] + for series in case.series.all(): + series_json.append(series.get_series_dicom_json()) + + patient_name = "" + if case_title_as_patient_name: + patient_name = case.title + + studies.append( + + { + "StudyInstanceUID": f"1.3.6.1.4.1.14519.5.2.1.6279.6001.{n}", + "StudyDate": "20000101", + "StudyTime": "", + "PatientName": patient_name, + "PatientID": f"ID{n}", + "AccessionNumber": "", + "PatientAge": "", + "PatientSex": "", + "series": series_json, + } + ) + + + + return { + "studies": studies + } + + class CaseDetail(models.Model): case = models.ForeignKey(Case, on_delete=models.CASCADE) diff --git a/atlas/templates/atlas/collection_viva.html b/atlas/templates/atlas/collection_viva.html index 6bcf849f..23eec14d 100644 --- a/atlas/templates/atlas/collection_viva.html +++ b/atlas/templates/atlas/collection_viva.html @@ -7,6 +7,7 @@
Click on the 'Show' button to view the case in the viewer. Click on the 'Open' button to open the case in a new window.
Opening a second case will replace the first case in the viewer or window.
+