allow basic thumbnail recreation
This commit is contained in:
@@ -4,5 +4,9 @@
|
||||
<div id="single-dicom-viewer" class="dicom-viewer" data-images=["{{ image.image.url }}"] data-annotations=''>
|
||||
</div>
|
||||
{{image.get_dicom_info|safe}}
|
||||
<div>
|
||||
<a href="{{ image.image.url }}" download>Download DICOM Image</a>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -241,6 +241,7 @@ urlpatterns = [
|
||||
name="structure_update",
|
||||
),
|
||||
path("structure/create", views.StructureCreate.as_view(), name="structure_create"),
|
||||
path("series/<int:pk>/thumbnail", views.series_thumbnail, name="series_thumbnail"),
|
||||
path("series/<int:pk>", views.series_detail, name="series_detail"),
|
||||
path("series/<int:pk>/authors", views.SeriesAuthorUpdate.as_view(), name="series_authors"),
|
||||
path("series/", views.SeriesView.as_view(), name="series_view"),
|
||||
|
||||
@@ -184,6 +184,15 @@ def case_detail(request, pk):
|
||||
# logging.debug(atlas.subspecialty.first().name.all())
|
||||
return render(request, "atlas/case_detail.html", {"case": case})
|
||||
|
||||
@login_required
|
||||
@user_is_author_or_atlas_series_checker_or_atlas_marker
|
||||
def series_thumbnail(request, pk, finding_pk=None):
|
||||
series = get_object_or_404(Series, pk=pk)
|
||||
|
||||
thumbnail, _ = series.get_thumbnail(recreate=True)
|
||||
|
||||
return HttpResponse(thumbnail)
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_author_or_atlas_series_checker_or_atlas_marker
|
||||
|
||||
+3
-1
@@ -404,7 +404,7 @@ class SeriesBase(models.Model):
|
||||
else:
|
||||
return format_html('", "'.join(images))
|
||||
|
||||
def get_thumbnail(self):
|
||||
def get_thumbnail(self, recreate=False):
|
||||
images = self.images.filter(removed=False)
|
||||
|
||||
if len(images) < 1:
|
||||
@@ -413,6 +413,8 @@ class SeriesBase(models.Model):
|
||||
img = findMiddle(images).image
|
||||
try:
|
||||
thumbnailer = get_thumbnailer(img)
|
||||
if recreate:
|
||||
thumbnailer.delete_thumbnails()
|
||||
thumbnail = thumbnailer["exam-list"]
|
||||
except InvalidImageFormatError:
|
||||
return format_html(
|
||||
|
||||
Reference in New Issue
Block a user