From fa613ae1165652dcf70c6cc391ecb4bde13839de Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 22 Apr 2024 15:17:31 +0100 Subject: [PATCH] improve uploading --- anatomy/static/js/upload_form_helpers.js | 2 +- atlas/api.py | 2 - atlas/models.py | 1 - atlas/templates/atlas/help.html | 2 + atlas/templates/atlas/new_uploads.html | 224 +++++++++++++++++++++-- atlas/templates/atlas/user_uploads.html | 1 + rad/static/css/anatomy.css | 145 ++++++++++++++- 7 files changed, 356 insertions(+), 21 deletions(-) diff --git a/anatomy/static/js/upload_form_helpers.js b/anatomy/static/js/upload_form_helpers.js index f5c04474..4e74615e 100644 --- a/anatomy/static/js/upload_form_helpers.js +++ b/anatomy/static/js/upload_form_helpers.js @@ -108,7 +108,7 @@ uploading_el = $(`img[data-input-id='${input.id}'], div[data-input-id='${input.id}']`) uploading_el.removeClass("image-ident-loading"); console.log("found text", l); - if (l.includes("accesion") || l.includes("number") || l.search( + if (l.includes("accession") || l.includes("number") || l.search( /(ref|rk9|rh8|ra9|rbz)\d+/g) > -1) { console.log("Match found ", input); $(input).addClass("image-ident-warning"); diff --git a/atlas/api.py b/atlas/api.py index c9d0a6c6..991188ac 100644 --- a/atlas/api.py +++ b/atlas/api.py @@ -54,7 +54,6 @@ class CaseSchema(ModelSchema): model_fields = ["id", "title"] -@logger.catch() @router.post("/upload_dicom", auth=django_auth) def upload_dicom(request, files: List[UploadedFile] = File(...)): uploaded = [] @@ -69,7 +68,6 @@ def upload_dicom(request, files: List[UploadedFile] = File(...)): uploaded.append((file.name, ud.image_blake3_hash)) except DuplicateDicom: - print(ud.check_for_duplicates(ud.image_blake3_hash)) duplicate.append((file.name, ud.image_blake3_hash)) pass except InvalidDicomError: diff --git a/atlas/models.py b/atlas/models.py index dc156059..2d861d52 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -1110,7 +1110,6 @@ class UncategorisedDicom(models.Model): return duplicate - @logger.catch() def save(self, *args, **kwargs): """Override save method to add image hash""" if self.image: diff --git a/atlas/templates/atlas/help.html b/atlas/templates/atlas/help.html index 075901a9..e4830554 100644 --- a/atlas/templates/atlas/help.html +++ b/atlas/templates/atlas/help.html @@ -30,5 +30,7 @@ Available here

Step 3: Integrate the uploader with PACs

Whilst in PACs open the settings menu with the keyboard shortcut 'Ctrl+Shift+C'. In the 'General' tab, select 'External Tools' and click 'Add'. Press the Import button and select the xml file you downloaded in Step 2. Modify the file to run path to point the uploader exe downloaded in step 1 (clicking on the 3 dots will allow you to browse and select this file). The remaining fields should have been set via the xml file and should not require modification. +

Uploading without the uploader tool

+ If you have annonymised dicom files already exported you can uploading them directly using this form. {% endblock %} diff --git a/atlas/templates/atlas/new_uploads.html b/atlas/templates/atlas/new_uploads.html index 75988bbd..a5bb971a 100644 --- a/atlas/templates/atlas/new_uploads.html +++ b/atlas/templates/atlas/new_uploads.html @@ -10,26 +10,156 @@ Please note this form will not annonymise files. Please ensure that you have done so prior to using it. -
This form allows you to quickly upload dicom files to the server. Select the folder containing the dicom files below.
+
+

This form allows you to quickly upload dicom files to the server. Select the folder containing the dicom files below. If you wish to upload files directly from Insight you may rather use the Uploader tool.

+
+ Help +

Only valid dicom files will be uploaded.

+

It is possible to upload multiple files by selecting the parent (containing) folder. Folders within will then be searched recursively for any valid dicom files.

+

Files to be uploaded will be displayed below.

+
+
{% csrf_token %} - +
-
Selected files:
-
- +
Upload results +
+
Uploaded
+
    +
    Duplicates
    +
      +
      Failed
      +
        +
        +
        +

        Selected files:

        +
        +
          + + +
          +
          +
          +
          +
          +
          +
          +
          +
          +
          +
          +
          +
          +
          +
          Uploading...
          +
          +
          + {% endblock %} {% block js %} diff --git a/atlas/templates/atlas/user_uploads.html b/atlas/templates/atlas/user_uploads.html index 2afdd848..a1d2cda2 100644 --- a/atlas/templates/atlas/user_uploads.html +++ b/atlas/templates/atlas/user_uploads.html @@ -3,6 +3,7 @@ {% block content %}

          Uploaded dicoms

          User: {{user}}
          + Upload more dicoms
          {% if not case %}