.
This commit is contained in:
@@ -821,6 +821,39 @@ class CaseCollection(ExamOrCollectionGenericBase):
|
|||||||
kwargs={"pk": self.pk, "case_number": cases.index(case)},
|
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):
|
class CaseDetail(models.Model):
|
||||||
case = models.ForeignKey(Case, on_delete=models.CASCADE)
|
case = models.ForeignKey(Case, on_delete=models.CASCADE)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
<p>Opening a second case will replace the first case in the viewer or window.</p>
|
<p>Opening a second case will replace the first case in the viewer or window.</p>
|
||||||
</details>
|
</details>
|
||||||
|
<button class="show-collection no-padding" data-title="{{case.title}}" data-target="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:collection_dicom_json' collection.pk %}">Show Collection</button>
|
||||||
|
|
||||||
<ol id="" class="sortable">
|
<ol id="" class="sortable">
|
||||||
{% for case in cases %}
|
{% for case in cases %}
|
||||||
@@ -55,6 +56,12 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
const bc = new BroadcastChannel("test_channel");
|
const bc = new BroadcastChannel("test_channel");
|
||||||
console.log('ready')
|
console.log('ready')
|
||||||
|
$('.show-collection').click(function() {
|
||||||
|
var url = $(this).data('target');
|
||||||
|
console.log('clicked', url)
|
||||||
|
$('#case-title').text($(this).data('title'));
|
||||||
|
$('#viewer').attr('src', url)
|
||||||
|
});
|
||||||
$('.show-case').click(function() {
|
$('.show-case').click(function() {
|
||||||
var url = $(this).data('target');
|
var url = $(this).data('target');
|
||||||
console.log('clicked', url)
|
console.log('clicked', url)
|
||||||
|
|||||||
@@ -144,6 +144,11 @@ urlpatterns = [
|
|||||||
views.GenericExamViews.exam_json_edit,
|
views.GenericExamViews.exam_json_edit,
|
||||||
name="exam_json_edit",
|
name="exam_json_edit",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"collection/<int:pk>/dicom_json",
|
||||||
|
views.collection_dicom_json,
|
||||||
|
name="collection_dicom_json",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"case/<int:pk>/dicom_json",
|
"case/<int:pk>/dicom_json",
|
||||||
views.case_dicom_json,
|
views.case_dicom_json,
|
||||||
|
|||||||
@@ -1827,6 +1827,10 @@ def collection_case_view(request, pk, case_number):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def collection_dicom_json(request, pk):
|
||||||
|
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||||
|
|
||||||
|
return JsonResponse(collection.get_case_dicom_json())
|
||||||
|
|
||||||
def case_dicom_json(request, pk):
|
def case_dicom_json(request, pk):
|
||||||
case = get_object_or_404(Case, pk=pk)
|
case = get_object_or_404(Case, pk=pk)
|
||||||
|
|||||||
Reference in New Issue
Block a user