diff --git a/atlas/models.py b/atlas/models.py
index 2980104c..2bd8a2a1 100644
--- a/atlas/models.py
+++ b/atlas/models.py
@@ -1152,6 +1152,11 @@ class CaseDisplaySet(models.Model, AuthorMixin):
structures = models.ManyToManyField(Structure, blank=True)
conditions = models.ManyToManyField(Condition, blank=True)
+ def viewerstate_string(self):
+ return json.dumps(self.viewerstate) if self.viewerstate else "{}"
+
+ def annotations_string(self):
+ return json.dumps(self.annotations) if self.annotations else "{}"
class CaseDetail(models.Model):
diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html
index e6799162..70b0c50b 100755
--- a/atlas/templates/atlas/case_display_block.html
+++ b/atlas/templates/atlas/case_display_block.html
@@ -11,6 +11,7 @@
@@ -238,56 +239,51 @@
{% endif %}
-
Series Findings
- {% if case.series.all %}
- {% for series in case.get_ordered_series %}
- {% for finding in series.findings.all %}
-
-
-
-
-
-
-
- {% if finding.findings.all %}
-
- Findings: {% for f in finding.findings.all %}
- {{f.get_link}},
- {% endfor %}
-
- {% endif %}
- {% if finding.conditions.all %}
-
- Conditions: {% for c in finding.conditions.all %}
- {{c.get_link}},
- {% endfor %}
-
- {% endif %}
- {% if finding.structures.all %}
-
- Structure: {% for s in finding.structures.all %}
- {{s.get_link}},
- {% endfor %}
-
- {% endif %}
- {% if finding.description %}
-
- Description: {{finding.description}}
-
- {% endif %}
-
- {% endfor %}
- {% endfor %}
- {% else %}
- No series associated with case.
- {% endif %}
+Series Findings
+{% if case.ordered_series %}
+ {% for series in case.ordered_series %}
+ {% for finding in series.findings.all %}
+
+
+
+
+
+
+
+ {% if finding.findings %}
+
+ Findings: {% for f in finding.findings.all %}
+ {{f.get_link}},
+ {% endfor %}
+
+ {% endif %}
+ {% if finding.conditions %}
+
+ Conditions: {% for c in finding.conditions.all %}
+ {{c.get_link}},
+ {% endfor %}
+
+ {% endif %}
+ {% if finding.structures %}
+
+ Structure: {% for s in finding.structures.all %}
+ {{s.get_link}},
+ {% endfor %}
+
+ {% endif %}
+ {% if finding.description %}
+
+ Description: {{finding.description}}
+
+ {% endif %}
+
+ {% endfor %}
+ {% endfor %}
+{% else %}
+ No series associated with case.
+{% endif %}
Case Display Sets
diff --git a/atlas/templates/atlas/case_displaysets.html b/atlas/templates/atlas/case_displaysets.html
index 62befea0..e36e6392 100755
--- a/atlas/templates/atlas/case_displaysets.html
+++ b/atlas/templates/atlas/case_displaysets.html
@@ -58,7 +58,8 @@
var form = evt.target;
console.log("Form:", form);
console.log("Form matches:", form.matches("form[hx-post*='{% url 'atlas:case_displaysets_add' case.pk %}']"));
- if (form && form.matches("form[hx-post*='{% url 'atlas:case_displaysets_add' case.pk %}']")) {
+ console.log("Form matches:", form.matches("form[hx-post*='display_sets/edit']"));
+ if (form && (form.matches("form[hx-post*='{% url 'atlas:case_displaysets_add' case.pk %}']") ||form.matches("form[hx-post*='display_sets/edit']" ))) {
// Set hidden fields from JS functions
var viewerState = window.exportViewerState_main_viewer ? window.exportViewerState_main_viewer() : "{}";
var annotations = window.exportAnnotations_main_viewer ? window.exportAnnotations_main_viewer() : "{}";
diff --git a/atlas/templates/atlas/collection_viva.html b/atlas/templates/atlas/collection_viva.html
index f53b0f5f..1f14a80e 100644
--- a/atlas/templates/atlas/collection_viva.html
+++ b/atlas/templates/atlas/collection_viva.html
@@ -62,6 +62,34 @@
{% endfor %}
+ {% if case.display_sets.all %}
+ Display Sets:
+ {% for ds in case.display_sets.all %}
+
+
+ {{ ds.name }}
+ {% if ds.description %}
+ ({{ ds.description }})
+ {% endif %}
+
+
+
+ {% empty %}
+ No display sets for this case.
+ {% endfor %}
+
+ {% endif %}
@@ -162,10 +190,31 @@
$("#current-case-discussion").html("Discussion: "+case_details['discussion']);
$("#current-case-report").html("Report: "+case_details['report']);
- bc.postMessage({"type": "open",
- "case" : c.dataset.case, "images": c.dataset.images,
+ bc.postMessage({"type": "open",
+ "case" : c.dataset.case, "images": c.dataset.images,
"viewerstate": viewerstate
+ });
+
});
+ $('.open-displayset').click(function() {
+ let c = this;
+ console.log('clicked local', c)
+ console.log('open local', c.dataset.case)
+ case_details = JSON.parse(c.dataset.casejson);
+ let viewerstate = JSON.parse(c.dataset.viewerstate) || {};
+ let annotations = JSON.parse(c.dataset.annotations) || {};
+ $('#loading-case').show()
+ $("#open-viewer-local").addClass("flash-button");
+ $('#current-case-title').html("Case: "+c.dataset.title);
+ $("#current-case-history").html("History: "+case_details['history']);
+ $("#current-case-discussion").html("Discussion: "+case_details['discussion']);
+ $("#current-case-report").html("Report: "+case_details['report']);
+
+ bc.postMessage({"type": "open",
+ "case" : c.dataset.case, "images": c.dataset.images,
+ "viewerstate": viewerstate,
+ "annotations": annotations
+ });
});
$('.open-series-local').click(function() {
diff --git a/atlas/templates/atlas/linked_cases_overview.html b/atlas/templates/atlas/linked_cases_overview.html
index 32bf2b16..c23ef414 100644
--- a/atlas/templates/atlas/linked_cases_overview.html
+++ b/atlas/templates/atlas/linked_cases_overview.html
@@ -16,7 +16,7 @@
{{ case.title }}
- {% partial case-series %}
+ {% include "atlas/case_display_block.html#case-series" %}
{% endfor %}
{% else %}
diff --git a/atlas/templates/atlas/viewer_local.html b/atlas/templates/atlas/viewer_local.html
index a632cb87..866c794d 100644
--- a/atlas/templates/atlas/viewer_local.html
+++ b/atlas/templates/atlas/viewer_local.html
@@ -40,11 +40,8 @@
console.log(event);
if (event.data.type == "open") {
document.getElementById("awating-load").style.display = "none";
- console.log("open, images: ", event.data.images);
document.getElementById("root").dataset.images = event.data.images;
- console.log("viewerstate: ", event.data.viewerstate);
- console.log(event.data.viewerstate == {});
if (
event.data.viewerstate &&
Object.keys(event.data.viewerstate).length > 0
@@ -53,6 +50,15 @@
} else {
delete document.getElementById("root").dataset.viewerstate;
}
+ console.log("Annotations:", event.data.annotations);
+ if (
+ event.data.annotations &&
+ Object.keys(event.data.annotations).length > 0
+ ) {
+ document.getElementById("root").dataset.annotationjson = event.data.annotations;
+ } else {
+ delete document.getElementById("root").dataset.annotationjson;
+ }
window.mountDicomViewers();
bc.postMessage({"type": "open-complete-local"});
diff --git a/atlas/views.py b/atlas/views.py
index a85fba12..1c19b5cb 100755
--- a/atlas/views.py
+++ b/atlas/views.py
@@ -313,15 +313,13 @@ def case_detail(request, pk):
"series",
queryset=Series.objects.select_related("modality", "examination", "plane", "contrast")
.prefetch_related(
- Prefetch("images", queryset=SeriesImage.objects.filter(removed=False).order_by("position")),
Prefetch(
"findings",
queryset=SeriesFinding.objects.prefetch_related(
- Prefetch("findings", queryset=Finding.objects.all()),
- Prefetch("conditions", queryset=Condition.objects.all()),
- Prefetch("structures", queryset=Structure.objects.all()),
+ "findings", "conditions", "structures"
)
),
+ Prefetch("images", queryset=SeriesImage.objects.filter(removed=False).order_by("position")),
)
),
),
@@ -340,6 +338,7 @@ def case_detail(request, pk):
)
.get(pk=pk)
)
+ case.ordered_series = [sd.series for sd in case.seriesdetail_set.all()]
can_edit = case.check_user_can_edit(request.user)
return render(