try to add priors to ohif
This commit is contained in:
+21
-3
@@ -423,7 +423,7 @@ class Case(models.Model, AuthorMixin, QuestionMixin):
|
||||
examinations = [series.get_examination() for series in self.series.all()]
|
||||
return f"{self.pk}:{self.title} {'/'.join([str(c) for c in self.condition.all()])} [{', '.join(examinations)}]"
|
||||
|
||||
def get_case_dicom_json(self, case_title_as_patient_name=True):
|
||||
def get_case_dicom_json(self, case_title_as_patient_name=True, priors=None):
|
||||
series_json = []
|
||||
for series in self.series.all():
|
||||
series_json.append(series.get_series_dicom_json())
|
||||
@@ -432,7 +432,7 @@ class Case(models.Model, AuthorMixin, QuestionMixin):
|
||||
if case_title_as_patient_name:
|
||||
patient_name = self.title
|
||||
|
||||
return {
|
||||
studies_json = {
|
||||
"studies": [
|
||||
{
|
||||
"StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178",
|
||||
@@ -446,8 +446,26 @@ class Case(models.Model, AuthorMixin, QuestionMixin):
|
||||
"series": series_json,
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
pass
|
||||
|
||||
if priors is not None:
|
||||
for prior in priors:
|
||||
studies_json["studies"].append(
|
||||
{
|
||||
"StudyInstanceUID": "1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630177",
|
||||
"StudyDate": "20000101",
|
||||
"StudyTime": "",
|
||||
"PatientName": patient_name,
|
||||
"PatientID": "LIDC-IDRI-0001",
|
||||
"AccessionNumber": "",
|
||||
"PatientAge": "",
|
||||
"PatientSex": "",
|
||||
"series": prior.prior_case.get_series_dicom_json(),
|
||||
}
|
||||
)
|
||||
|
||||
return studies_json
|
||||
|
||||
def get_viva_details(self):
|
||||
return {
|
||||
|
||||
@@ -46,14 +46,14 @@
|
||||
|
||||
{% if collection.show_ohif_viewer %}
|
||||
<div>
|
||||
<iframe id="viewer" style="width: 100%; height: 100%; border: none; padding: 0px;" src="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}"></iframe>
|
||||
<iframe id="viewer" style="width: 100%; height: 100%; border: none; padding: 0px;" src="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:collection_case_dicom_json' collection.pk case.pk %}"></iframe>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if collection.show_ohif_viewer_link %}
|
||||
<div>
|
||||
<a target="_blank" href="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}">View case in OHIF</a>
|
||||
<a target="_blank" href="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:collection_case_dicom_json' collection.pk case.pk %}">View case in OHIF</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -121,6 +121,11 @@ urlpatterns = [
|
||||
views.collection_case_priors,
|
||||
name="collection_case_priors",
|
||||
),
|
||||
path(
|
||||
"collection/<int:exam_id>/case/<int:case_id>/dicom_json",
|
||||
views.collection_case_dicom_json,
|
||||
name="collection_case_dicom_json",
|
||||
),
|
||||
path(
|
||||
"collection/<int:exam_id>/question_schemas",
|
||||
views.collection_question_schemas,
|
||||
|
||||
@@ -2326,6 +2326,13 @@ def use_dates_as_descriptions(request, pk):
|
||||
|
||||
return HttpResponse("Done")
|
||||
|
||||
def collection_case_dicom_json(request, exam_id, case_id):
|
||||
case_detail = CaseDetail.objects.get(case=case_id, collection=exam_id)
|
||||
|
||||
priors = case_detail.caseprior_set.all()
|
||||
|
||||
return JsonResponse(case_detail.case.get_case_dicom_json(priors=priors))
|
||||
|
||||
|
||||
def case_dicom_json(request, pk):
|
||||
case = get_object_or_404(Case, pk=pk)
|
||||
|
||||
Reference in New Issue
Block a user