    
        
    <span class="image-block">
        Image {{ forloop.counter }}{% if image.description %} ({{image.description}}){% endif %}{% if image.feedback_image %} [feedback image]{% endif %}:
        <div class="dicom-image shorts-img {% if image.feedback_image %}feedback-img{% endif %}"
                data-url="{{ remote_url }}{{ image.image.url}}"></div>
    </span>

    <script>
        document.body.addEventListener("htmx:afterSwap", function(evt) {
            const dataUrl = "{{ remote_url }}{{ image.image.url}}";
            console.log(dataUrl);
            const dicomDiv = document.querySelector('.dicom-image[data-url="' + dataUrl + '"]');
            console.log(dicomDiv);
            if (dicomDiv) {
                setUpDicom(dicomDiv);
            }
        });
    </script>