add option to order series
This commit is contained in:
@@ -120,6 +120,12 @@ def import_dicoms_helper(request, case_id: int | None = None):
|
||||
else:
|
||||
dicoms = UncategorisedDicom.objects.filter(user=request.user)
|
||||
|
||||
|
||||
if "order-series" in request.POST:
|
||||
order = request.POST["order-series"]
|
||||
else:
|
||||
order = None
|
||||
|
||||
data = defaultdict(list)
|
||||
for d in dicoms:
|
||||
tags = d.basic_dicom_tags
|
||||
@@ -151,6 +157,15 @@ def import_dicoms_helper(request, case_id: int | None = None):
|
||||
|
||||
series.save()
|
||||
|
||||
|
||||
match order:
|
||||
case "order-series-instance-number":
|
||||
series.order_by_dicom("InstanceNumber")
|
||||
case "order-series-slice-location":
|
||||
series.order_by_dicom("SliceLocation")
|
||||
case _:
|
||||
pass
|
||||
|
||||
# We might only want to add the author during creation....
|
||||
series.author.add(request.user)
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
{% for series, n, tags, date in series_list %}
|
||||
<li>
|
||||
<span _="
|
||||
on click toggle .selected on me
|
||||
then set i to the first <input/> in me
|
||||
then set i.checked to not i.checked" >
|
||||
{{date}}: {{series}} [{{n}} images] <br/>
|
||||
{{tags}}
|
||||
<input class="hidden" type="checkbox" name="selection" value="{{ series }}">
|
||||
</span>
|
||||
on click toggle .selected on me
|
||||
then set i to the first <input/> in me
|
||||
then set i.checked to not i.checked" >
|
||||
{{date}}: {{series}} [{{n}} images] <br/>
|
||||
{{tags}}
|
||||
<input class="hidden" type="checkbox" name="selection" value="{{ series }}">
|
||||
</span>
|
||||
<span class="series-block-popup-link">
|
||||
<a href="#"
|
||||
onclick="return window.create_popup_window('/atlas/uploads/series_id/{{series}}', 'Series')">Popup</a>
|
||||
@@ -35,6 +35,30 @@
|
||||
{% if case %}
|
||||
<p>Importing into case {{case}}</p>
|
||||
{% endif %}
|
||||
<details><summary>Upload settings</summary>
|
||||
<form>
|
||||
<div>
|
||||
<fieldset><legend>Select how series should be ordered when uploaded</legend>
|
||||
<div class="helptext">
|
||||
This will affect how series are displayed when viewing with the built in site viewer. By default when exporting from Insight the order is not maintained so you should choose to order eithre by slice location or instance number.<br/>
|
||||
If you are not sure, leave this as the default.
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" id="order-series-slice-location" value="order-series-slice-location" name="order-series" checked>
|
||||
<label for="order-series-slice-location">Order series by slice location</label><br/>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" id="order-series-instance-number" value="order-series-instance-number" name="order-series" >
|
||||
<label for="order-series-instance-number">Order series by instance number</label><br/>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" id="order-series-none" value="order-series-none" name="order-series" >
|
||||
<label for="order-series-none">None</label><br/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
|
||||
<button id="delete-uploads-button"
|
||||
hx-post="{% url 'api-1:clear_dicoms' %}"
|
||||
@@ -53,7 +77,7 @@
|
||||
<button id="import-dicoms-button"
|
||||
hx-post="{% url 'api-1:import_dicoms' %}"
|
||||
hx-target=".imported"
|
||||
hx-include=".selected"
|
||||
hx-include=".selected,[name='order-series']"
|
||||
>Import</button>
|
||||
{% endif %}
|
||||
|
||||
@@ -62,6 +86,7 @@
|
||||
</div>
|
||||
{% else %}
|
||||
No uploads awaiting importing have been found.
|
||||
|
||||
{% endif %}
|
||||
|
||||
<p><a href="{% url 'atlas:series_view' %}?case=null&sort=-modified_date">View orphan series</a></p>
|
||||
|
||||
Reference in New Issue
Block a user