.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.6 on 2021-08-20 09:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('rapids', '0029_rapidimage_image_annotations'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='rapidimage',
|
||||
name='image_annotations',
|
||||
field=models.TextField(blank=True, help_text='Stores a JSON representation of annotations to be applied by cornerstonetools', null=True),
|
||||
),
|
||||
]
|
||||
+1
-1
@@ -388,7 +388,7 @@ class RapidImage(models.Model):
|
||||
image = models.FileField(upload_to=image_directory_path)
|
||||
|
||||
image_annotations = models.TextField(
|
||||
blank=True,
|
||||
blank=True, null=True,
|
||||
help_text="Stores a JSON representation of annotations to be applied by cornerstonetools",
|
||||
)
|
||||
|
||||
|
||||
@@ -89,15 +89,16 @@
|
||||
<summary>
|
||||
Image viewer
|
||||
</summary>
|
||||
<div id="single-dicom-viewer" class="dicom-viewer" data-images="{{ question.get_image_url_array }}" data-annotations='{{question.get_image_annotations}}'>
|
||||
<div id="single-dicom-viewer" class="dicom-viewer" data-images="{{ question.get_image_url_array }}"
|
||||
data-annotations='{{question.get_image_annotations}}'>
|
||||
</div>
|
||||
<button id="save-annotations">Save Annotations</button>
|
||||
</details>
|
||||
|
||||
<div class="pre-whitespace multi-image-block"><b>Image annotations:</b>
|
||||
<div class=""><b>Image annotations:</b>
|
||||
{% for image in question.images.all %}
|
||||
<span class="image-block">
|
||||
Image {{ forloop.counter }}: {{image.image_annotations}}
|
||||
Image {{ forloop.counter }}: {{image.image_annotations}}<br />
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
+6
-3
@@ -1160,10 +1160,13 @@ def question_save_annotation(request, pk):
|
||||
|
||||
question_images = question.images.all()
|
||||
|
||||
for n, annotation in enumerate(image_annotations):
|
||||
for n, image in enumerate(question_images):
|
||||
annotation = image_annotations[n]
|
||||
if annotation != "undefined":
|
||||
question_images[n].image_annotations = annotation
|
||||
question_images[n].save()
|
||||
image.image_annotations = annotation
|
||||
else:
|
||||
image.image_annotations = ""
|
||||
image.save()
|
||||
|
||||
data = {"status": "success"}
|
||||
return JsonResponse(data, status=200)
|
||||
|
||||
Reference in New Issue
Block a user