OpenREM 1.0.0b2__py3-none-any.whl → 1.0.0b3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openrem/locale/de/LC_MESSAGES/django.po +1060 -1059
- openrem/locale/django.pot +973 -972
- openrem/locale/es_MX/LC_MESSAGES/django.po +1049 -1048
- openrem/locale/it/LC_MESSAGES/django.po +1044 -1043
- openrem/locale/lt/LC_MESSAGES/django.po +989 -988
- openrem/locale/nb_NO/LC_MESSAGES/django.po +985 -984
- openrem/locale/pt_BR/LC_MESSAGES/django.po +1003 -1002
- openrem/manage.py +10 -10
- openrem/openremproject/__init__.py +1 -1
- openrem/openremproject/local_settings.py.linux +128 -128
- openrem/openremproject/local_settings.py.windows +144 -144
- openrem/openremproject/local_settings.py.windows-sqlite3 +129 -129
- openrem/openremproject/settings.py +278 -278
- openrem/openremproject/urls.py +32 -32
- openrem/openremproject/wsgi.py.example +28 -28
- openrem/remapp/__init__.py +2 -2
- openrem/remapp/admin.py +31 -31
- openrem/remapp/exports/ct_export.py +780 -753
- openrem/remapp/exports/dx_export.py +817 -805
- openrem/remapp/exports/export_common.py +931 -951
- openrem/remapp/exports/export_common_pandas.py +2422 -0
- openrem/remapp/exports/exportviews.py +815 -860
- openrem/remapp/exports/mg_csv_nhsbsp.py +292 -292
- openrem/remapp/exports/mg_export.py +673 -510
- openrem/remapp/exports/nm_export.py +796 -575
- openrem/remapp/exports/rf_export.py +1418 -1431
- openrem/remapp/extractors/ct_philips.py +424 -414
- openrem/remapp/extractors/ct_toshiba.py +2116 -2108
- openrem/remapp/extractors/dx.py +1033 -952
- openrem/remapp/extractors/extract_common.py +817 -817
- openrem/remapp/extractors/import_views.py +426 -426
- openrem/remapp/extractors/mam.py +685 -672
- openrem/remapp/extractors/nm_image.py +439 -431
- openrem/remapp/extractors/ptsizecsv2db.py +368 -368
- openrem/remapp/extractors/rdsr.py +667 -654
- openrem/remapp/extractors/rdsr_methods.py +1771 -1768
- openrem/remapp/extractors/rrdsr_methods.py +630 -622
- openrem/remapp/fixtures/openskin_safelist.json +11 -11
- openrem/remapp/forms.py +2286 -2277
- openrem/remapp/interface/chart_functions.py +2412 -2393
- openrem/remapp/interface/mod_filters.py +1241 -1243
- openrem/remapp/migrations/0001_initial.py.1-0-upgrade +1043 -1043
- openrem/remapp/models.py +3418 -3407
- openrem/remapp/netdicom/dicomviews.py +681 -683
- openrem/remapp/netdicom/qrscu.py +2646 -2646
- openrem/remapp/netdicom/tools.py +134 -134
- openrem/remapp/static/css/bootstrap-theme.css +587 -587
- openrem/remapp/static/css/bootstrap-theme.min.css +4 -4
- openrem/remapp/static/css/bootstrap.css +6800 -6800
- openrem/remapp/static/css/bootstrap.min.css +4 -4
- openrem/remapp/static/css/datepicker3.css +790 -790
- openrem/remapp/static/css/jquery.qtip.min.css +2 -2
- openrem/remapp/static/css/openrem-extra.css +442 -442
- openrem/remapp/static/css/openrem.css +96 -96
- openrem/remapp/static/css/registration.css +34 -34
- openrem/remapp/static/fonts/glyphicons-halflings-regular.svg +287 -287
- openrem/remapp/static/js/bootstrap-datepicker.js +1671 -1671
- openrem/remapp/static/js/bootstrap.js +2363 -2363
- openrem/remapp/static/js/bootstrap.min.js +6 -6
- openrem/remapp/static/js/charts/chartCommonFunctions.js +75 -75
- openrem/remapp/static/js/charts/chartFullScreen.js +41 -41
- openrem/remapp/static/js/charts/ctChartAjax.js +331 -331
- openrem/remapp/static/js/charts/dxChartAjax.js +290 -290
- openrem/remapp/static/js/charts/mgChartAjax.js +144 -144
- openrem/remapp/static/js/charts/nmChartAjax.js +64 -64
- openrem/remapp/static/js/charts/plotly-2.35.2.min.js +8 -0
- openrem/remapp/static/js/charts/rfChartAjax.js +128 -128
- openrem/remapp/static/js/chroma.min.js +32 -32
- openrem/remapp/static/js/datepicker.js +5 -5
- openrem/remapp/static/js/dicom.js +115 -115
- openrem/remapp/static/js/django_reverse/reverse.js +13 -13
- openrem/remapp/static/js/formatDate.js +7 -7
- openrem/remapp/static/js/html5shiv.min.js +8 -8
- openrem/remapp/static/js/jquery-1.11.0.min.js +4 -4
- openrem/remapp/static/js/npm.js +12 -12
- openrem/remapp/static/js/respond.min.js +4 -4
- openrem/remapp/static/js/skin-dose-maps/jquery.qtip.min.js +4 -4
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMap3dHUDObject.js +112 -112
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMap3dObject.js +367 -367
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMap3dPersonObject.js +158 -158
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapColourScaleObject.js +153 -153
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapObject.js +367 -367
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapping.js +584 -584
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapping3d.js +255 -255
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMappingAjax.js +267 -212
- openrem/remapp/static/js/skin-dose-maps/three.min.js +835 -835
- openrem/remapp/static/js/sorttable.js +495 -495
- openrem/remapp/templates/base.html +253 -253
- openrem/remapp/templates/registration/changepassword.html +25 -25
- openrem/remapp/templates/registration/changepassworddone.html +12 -12
- openrem/remapp/templates/registration/login.html +42 -42
- openrem/remapp/templates/remapp/backgroundtaskmaximumrows_form.html +29 -29
- openrem/remapp/templates/remapp/base.html +1 -1
- openrem/remapp/templates/remapp/ctdetail.html +235 -235
- openrem/remapp/templates/remapp/ctfiltered.html +310 -310
- openrem/remapp/templates/remapp/dicomdeletesettings_form.html +31 -31
- openrem/remapp/templates/remapp/dicomqr.html +147 -147
- openrem/remapp/templates/remapp/dicomquerydetails.html +83 -83
- openrem/remapp/templates/remapp/dicomqueryimages.html +49 -49
- openrem/remapp/templates/remapp/dicomqueryseries.html +109 -109
- openrem/remapp/templates/remapp/dicomquerysummary.html +48 -48
- openrem/remapp/templates/remapp/dicomremoteqr_confirm_delete.html +60 -60
- openrem/remapp/templates/remapp/dicomremoteqr_form.html +32 -32
- openrem/remapp/templates/remapp/dicomstorescp_confirm_delete.html +53 -53
- openrem/remapp/templates/remapp/dicomstorescp_form.html +48 -48
- openrem/remapp/templates/remapp/dicomsummary.html +257 -257
- openrem/remapp/templates/remapp/displaychartoptions.html +184 -184
- openrem/remapp/templates/remapp/displayhomepageoptions.html +57 -57
- openrem/remapp/templates/remapp/displayname-count.html +6 -6
- openrem/remapp/templates/remapp/displayname-last-date.html +3 -3
- openrem/remapp/templates/remapp/displayname-modality.html +86 -105
- openrem/remapp/templates/remapp/displayname-skinmap.html +18 -18
- openrem/remapp/templates/remapp/displaynameupdate.html +100 -100
- openrem/remapp/templates/remapp/displaynameview.html +222 -219
- openrem/remapp/templates/remapp/dxdetail.html +176 -176
- openrem/remapp/templates/remapp/dxfiltered.html +324 -324
- openrem/remapp/templates/remapp/exports-active.html +25 -25
- openrem/remapp/templates/remapp/exports-complete.html +35 -35
- openrem/remapp/templates/remapp/exports-error.html +26 -26
- openrem/remapp/templates/remapp/exports-queue.html +18 -18
- openrem/remapp/templates/remapp/exports.html +191 -191
- openrem/remapp/templates/remapp/failed_summary_list.html +27 -27
- openrem/remapp/templates/remapp/filteredbase.html +162 -162
- openrem/remapp/templates/remapp/highdosemetricalertsettings_form.html +76 -76
- openrem/remapp/templates/remapp/home-list-modalities.html +94 -94
- openrem/remapp/templates/remapp/home.html +202 -202
- openrem/remapp/templates/remapp/list_filters.html +24 -24
- openrem/remapp/templates/remapp/mgdetail.html +160 -138
- openrem/remapp/templates/remapp/mgfiltered.html +311 -311
- openrem/remapp/templates/remapp/nmdetail.html +300 -300
- openrem/remapp/templates/remapp/nmfiltered.html +255 -255
- openrem/remapp/templates/remapp/notpatient.html +190 -190
- openrem/remapp/templates/remapp/notpatientindicators_form_base.html +81 -81
- openrem/remapp/templates/remapp/notpatientindicatorsid_confirm_delete.html +54 -54
- openrem/remapp/templates/remapp/notpatientindicatorsid_form.html +23 -23
- openrem/remapp/templates/remapp/notpatientindicatorsname_confirm_delete.html +54 -54
- openrem/remapp/templates/remapp/notpatientindicatorsname_form.html +23 -23
- openrem/remapp/templates/remapp/notpatientindicatorsname_form_base.html +85 -85
- openrem/remapp/templates/remapp/openskinsafelist_add.html +130 -130
- openrem/remapp/templates/remapp/openskinsafelist_confirm_delete.html +100 -100
- openrem/remapp/templates/remapp/openskinsafelist_form.html +207 -207
- openrem/remapp/templates/remapp/patientidsettings_form.html +83 -83
- openrem/remapp/templates/remapp/populate_summary_progress.html +83 -83
- openrem/remapp/templates/remapp/populate_summary_progress_error.html +36 -36
- openrem/remapp/templates/remapp/review_failed_imports.html +157 -157
- openrem/remapp/templates/remapp/review_failed_study.html +41 -41
- openrem/remapp/templates/remapp/review_studies_delete_button.html +20 -20
- openrem/remapp/templates/remapp/review_study.html +19 -19
- openrem/remapp/templates/remapp/review_summary_list.html +245 -245
- openrem/remapp/templates/remapp/rf_dose_alert_email_template.html +14 -1
- openrem/remapp/templates/remapp/rfalertnotificationsview.html +59 -59
- openrem/remapp/templates/remapp/rfdetail.html +547 -543
- openrem/remapp/templates/remapp/rfdetailbase.html +18 -18
- openrem/remapp/templates/remapp/rffiltered.html +404 -404
- openrem/remapp/templates/remapp/sizeimports.html +119 -119
- openrem/remapp/templates/remapp/sizeprocess.html +96 -96
- openrem/remapp/templates/remapp/sizeupload.html +110 -110
- openrem/remapp/templates/remapp/skindosemapcalcsettings_form.html +28 -28
- openrem/remapp/templates/remapp/standardname-modality.html +69 -69
- openrem/remapp/templates/remapp/standardnames_confirm_delete.html +71 -71
- openrem/remapp/templates/remapp/standardnames_form.html +87 -87
- openrem/remapp/templates/remapp/standardnamesettings_form.html +41 -41
- openrem/remapp/templates/remapp/standardnamesrefreshall.html +92 -92
- openrem/remapp/templates/remapp/standardnameview.html +103 -103
- openrem/remapp/templates/remapp/study_confirm_delete.html +147 -147
- openrem/remapp/templates/remapp/task_admin.html +265 -265
- openrem/remapp/templates/remapp/tasks.html +76 -76
- openrem/remapp/templatetags/formfilters.py +13 -13
- openrem/remapp/templatetags/proper_paginate.py +38 -38
- openrem/remapp/templatetags/remappduration.py +36 -36
- openrem/remapp/templatetags/sigdig.py +38 -38
- openrem/remapp/templatetags/sort_class_property_value.py +15 -15
- openrem/remapp/templatetags/update_variable.py +20 -20
- openrem/remapp/templatetags/url_replace.py +25 -25
- openrem/remapp/tests/test_charts_common.py +202 -202
- openrem/remapp/tests/test_charts_ct.py +7111 -7111
- openrem/remapp/tests/test_charts_dx.py +3513 -3513
- openrem/remapp/tests/test_charts_mg.py +1116 -1115
- openrem/remapp/tests/test_dcmdatetime.py +189 -189
- openrem/remapp/tests/test_dicom_qr.py +2580 -2580
- openrem/remapp/tests/test_display_name.py +274 -274
- openrem/remapp/tests/test_export_ct_xlsx.py +272 -248
- openrem/remapp/tests/test_export_dx_xlsx.py +137 -134
- openrem/remapp/tests/test_export_mammo_csv.py +242 -242
- openrem/remapp/tests/test_export_rf_xlsx.py +246 -246
- openrem/remapp/tests/test_files/DX-Im-DRGEM.dcm +0 -0
- openrem/remapp/tests/test_files/MG-RDSR-GEPristina-2D.dcm +0 -0
- openrem/remapp/tests/test_files/MG-RDSR-GEPristina-DBT.dcm +0 -0
- openrem/remapp/tests/test_files/MG-RDSR-Giotto-DBT.dcm +0 -0
- openrem/remapp/tests/test_files/skin_map_alphenix.py +590 -590
- openrem/remapp/tests/test_files/skin_map_zee.py +354 -354
- openrem/remapp/tests/test_filters_ct.py +321 -321
- openrem/remapp/tests/test_filters_dx.py +92 -92
- openrem/remapp/tests/test_filters_mammo.py +183 -183
- openrem/remapp/tests/test_filters_rf.py +118 -118
- openrem/remapp/tests/test_get_values.py +72 -72
- openrem/remapp/tests/test_hash_id.py +65 -65
- openrem/remapp/tests/test_import_ct_esr_ge.py +3034 -3034
- openrem/remapp/tests/test_import_ct_philips_rdsr.py +42 -42
- openrem/remapp/tests/test_import_ct_rdsr_multiple.py +256 -256
- openrem/remapp/tests/test_import_ct_rdsr_siemens.py +827 -827
- openrem/remapp/tests/test_import_ct_rdsr_spectrumdynamics.py +91 -91
- openrem/remapp/tests/test_import_ct_rdsr_toshiba_dosecheck.py +67 -67
- openrem/remapp/tests/test_import_ct_rdsr_toshiba_multivaluesd.py +33 -33
- openrem/remapp/tests/test_import_ct_rdsr_toshiba_pixelmed.py +118 -118
- openrem/remapp/tests/test_import_ct_sc_philips.py +44 -44
- openrem/remapp/tests/test_import_dual_rdsr.py +110 -110
- openrem/remapp/tests/test_import_dx.py +1267 -1191
- openrem/remapp/tests/test_import_dx_rdsr.py +1250 -1253
- openrem/remapp/tests/test_import_mam.py +438 -438
- openrem/remapp/tests/test_import_mg_im_hol_proj.py +46 -46
- openrem/remapp/tests/test_import_mg_rdsr.py +586 -586
- openrem/remapp/tests/test_import_nm_image.py +420 -420
- openrem/remapp/tests/test_import_nm_siemens_rdsr.py +396 -396
- openrem/remapp/tests/test_import_px.py +161 -161
- openrem/remapp/tests/test_import_rf_rdsr.py +420 -418
- openrem/remapp/tests/test_missing_date.py +42 -42
- openrem/remapp/tests/test_not_patient.py +60 -60
- openrem/remapp/tests/test_openskin.py +272 -272
- openrem/remapp/tests/test_patient_id_settings.py +72 -72
- openrem/remapp/tests/test_pt_size_import.py +232 -232
- openrem/remapp/tests/test_rf_detail.py +113 -113
- openrem/remapp/tests/test_rf_high_dose_alert.py +361 -361
- openrem/remapp/tools/background.py +361 -361
- openrem/remapp/tools/check_standard_name_status.py +47 -0
- openrem/remapp/tools/check_uid.py +70 -70
- openrem/remapp/tools/dcmdatetime.py +248 -248
- openrem/remapp/tools/default_import.py +44 -47
- openrem/remapp/tools/get_values.py +230 -230
- openrem/remapp/tools/hash_id.py +58 -58
- openrem/remapp/tools/make_skin_map.py +448 -406
- openrem/remapp/tools/not_patient_indicators.py +72 -72
- openrem/remapp/tools/openskin/calc_exp_map.py +173 -173
- openrem/remapp/tools/openskin/geomclass.py +475 -475
- openrem/remapp/tools/openskin/geomfunc.py +433 -432
- openrem/remapp/tools/openskin/skinmap.py +417 -417
- openrem/remapp/tools/populate_summary.py +185 -193
- openrem/remapp/tools/save_skin_map_structure.py +73 -73
- openrem/remapp/tools/send_high_dose_alert_emails.py +238 -207
- openrem/remapp/urls.py +456 -448
- openrem/remapp/version.py +11 -11
- openrem/remapp/views.py +1147 -1052
- openrem/remapp/views_admin.py +3876 -3936
- openrem/remapp/views_charts_ct.py +2110 -2058
- openrem/remapp/views_charts_dx.py +1906 -1836
- openrem/remapp/views_charts_mg.py +1349 -1196
- openrem/remapp/views_charts_nm.py +535 -535
- openrem/remapp/views_charts_rf.py +1219 -1241
- openrem/remapp/views_openskin.py +379 -384
- openrem/sample-config/openrem-consumer.service +12 -12
- openrem/sample-config/openrem-gunicorn.service +13 -13
- openrem/sample-config/openrem-server +14 -13
- openrem/sample-config/openrem_orthanc_config_linux.lua +454 -454
- openrem/sample-config/openrem_orthanc_config_windows.lua +455 -455
- openrem/sample-config/queue-init.bat +73 -73
- openrem/scripts/openrem_ctphilips.py +25 -25
- openrem/scripts/openrem_cttoshiba.py +28 -28
- openrem/scripts/openrem_dx.py +22 -22
- openrem/scripts/openrem_mg.py +22 -22
- openrem/scripts/openrem_nm.py +22 -22
- openrem/scripts/openrem_ptsizecsv.py +17 -17
- openrem/scripts/openrem_qr.py +12 -12
- openrem/scripts/openrem_rdsr.py +25 -25
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info}/METADATA +39 -29
- openrem-1.0.0b3.dist-info/RECORD +379 -0
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info}/WHEEL +1 -1
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info/licenses}/COPYING-GPLv3 +674 -674
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info/licenses}/LICENSE +22 -22
- OpenREM-1.0.0b2.dist-info/RECORD +0 -373
- openrem/remapp/static/js/charts/plotly-2.17.1.min.js +0 -8
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_ctphilips.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_cttoshiba.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_dx.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_mg.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_nm.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_ptsizecsv.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_qr.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_rdsr.py +0 -0
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info}/top_level.txt +0 -0
|
@@ -1,420 +1,420 @@
|
|
|
1
|
-
# This Python file uses the following encoding: utf-8
|
|
2
|
-
# OpenREM - Radiation Exposure Monitoring tools for the physicist
|
|
3
|
-
# Copyright (C) 2022 The Royal Marsden NHS Foundation Trust
|
|
4
|
-
#
|
|
5
|
-
# This program is free software: you can redistribute it and/or modify
|
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
|
7
|
-
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
# (at your option) any later version.
|
|
9
|
-
#
|
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
# GNU General Public License for more details.
|
|
14
|
-
#
|
|
15
|
-
# Additional permission under section 7 of GPLv3:
|
|
16
|
-
# You shall not make any use of the name of The Royal Marsden NHS
|
|
17
|
-
# Foundation trust in connection with this Program in any press or
|
|
18
|
-
# other public announcement without the prior written consent of
|
|
19
|
-
# The Royal Marsden NHS Foundation Trust.
|
|
20
|
-
#
|
|
21
|
-
# You should have received a copy of the GNU General Public License
|
|
22
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
from remapp.models import GeneralStudyModuleAttr
|
|
26
|
-
from .test_import_nm_siemens_rdsr import ImportTest
|
|
27
|
-
from remapp.extractors.nm_image import nm_image
|
|
28
|
-
from remapp.extractors.rdsr import rdsr
|
|
29
|
-
from mock import patch
|
|
30
|
-
|
|
31
|
-
from datetime import datetime
|
|
32
|
-
from decimal import Decimal
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class ImportNMImage(ImportTest):
|
|
36
|
-
def _get_siemens_image_expected_radioadmin(self):
|
|
37
|
-
return {
|
|
38
|
-
"get": {
|
|
39
|
-
"radiopharmaceutical_agent": {
|
|
40
|
-
"code_meaning": "Fluorodeoxyglucose F^18^"
|
|
41
|
-
},
|
|
42
|
-
"radionuclide": {"code_meaning": "^18^Fluorine"},
|
|
43
|
-
"radionuclide_half_life": Decimal(6586.2),
|
|
44
|
-
"administered_activity": Decimal(394.0),
|
|
45
|
-
"radiopharmaceutical_start_datetime": datetime(
|
|
46
|
-
2022, 2, 24, 10, 48, 30, 0
|
|
47
|
-
),
|
|
48
|
-
"radiopharmaceutical_stop_datetime": datetime(
|
|
49
|
-
2022, 2, 24, 10, 48, 30, 0
|
|
50
|
-
),
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
def test_pet_image_siemens_alone(self):
|
|
55
|
-
"""
|
|
56
|
-
Loads a single PET image
|
|
57
|
-
"""
|
|
58
|
-
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
59
|
-
nm_image(img_loc)
|
|
60
|
-
|
|
61
|
-
expected = {
|
|
62
|
-
"modality_type": "NM",
|
|
63
|
-
"patientmoduleattr_set": {
|
|
64
|
-
"get": {
|
|
65
|
-
"not_patient_indicator": None,
|
|
66
|
-
"patient_name": "REMOVED",
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"patientstudymoduleattr_set": {
|
|
70
|
-
"get": {
|
|
71
|
-
"patient_age": "063Y",
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"radiopharmaceuticalradiationdose_set": {
|
|
75
|
-
"get": {
|
|
76
|
-
"radiopharmaceuticaladministrationeventdata_set": self._get_siemens_image_expected_radioadmin(),
|
|
77
|
-
"petseries_set": {
|
|
78
|
-
lambda x: x.get(): {
|
|
79
|
-
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
80
|
-
"number_of_rr_intervals": None,
|
|
81
|
-
"number_of_time_slots": None,
|
|
82
|
-
"number_of_time_slices": None,
|
|
83
|
-
"number_of_slices": Decimal(476),
|
|
84
|
-
"reconstruction_method": "PSF+TOF 4i5s",
|
|
85
|
-
"coincidence_window_width": None,
|
|
86
|
-
"energy_window_lower_limit": Decimal(435),
|
|
87
|
-
"energy_window_upper_limit": Decimal(585),
|
|
88
|
-
"scan_progression_direction": None,
|
|
89
|
-
"petseriescorrection_set": {
|
|
90
|
-
"all": {
|
|
91
|
-
lambda x: x[0]: {"corrected_image": "NORM"},
|
|
92
|
-
lambda x: x[1]: {"corrected_image": "DTIM"},
|
|
93
|
-
lambda x: x[2]: {"corrected_image": "ATTN"},
|
|
94
|
-
lambda x: x[3]: {"corrected_image": "SCAT"},
|
|
95
|
-
lambda x: x[4]: {"corrected_image": "DECY"},
|
|
96
|
-
lambda x: x[5]: {"corrected_image": "RAN"},
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"petseriestype_set": {
|
|
100
|
-
"all": {
|
|
101
|
-
lambda x: x[0]: {"series_type": "WHOLE BODY"},
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
study = GeneralStudyModuleAttr.objects.get()
|
|
111
|
-
self._check_values(study, expected)
|
|
112
|
-
|
|
113
|
-
def test_pet_image_ge_alone(self):
|
|
114
|
-
"""
|
|
115
|
-
Loads a single PET Image
|
|
116
|
-
"""
|
|
117
|
-
img_loc = self._get_dcm_file("test_files/NM-PetIm-GE.dcm")
|
|
118
|
-
nm_image(img_loc)
|
|
119
|
-
|
|
120
|
-
expected = {
|
|
121
|
-
"modality_type": "NM",
|
|
122
|
-
"patientmoduleattr_set": {
|
|
123
|
-
"get": {
|
|
124
|
-
"not_patient_indicator": None,
|
|
125
|
-
"patient_name": "REMOVED",
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"patientstudymoduleattr_set": {
|
|
129
|
-
"get": {
|
|
130
|
-
"patient_age": "051Y",
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
"radiopharmaceuticalradiationdose_set": {
|
|
134
|
-
"get": {
|
|
135
|
-
"radiopharmaceuticaladministrationeventdata_set": {
|
|
136
|
-
"get": {
|
|
137
|
-
"radiopharmaceutical_agent": {
|
|
138
|
-
"code_meaning": "Fluorodeoxyglucose F^18^"
|
|
139
|
-
},
|
|
140
|
-
"radionuclide": {"code_meaning": "^18^Fluorine"},
|
|
141
|
-
"radiopharmaceutical_agent_string": "FDG -- fluorodeoxyglucose",
|
|
142
|
-
"radionuclide_half_life": Decimal(6586.2001953125),
|
|
143
|
-
"administered_activity": Decimal(221.596288),
|
|
144
|
-
"radiopharmaceutical_start_datetime": datetime(
|
|
145
|
-
2022, 3, 10, 12, 41, 0
|
|
146
|
-
),
|
|
147
|
-
"radiopharmaceutical_stop_datetime": datetime(
|
|
148
|
-
2022, 3, 10, 12, 42, 0
|
|
149
|
-
),
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"petseries_set": {
|
|
153
|
-
"get": {
|
|
154
|
-
"series_datetime": datetime(2022, 3, 10, 13, 31, 55),
|
|
155
|
-
"number_of_rr_intervals": None,
|
|
156
|
-
"number_of_time_slots": None,
|
|
157
|
-
"number_of_time_slices": None,
|
|
158
|
-
"number_of_slices": Decimal(313),
|
|
159
|
-
"reconstruction_method": "VPFXS",
|
|
160
|
-
"coincidence_window_width": Decimal(0.0),
|
|
161
|
-
"energy_window_lower_limit": Decimal(425),
|
|
162
|
-
"energy_window_upper_limit": Decimal(650),
|
|
163
|
-
"scan_progression_direction": None,
|
|
164
|
-
"petseriescorrection_set": {
|
|
165
|
-
"all": {
|
|
166
|
-
lambda x: x[0]: {"corrected_image": "DECY"},
|
|
167
|
-
"last": {"corrected_image": "NORM"},
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
"petseriestype_set": {
|
|
171
|
-
"first": {"series_type": "STATIC"},
|
|
172
|
-
"last": {"series_type": "IMAGE"},
|
|
173
|
-
},
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
study = GeneralStudyModuleAttr.objects.get()
|
|
181
|
-
self._check_values(study, expected)
|
|
182
|
-
|
|
183
|
-
def _get_pet_simens_rrdsr_one_img_combined(self):
|
|
184
|
-
return {
|
|
185
|
-
"radiopharmaceuticalradiationdose_set": {
|
|
186
|
-
"get": {
|
|
187
|
-
"radiopharmaceuticaladministrationeventdata_set": {
|
|
188
|
-
"get": {
|
|
189
|
-
"radiopharmaceutical_agent": {
|
|
190
|
-
"code_meaning": "Fluorodeoxyglucose F^18^"
|
|
191
|
-
},
|
|
192
|
-
"radionuclide": {"code_meaning": "^18^Fluorine"},
|
|
193
|
-
"radionuclide_half_life": Decimal(6586.2),
|
|
194
|
-
"radiopharmaceutical_administration_event_uid": "1.3.12.2.1107.5.1.4.11090.20220224104830.0",
|
|
195
|
-
"administered_activity": Decimal(394.0),
|
|
196
|
-
"radiopharmaceutical_start_datetime": datetime( # first loaded takes precedence
|
|
197
|
-
2022, 2, 24, 10, 40, 30
|
|
198
|
-
),
|
|
199
|
-
"radiopharmaceutical_stop_datetime": datetime(
|
|
200
|
-
2022, 2, 24, 10, 40, 30
|
|
201
|
-
),
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
"petseries_set": {
|
|
205
|
-
lambda x: x.get(): {
|
|
206
|
-
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
207
|
-
"number_of_rr_intervals": None,
|
|
208
|
-
"number_of_time_slots": None,
|
|
209
|
-
"number_of_time_slices": None,
|
|
210
|
-
"number_of_slices": Decimal(476),
|
|
211
|
-
"reconstruction_method": "PSF+TOF 4i5s",
|
|
212
|
-
"coincidence_window_width": None,
|
|
213
|
-
"energy_window_lower_limit": Decimal(435),
|
|
214
|
-
"energy_window_upper_limit": Decimal(585),
|
|
215
|
-
"scan_progression_direction": None,
|
|
216
|
-
"petseriescorrection_set": {
|
|
217
|
-
"first": {"corrected_image": "NORM"},
|
|
218
|
-
},
|
|
219
|
-
"petseriestype_set": {
|
|
220
|
-
"all": {
|
|
221
|
-
lambda x: x[0]: {"series_type": "WHOLE BODY"},
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
@patch("remapp.extractors.nm_image.logger")
|
|
231
|
-
def test_rrdsr_pet_image(self, logger_mock):
|
|
232
|
-
"""
|
|
233
|
-
Loads the rrdsr, followed by an associated PET-Image
|
|
234
|
-
"""
|
|
235
|
-
rrdsr_file = self._get_dcm_file("test_files/NM-RRDSR-Siemens.dcm")
|
|
236
|
-
rdsr(rrdsr_file)
|
|
237
|
-
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
238
|
-
nm_image(img_loc)
|
|
239
|
-
|
|
240
|
-
logger_mock.warning.assert_called() # Dates are set differently, therefore logger warns
|
|
241
|
-
|
|
242
|
-
study = GeneralStudyModuleAttr.objects.get()
|
|
243
|
-
self._check_values(study, self._get_pet_simens_rrdsr_one_img_combined())
|
|
244
|
-
|
|
245
|
-
def test_pet_image_rrdsr(self):
|
|
246
|
-
"""
|
|
247
|
-
Loads the PET-Image, followed by an associated rrdsr
|
|
248
|
-
"""
|
|
249
|
-
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
250
|
-
nm_image(img_loc)
|
|
251
|
-
rrdsr_file = self._get_dcm_file("test_files/NM-RRDSR-Siemens.dcm")
|
|
252
|
-
rdsr(rrdsr_file)
|
|
253
|
-
|
|
254
|
-
study = GeneralStudyModuleAttr.objects.get()
|
|
255
|
-
self._check_values(study, self._get_pet_simens_rrdsr_one_img_combined())
|
|
256
|
-
|
|
257
|
-
@patch("remapp.extractors.nm_image.logger")
|
|
258
|
-
def test_no_reloads_1(self, logger_mock):
|
|
259
|
-
"""
|
|
260
|
-
Loads the image twice to verify that it is imported only once
|
|
261
|
-
"""
|
|
262
|
-
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
263
|
-
nm_image(img_loc)
|
|
264
|
-
logger_mock.info.assert_not_called()
|
|
265
|
-
nm_image(img_loc)
|
|
266
|
-
logger_mock.info.assert_called_once()
|
|
267
|
-
|
|
268
|
-
@patch("remapp.extractors.nm_image.logger")
|
|
269
|
-
def test_no_reloads_2(self, logger_mock):
|
|
270
|
-
"""
|
|
271
|
-
Loads the image twice to verify that it is imported only once. Same as above, but now the rrdsr has been imported previously.
|
|
272
|
-
"""
|
|
273
|
-
rrdsr_file = self._get_dcm_file("test_files/NM-RRDSR-Siemens.dcm")
|
|
274
|
-
rdsr(rrdsr_file)
|
|
275
|
-
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
276
|
-
nm_image(img_loc)
|
|
277
|
-
logger_mock.info.assert_not_called()
|
|
278
|
-
nm_image(img_loc)
|
|
279
|
-
logger_mock.info.assert_called_once()
|
|
280
|
-
|
|
281
|
-
def test_load_spect_image_alone(self):
|
|
282
|
-
img_loc = self._get_dcm_file("test_files/NM-NmIm-Siemens.dcm")
|
|
283
|
-
nm_image(img_loc)
|
|
284
|
-
|
|
285
|
-
expected = {
|
|
286
|
-
"modality_type": "NM",
|
|
287
|
-
"study_date": datetime(2022, 2, 24).date(),
|
|
288
|
-
"patientmoduleattr_set": {
|
|
289
|
-
"get": {
|
|
290
|
-
"not_patient_indicator": None,
|
|
291
|
-
"patient_name": "REMOVED",
|
|
292
|
-
"patient_sex": "F",
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
"patientstudymoduleattr_set": {
|
|
296
|
-
"get": {
|
|
297
|
-
"patient_age": "050Y",
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
"generalequipmentmoduleattr_set": {
|
|
301
|
-
"get": {
|
|
302
|
-
"manufacturer": "SIEMENS NM",
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
"radiopharmaceuticalradiationdose_set": {
|
|
306
|
-
"get": {
|
|
307
|
-
"radiopharmaceuticaladministrationeventdata_set": {
|
|
308
|
-
"get": {
|
|
309
|
-
"radiopharmaceutical_agent_string": "DPD",
|
|
310
|
-
"radionuclide": {"code_meaning": "99m Technetium"},
|
|
311
|
-
"administered_activity": Decimal(764.0),
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
}
|
|
317
|
-
study = GeneralStudyModuleAttr.objects.get()
|
|
318
|
-
self._check_values(study, expected)
|
|
319
|
-
|
|
320
|
-
@patch("remapp.extractors.nm_image.logger")
|
|
321
|
-
def test_pet_image_siemens_multiple(self, logger_mock):
|
|
322
|
-
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm"))
|
|
323
|
-
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens-3-sameseries.dcm"))
|
|
324
|
-
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens-2.dcm"))
|
|
325
|
-
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens-3.dcm"))
|
|
326
|
-
|
|
327
|
-
logger_mock.info.assert_called() # 3 will not be loaded the second time, because it's already imported
|
|
328
|
-
|
|
329
|
-
study = GeneralStudyModuleAttr.objects.get()
|
|
330
|
-
expected = {
|
|
331
|
-
"modality_type": "NM",
|
|
332
|
-
"patientmoduleattr_set": {
|
|
333
|
-
"get": {
|
|
334
|
-
"not_patient_indicator": None,
|
|
335
|
-
"patient_name": "REMOVED",
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
"patientstudymoduleattr_set": {
|
|
339
|
-
"get": {
|
|
340
|
-
"patient_age": "063Y",
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
"radiopharmaceuticalradiationdose_set": {
|
|
344
|
-
"get": {
|
|
345
|
-
"radiopharmaceuticaladministrationeventdata_set": self._get_siemens_image_expected_radioadmin(),
|
|
346
|
-
"petseries_set": {
|
|
347
|
-
"count": 3,
|
|
348
|
-
"all": {
|
|
349
|
-
lambda x: x[0]: {
|
|
350
|
-
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
351
|
-
"number_of_rr_intervals": None,
|
|
352
|
-
"number_of_time_slots": None,
|
|
353
|
-
"number_of_time_slices": None,
|
|
354
|
-
"number_of_slices": Decimal(476),
|
|
355
|
-
"reconstruction_method": "PSF+TOF 4i5s",
|
|
356
|
-
"energy_window_lower_limit": Decimal(435),
|
|
357
|
-
"energy_window_upper_limit": Decimal(585),
|
|
358
|
-
"scan_progression_direction": None,
|
|
359
|
-
"petseriescorrection_set": {"count": 6},
|
|
360
|
-
"petseriestype_set": {"count": 2},
|
|
361
|
-
},
|
|
362
|
-
lambda x: x[1]: {
|
|
363
|
-
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
364
|
-
"number_of_slices": Decimal(476),
|
|
365
|
-
"reconstruction_method": "PSF+TOF 7i5s",
|
|
366
|
-
"energy_window_lower_limit": Decimal(435),
|
|
367
|
-
"energy_window_upper_limit": Decimal(585),
|
|
368
|
-
"scan_progression_direction": None,
|
|
369
|
-
"petseriescorrection_set": {"count": 6},
|
|
370
|
-
"petseriestype_set": {"count": 2},
|
|
371
|
-
},
|
|
372
|
-
lambda x: x[2]: {
|
|
373
|
-
"petseriescorrection_set": {"count": 4},
|
|
374
|
-
"petseriestype_set": {"count": 2},
|
|
375
|
-
},
|
|
376
|
-
},
|
|
377
|
-
},
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
}
|
|
381
|
-
self._check_values(study, expected)
|
|
382
|
-
|
|
383
|
-
def test_nm_image_multiple(self):
|
|
384
|
-
nm_image(self._get_dcm_file("test_files/NM-NmIm-Siemens-s1-1.dcm"))
|
|
385
|
-
nm_image(self._get_dcm_file("test_files/NM-NmIm-Siemens-s1-2.dcm"))
|
|
386
|
-
|
|
387
|
-
study = GeneralStudyModuleAttr.objects.get()
|
|
388
|
-
expected = {
|
|
389
|
-
"modality_type": "NM",
|
|
390
|
-
"study_date": datetime(2022, 2, 18).date(),
|
|
391
|
-
"patientmoduleattr_set": {
|
|
392
|
-
"get": {
|
|
393
|
-
"not_patient_indicator": None,
|
|
394
|
-
"patient_name": "REMOVED",
|
|
395
|
-
"patient_sex": "F",
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
"patientstudymoduleattr_set": {
|
|
399
|
-
"get": {
|
|
400
|
-
"patient_age": "071Y",
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
"generalequipmentmoduleattr_set": {
|
|
404
|
-
"get": {
|
|
405
|
-
"manufacturer": "SIEMENS NM",
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
"radiopharmaceuticalradiationdose_set": {
|
|
409
|
-
"get": {
|
|
410
|
-
"radiopharmaceuticaladministrationeventdata_set": {
|
|
411
|
-
"get": {
|
|
412
|
-
"radiopharmaceutical_agent_string": "Sestamibi",
|
|
413
|
-
"radionuclide": {"code_meaning": "99m Technetium"},
|
|
414
|
-
"administered_activity": Decimal(320.0),
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
}
|
|
420
|
-
self._check_values(study, expected)
|
|
1
|
+
# This Python file uses the following encoding: utf-8
|
|
2
|
+
# OpenREM - Radiation Exposure Monitoring tools for the physicist
|
|
3
|
+
# Copyright (C) 2022 The Royal Marsden NHS Foundation Trust
|
|
4
|
+
#
|
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# Additional permission under section 7 of GPLv3:
|
|
16
|
+
# You shall not make any use of the name of The Royal Marsden NHS
|
|
17
|
+
# Foundation trust in connection with this Program in any press or
|
|
18
|
+
# other public announcement without the prior written consent of
|
|
19
|
+
# The Royal Marsden NHS Foundation Trust.
|
|
20
|
+
#
|
|
21
|
+
# You should have received a copy of the GNU General Public License
|
|
22
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
from remapp.models import GeneralStudyModuleAttr
|
|
26
|
+
from .test_import_nm_siemens_rdsr import ImportTest
|
|
27
|
+
from remapp.extractors.nm_image import nm_image
|
|
28
|
+
from remapp.extractors.rdsr import rdsr
|
|
29
|
+
from mock import patch
|
|
30
|
+
|
|
31
|
+
from datetime import datetime
|
|
32
|
+
from decimal import Decimal
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ImportNMImage(ImportTest):
|
|
36
|
+
def _get_siemens_image_expected_radioadmin(self):
|
|
37
|
+
return {
|
|
38
|
+
"get": {
|
|
39
|
+
"radiopharmaceutical_agent": {
|
|
40
|
+
"code_meaning": "Fluorodeoxyglucose F^18^"
|
|
41
|
+
},
|
|
42
|
+
"radionuclide": {"code_meaning": "^18^Fluorine"},
|
|
43
|
+
"radionuclide_half_life": Decimal(6586.2),
|
|
44
|
+
"administered_activity": Decimal(394.0),
|
|
45
|
+
"radiopharmaceutical_start_datetime": datetime(
|
|
46
|
+
2022, 2, 24, 10, 48, 30, 0
|
|
47
|
+
),
|
|
48
|
+
"radiopharmaceutical_stop_datetime": datetime(
|
|
49
|
+
2022, 2, 24, 10, 48, 30, 0
|
|
50
|
+
),
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
def test_pet_image_siemens_alone(self):
|
|
55
|
+
"""
|
|
56
|
+
Loads a single PET image
|
|
57
|
+
"""
|
|
58
|
+
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
59
|
+
nm_image(img_loc)
|
|
60
|
+
|
|
61
|
+
expected = {
|
|
62
|
+
"modality_type": "NM",
|
|
63
|
+
"patientmoduleattr_set": {
|
|
64
|
+
"get": {
|
|
65
|
+
"not_patient_indicator": None,
|
|
66
|
+
"patient_name": "REMOVED",
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"patientstudymoduleattr_set": {
|
|
70
|
+
"get": {
|
|
71
|
+
"patient_age": "063Y",
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"radiopharmaceuticalradiationdose_set": {
|
|
75
|
+
"get": {
|
|
76
|
+
"radiopharmaceuticaladministrationeventdata_set": self._get_siemens_image_expected_radioadmin(),
|
|
77
|
+
"petseries_set": {
|
|
78
|
+
lambda x: x.get(): {
|
|
79
|
+
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
80
|
+
"number_of_rr_intervals": None,
|
|
81
|
+
"number_of_time_slots": None,
|
|
82
|
+
"number_of_time_slices": None,
|
|
83
|
+
"number_of_slices": Decimal(476),
|
|
84
|
+
"reconstruction_method": "PSF+TOF 4i5s",
|
|
85
|
+
"coincidence_window_width": None,
|
|
86
|
+
"energy_window_lower_limit": Decimal(435),
|
|
87
|
+
"energy_window_upper_limit": Decimal(585),
|
|
88
|
+
"scan_progression_direction": None,
|
|
89
|
+
"petseriescorrection_set": {
|
|
90
|
+
"all": {
|
|
91
|
+
lambda x: x[0]: {"corrected_image": "NORM"},
|
|
92
|
+
lambda x: x[1]: {"corrected_image": "DTIM"},
|
|
93
|
+
lambda x: x[2]: {"corrected_image": "ATTN"},
|
|
94
|
+
lambda x: x[3]: {"corrected_image": "SCAT"},
|
|
95
|
+
lambda x: x[4]: {"corrected_image": "DECY"},
|
|
96
|
+
lambda x: x[5]: {"corrected_image": "RAN"},
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"petseriestype_set": {
|
|
100
|
+
"all": {
|
|
101
|
+
lambda x: x[0]: {"series_type": "WHOLE BODY"},
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
study = GeneralStudyModuleAttr.objects.get()
|
|
111
|
+
self._check_values(study, expected)
|
|
112
|
+
|
|
113
|
+
def test_pet_image_ge_alone(self):
|
|
114
|
+
"""
|
|
115
|
+
Loads a single PET Image
|
|
116
|
+
"""
|
|
117
|
+
img_loc = self._get_dcm_file("test_files/NM-PetIm-GE.dcm")
|
|
118
|
+
nm_image(img_loc)
|
|
119
|
+
|
|
120
|
+
expected = {
|
|
121
|
+
"modality_type": "NM",
|
|
122
|
+
"patientmoduleattr_set": {
|
|
123
|
+
"get": {
|
|
124
|
+
"not_patient_indicator": None,
|
|
125
|
+
"patient_name": "REMOVED",
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"patientstudymoduleattr_set": {
|
|
129
|
+
"get": {
|
|
130
|
+
"patient_age": "051Y",
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"radiopharmaceuticalradiationdose_set": {
|
|
134
|
+
"get": {
|
|
135
|
+
"radiopharmaceuticaladministrationeventdata_set": {
|
|
136
|
+
"get": {
|
|
137
|
+
"radiopharmaceutical_agent": {
|
|
138
|
+
"code_meaning": "Fluorodeoxyglucose F^18^"
|
|
139
|
+
},
|
|
140
|
+
"radionuclide": {"code_meaning": "^18^Fluorine"},
|
|
141
|
+
"radiopharmaceutical_agent_string": "FDG -- fluorodeoxyglucose",
|
|
142
|
+
"radionuclide_half_life": Decimal(6586.2001953125),
|
|
143
|
+
"administered_activity": Decimal(221.596288),
|
|
144
|
+
"radiopharmaceutical_start_datetime": datetime(
|
|
145
|
+
2022, 3, 10, 12, 41, 0
|
|
146
|
+
),
|
|
147
|
+
"radiopharmaceutical_stop_datetime": datetime(
|
|
148
|
+
2022, 3, 10, 12, 42, 0
|
|
149
|
+
),
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"petseries_set": {
|
|
153
|
+
"get": {
|
|
154
|
+
"series_datetime": datetime(2022, 3, 10, 13, 31, 55),
|
|
155
|
+
"number_of_rr_intervals": None,
|
|
156
|
+
"number_of_time_slots": None,
|
|
157
|
+
"number_of_time_slices": None,
|
|
158
|
+
"number_of_slices": Decimal(313),
|
|
159
|
+
"reconstruction_method": "VPFXS",
|
|
160
|
+
"coincidence_window_width": Decimal(0.0),
|
|
161
|
+
"energy_window_lower_limit": Decimal(425),
|
|
162
|
+
"energy_window_upper_limit": Decimal(650),
|
|
163
|
+
"scan_progression_direction": None,
|
|
164
|
+
"petseriescorrection_set": {
|
|
165
|
+
"all": {
|
|
166
|
+
lambda x: x[0]: {"corrected_image": "DECY"},
|
|
167
|
+
"last": {"corrected_image": "NORM"},
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"petseriestype_set": {
|
|
171
|
+
"first": {"series_type": "STATIC"},
|
|
172
|
+
"last": {"series_type": "IMAGE"},
|
|
173
|
+
},
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
study = GeneralStudyModuleAttr.objects.get()
|
|
181
|
+
self._check_values(study, expected)
|
|
182
|
+
|
|
183
|
+
def _get_pet_simens_rrdsr_one_img_combined(self):
|
|
184
|
+
return {
|
|
185
|
+
"radiopharmaceuticalradiationdose_set": {
|
|
186
|
+
"get": {
|
|
187
|
+
"radiopharmaceuticaladministrationeventdata_set": {
|
|
188
|
+
"get": {
|
|
189
|
+
"radiopharmaceutical_agent": {
|
|
190
|
+
"code_meaning": "Fluorodeoxyglucose F^18^"
|
|
191
|
+
},
|
|
192
|
+
"radionuclide": {"code_meaning": "^18^Fluorine"},
|
|
193
|
+
"radionuclide_half_life": Decimal(6586.2),
|
|
194
|
+
"radiopharmaceutical_administration_event_uid": "1.3.12.2.1107.5.1.4.11090.20220224104830.0",
|
|
195
|
+
"administered_activity": Decimal(394.0),
|
|
196
|
+
"radiopharmaceutical_start_datetime": datetime( # first loaded takes precedence
|
|
197
|
+
2022, 2, 24, 10, 40, 30
|
|
198
|
+
),
|
|
199
|
+
"radiopharmaceutical_stop_datetime": datetime(
|
|
200
|
+
2022, 2, 24, 10, 40, 30
|
|
201
|
+
),
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"petseries_set": {
|
|
205
|
+
lambda x: x.get(): {
|
|
206
|
+
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
207
|
+
"number_of_rr_intervals": None,
|
|
208
|
+
"number_of_time_slots": None,
|
|
209
|
+
"number_of_time_slices": None,
|
|
210
|
+
"number_of_slices": Decimal(476),
|
|
211
|
+
"reconstruction_method": "PSF+TOF 4i5s",
|
|
212
|
+
"coincidence_window_width": None,
|
|
213
|
+
"energy_window_lower_limit": Decimal(435),
|
|
214
|
+
"energy_window_upper_limit": Decimal(585),
|
|
215
|
+
"scan_progression_direction": None,
|
|
216
|
+
"petseriescorrection_set": {
|
|
217
|
+
"first": {"corrected_image": "NORM"},
|
|
218
|
+
},
|
|
219
|
+
"petseriestype_set": {
|
|
220
|
+
"all": {
|
|
221
|
+
lambda x: x[0]: {"series_type": "WHOLE BODY"},
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@patch("remapp.extractors.nm_image.logger")
|
|
231
|
+
def test_rrdsr_pet_image(self, logger_mock):
|
|
232
|
+
"""
|
|
233
|
+
Loads the rrdsr, followed by an associated PET-Image
|
|
234
|
+
"""
|
|
235
|
+
rrdsr_file = self._get_dcm_file("test_files/NM-RRDSR-Siemens.dcm")
|
|
236
|
+
rdsr(rrdsr_file)
|
|
237
|
+
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
238
|
+
nm_image(img_loc)
|
|
239
|
+
|
|
240
|
+
logger_mock.warning.assert_called() # Dates are set differently, therefore logger warns
|
|
241
|
+
|
|
242
|
+
study = GeneralStudyModuleAttr.objects.get()
|
|
243
|
+
self._check_values(study, self._get_pet_simens_rrdsr_one_img_combined())
|
|
244
|
+
|
|
245
|
+
def test_pet_image_rrdsr(self):
|
|
246
|
+
"""
|
|
247
|
+
Loads the PET-Image, followed by an associated rrdsr
|
|
248
|
+
"""
|
|
249
|
+
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
250
|
+
nm_image(img_loc)
|
|
251
|
+
rrdsr_file = self._get_dcm_file("test_files/NM-RRDSR-Siemens.dcm")
|
|
252
|
+
rdsr(rrdsr_file)
|
|
253
|
+
|
|
254
|
+
study = GeneralStudyModuleAttr.objects.get()
|
|
255
|
+
self._check_values(study, self._get_pet_simens_rrdsr_one_img_combined())
|
|
256
|
+
|
|
257
|
+
@patch("remapp.extractors.nm_image.logger")
|
|
258
|
+
def test_no_reloads_1(self, logger_mock):
|
|
259
|
+
"""
|
|
260
|
+
Loads the image twice to verify that it is imported only once
|
|
261
|
+
"""
|
|
262
|
+
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
263
|
+
nm_image(img_loc)
|
|
264
|
+
logger_mock.info.assert_not_called()
|
|
265
|
+
nm_image(img_loc)
|
|
266
|
+
logger_mock.info.assert_called_once()
|
|
267
|
+
|
|
268
|
+
@patch("remapp.extractors.nm_image.logger")
|
|
269
|
+
def test_no_reloads_2(self, logger_mock):
|
|
270
|
+
"""
|
|
271
|
+
Loads the image twice to verify that it is imported only once. Same as above, but now the rrdsr has been imported previously.
|
|
272
|
+
"""
|
|
273
|
+
rrdsr_file = self._get_dcm_file("test_files/NM-RRDSR-Siemens.dcm")
|
|
274
|
+
rdsr(rrdsr_file)
|
|
275
|
+
img_loc = self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm")
|
|
276
|
+
nm_image(img_loc)
|
|
277
|
+
logger_mock.info.assert_not_called()
|
|
278
|
+
nm_image(img_loc)
|
|
279
|
+
logger_mock.info.assert_called_once()
|
|
280
|
+
|
|
281
|
+
def test_load_spect_image_alone(self):
|
|
282
|
+
img_loc = self._get_dcm_file("test_files/NM-NmIm-Siemens.dcm")
|
|
283
|
+
nm_image(img_loc)
|
|
284
|
+
|
|
285
|
+
expected = {
|
|
286
|
+
"modality_type": "NM",
|
|
287
|
+
"study_date": datetime(2022, 2, 24).date(),
|
|
288
|
+
"patientmoduleattr_set": {
|
|
289
|
+
"get": {
|
|
290
|
+
"not_patient_indicator": None,
|
|
291
|
+
"patient_name": "REMOVED",
|
|
292
|
+
"patient_sex": "F",
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"patientstudymoduleattr_set": {
|
|
296
|
+
"get": {
|
|
297
|
+
"patient_age": "050Y",
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"generalequipmentmoduleattr_set": {
|
|
301
|
+
"get": {
|
|
302
|
+
"manufacturer": "SIEMENS NM",
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"radiopharmaceuticalradiationdose_set": {
|
|
306
|
+
"get": {
|
|
307
|
+
"radiopharmaceuticaladministrationeventdata_set": {
|
|
308
|
+
"get": {
|
|
309
|
+
"radiopharmaceutical_agent_string": "DPD",
|
|
310
|
+
"radionuclide": {"code_meaning": "99m Technetium"},
|
|
311
|
+
"administered_activity": Decimal(764.0),
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
}
|
|
317
|
+
study = GeneralStudyModuleAttr.objects.get()
|
|
318
|
+
self._check_values(study, expected)
|
|
319
|
+
|
|
320
|
+
@patch("remapp.extractors.nm_image.logger")
|
|
321
|
+
def test_pet_image_siemens_multiple(self, logger_mock):
|
|
322
|
+
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens.dcm"))
|
|
323
|
+
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens-3-sameseries.dcm"))
|
|
324
|
+
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens-2.dcm"))
|
|
325
|
+
nm_image(self._get_dcm_file("test_files/NM-PetIm-Siemens-3.dcm"))
|
|
326
|
+
|
|
327
|
+
logger_mock.info.assert_called() # 3 will not be loaded the second time, because it's already imported
|
|
328
|
+
|
|
329
|
+
study = GeneralStudyModuleAttr.objects.get()
|
|
330
|
+
expected = {
|
|
331
|
+
"modality_type": "NM",
|
|
332
|
+
"patientmoduleattr_set": {
|
|
333
|
+
"get": {
|
|
334
|
+
"not_patient_indicator": None,
|
|
335
|
+
"patient_name": "REMOVED",
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"patientstudymoduleattr_set": {
|
|
339
|
+
"get": {
|
|
340
|
+
"patient_age": "063Y",
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"radiopharmaceuticalradiationdose_set": {
|
|
344
|
+
"get": {
|
|
345
|
+
"radiopharmaceuticaladministrationeventdata_set": self._get_siemens_image_expected_radioadmin(),
|
|
346
|
+
"petseries_set": {
|
|
347
|
+
"count": 3,
|
|
348
|
+
"all": {
|
|
349
|
+
lambda x: x[0]: {
|
|
350
|
+
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
351
|
+
"number_of_rr_intervals": None,
|
|
352
|
+
"number_of_time_slots": None,
|
|
353
|
+
"number_of_time_slices": None,
|
|
354
|
+
"number_of_slices": Decimal(476),
|
|
355
|
+
"reconstruction_method": "PSF+TOF 4i5s",
|
|
356
|
+
"energy_window_lower_limit": Decimal(435),
|
|
357
|
+
"energy_window_upper_limit": Decimal(585),
|
|
358
|
+
"scan_progression_direction": None,
|
|
359
|
+
"petseriescorrection_set": {"count": 6},
|
|
360
|
+
"petseriestype_set": {"count": 2},
|
|
361
|
+
},
|
|
362
|
+
lambda x: x[1]: {
|
|
363
|
+
"series_datetime": datetime(2022, 2, 24, 11, 56),
|
|
364
|
+
"number_of_slices": Decimal(476),
|
|
365
|
+
"reconstruction_method": "PSF+TOF 7i5s",
|
|
366
|
+
"energy_window_lower_limit": Decimal(435),
|
|
367
|
+
"energy_window_upper_limit": Decimal(585),
|
|
368
|
+
"scan_progression_direction": None,
|
|
369
|
+
"petseriescorrection_set": {"count": 6},
|
|
370
|
+
"petseriestype_set": {"count": 2},
|
|
371
|
+
},
|
|
372
|
+
lambda x: x[2]: {
|
|
373
|
+
"petseriescorrection_set": {"count": 4},
|
|
374
|
+
"petseriestype_set": {"count": 2},
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
}
|
|
381
|
+
self._check_values(study, expected)
|
|
382
|
+
|
|
383
|
+
def test_nm_image_multiple(self):
|
|
384
|
+
nm_image(self._get_dcm_file("test_files/NM-NmIm-Siemens-s1-1.dcm"))
|
|
385
|
+
nm_image(self._get_dcm_file("test_files/NM-NmIm-Siemens-s1-2.dcm"))
|
|
386
|
+
|
|
387
|
+
study = GeneralStudyModuleAttr.objects.get()
|
|
388
|
+
expected = {
|
|
389
|
+
"modality_type": "NM",
|
|
390
|
+
"study_date": datetime(2022, 2, 18).date(),
|
|
391
|
+
"patientmoduleattr_set": {
|
|
392
|
+
"get": {
|
|
393
|
+
"not_patient_indicator": None,
|
|
394
|
+
"patient_name": "REMOVED",
|
|
395
|
+
"patient_sex": "F",
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"patientstudymoduleattr_set": {
|
|
399
|
+
"get": {
|
|
400
|
+
"patient_age": "071Y",
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"generalequipmentmoduleattr_set": {
|
|
404
|
+
"get": {
|
|
405
|
+
"manufacturer": "SIEMENS NM",
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"radiopharmaceuticalradiationdose_set": {
|
|
409
|
+
"get": {
|
|
410
|
+
"radiopharmaceuticaladministrationeventdata_set": {
|
|
411
|
+
"get": {
|
|
412
|
+
"radiopharmaceutical_agent_string": "Sestamibi",
|
|
413
|
+
"radionuclide": {"code_meaning": "99m Technetium"},
|
|
414
|
+
"administered_activity": Decimal(320.0),
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
}
|
|
420
|
+
self._check_values(study, expected)
|