some more ui for bulk uploads
This commit is contained in:
+5
-2
@@ -74,7 +74,7 @@ def uncategorised_dicoms(request):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
@router.get("/import_dicoms", auth=django_auth)
|
@router.get("/import_dicoms", auth=django_auth, response=List[SeriesSchema])
|
||||||
def import_dicoms(request):
|
def import_dicoms(request):
|
||||||
dicoms = UncategorisedDicom.objects.filter(user=request.user)
|
dicoms = UncategorisedDicom.objects.filter(user=request.user)
|
||||||
|
|
||||||
@@ -84,6 +84,7 @@ def import_dicoms(request):
|
|||||||
|
|
||||||
data[tags["SeriesInstanceUID"]].append((d, tags))
|
data[tags["SeriesInstanceUID"]].append((d, tags))
|
||||||
|
|
||||||
|
series_list = []
|
||||||
for series_uid in data:
|
for series_uid in data:
|
||||||
|
|
||||||
modality = get_object_or_404(Modality, short_code=tags["Modality"])
|
modality = get_object_or_404(Modality, short_code=tags["Modality"])
|
||||||
@@ -106,10 +107,12 @@ def import_dicoms(request):
|
|||||||
for dicom, dicom_tags in data[series_uid]:
|
for dicom, dicom_tags in data[series_uid]:
|
||||||
series_image = SeriesImage(image=dicom.image, series=series)
|
series_image = SeriesImage(image=dicom.image, series=series)
|
||||||
series_image.save()
|
series_image.save()
|
||||||
|
dicom.image.delete()
|
||||||
|
|
||||||
dicom.delete()
|
dicom.delete()
|
||||||
|
series_list.append(series)
|
||||||
|
|
||||||
return {}
|
return series_list
|
||||||
|
|
||||||
@router.get("/orphan_series", auth=django_auth, response=List[SeriesSchema])
|
@router.get("/orphan_series", auth=django_auth, response=List[SeriesSchema])
|
||||||
def orphan_series(request):
|
def orphan_series(request):
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Atlas</h2>
|
<h2>Atlas</h2>
|
||||||
|
|
||||||
<a href="{% url 'atlas:user_collections' %}">Available collections</a>
|
<a href="{% url 'atlas:user_collections' %}">Available collections</a><br/>
|
||||||
|
<a href="{% url 'atlas:user_uploads' %}">My uploads</a>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{% extends 'atlas/base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h2>Uploaded dicoms</h2>
|
||||||
|
|
||||||
|
|
||||||
|
{% if dicoms %}
|
||||||
|
<ul>
|
||||||
|
{% for dicom in dicoms %}
|
||||||
|
<li>
|
||||||
|
{{dicom.image}} {{dicom.get_basic_dicom_tags}}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<button
|
||||||
|
hx-get="{% url 'api-1:clear_dicoms' %}"
|
||||||
|
hx-confirm="This will clear all uploads that have not been imported into series, Continue?"
|
||||||
|
>Delete Uploads</button>
|
||||||
|
<button
|
||||||
|
hx-get="{% url 'api-1:import_dicoms' %}"
|
||||||
|
hx-target=".imported"
|
||||||
|
|
||||||
|
>Import</button>
|
||||||
|
|
||||||
|
<div class="imported">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
No uploads awaiting importing have been found.
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p><a href="{% url 'atlas:series_view' %}?case=null">View orphan series</a></p>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -34,6 +34,7 @@ urlpatterns = [
|
|||||||
path("case/", views.CaseView.as_view(), name="case_view"),
|
path("case/", views.CaseView.as_view(), name="case_view"),
|
||||||
path("collection/", views.CollectionView.as_view(), name="collection_view"),
|
path("collection/", views.CollectionView.as_view(), name="collection_view"),
|
||||||
path("collection/user", views.user_collections, name="user_collections"),
|
path("collection/user", views.user_collections, name="user_collections"),
|
||||||
|
path("uploads", views.user_uploads, name="user_uploads"),
|
||||||
path(
|
path(
|
||||||
"collection/create",
|
"collection/create",
|
||||||
views.CaseCollectionCreate.as_view(),
|
views.CaseCollectionCreate.as_view(),
|
||||||
|
|||||||
@@ -299,6 +299,11 @@ def user_collections(request):
|
|||||||
|
|
||||||
return render(request, "atlas/user_collections.html", {"collections": collections})
|
return render(request, "atlas/user_collections.html", {"collections": collections})
|
||||||
|
|
||||||
|
def user_uploads(request):
|
||||||
|
dicoms = UncategorisedDicom.objects.filter(user=request.user)
|
||||||
|
|
||||||
|
return render(request, "atlas/user_uploads.html", {"dicoms": dicoms})
|
||||||
|
|
||||||
class CaseDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
class CaseDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
||||||
model = Case
|
model = Case
|
||||||
success_url = reverse_lazy("atlas:case_view")
|
success_url = reverse_lazy("atlas:case_view")
|
||||||
|
|||||||
Reference in New Issue
Block a user