4 * Dicom viewer wrapper script for documents
7 * @link https://www.open-emr.org
8 * @author Victor Kofia <https://kofiav.com> 'Viewer'
9 * @author Jerry Padgett <sjpadgett@gmail.com> 'Viewer wrapper'
10 * @copyright Copyright (c) 2017-2018 Victor Kofia <https://kofiav.com>
11 * @copyright Copyright (c) 2018-2020 Jerry Padgett <sjpadgett@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 /* Warning: This script wraps the Dicom viewer which is HTML5 compatible only and bootstrap styling
16 * should not be used inside this script due to style conflicts with viewer, namely, hidden class.
19 require_once('../interface/globals.php');
21 use OpenEMR\Common\Acl\AclMain
;
22 use OpenEMR\Common\Csrf\CsrfUtils
;
23 use OpenEMR\Common\Twig\TwigContainer
;
24 use OpenEMR\Core\Header
;
26 if (!AclMain
::aclCheckCore('patients', 'docs')) {
27 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Dicom Viewer")]);
31 $web_path = $_REQUEST['web_path'] ??
null;
33 $patid = $_REQUEST['patient_id'] ??
null;
34 $docid = isset($_REQUEST['document_id']) ?
$_REQUEST['document_id'] : ($_REQUEST['doc_id'] ??
null);
35 $d = new Document(attr($docid));
37 if ($d->get_mimetype() == 'application/dicom+zip') {
40 $csrf = attr(CsrfUtils
::collectCsrfToken());
41 $state_url = $GLOBALS['web_root'] . "/library/ajax/upload.php";
42 $web_path = attr($web_path) . '&retrieve&patient_id=' . attr_url($patid) . '&document_id=' . attr_url($docid) . '&as_file=false&type=' . attr_url($type);
48 <title
><?php
echo xlt("Dicom Viewer"); ?
></title
>
50 <?php Header
::setupHeader(['dwv', 'i18next', 'i18next-xhr-backend', 'i18next-browser-languagedetector', 'jszip', 'magic-wand', 'konva']); ?
>
51 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/flot/dist/es5/jquery.flot.js"></script
>
53 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/browser.js"></script
>
54 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/colourMap.js"></script
>
55 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/custom.js"></script
>
56 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/dropboxLoader.js"></script
>
57 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/filter.js"></script
>
58 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/generic.js"></script
>
59 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/undo.js"></script
>
60 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/help.js"></script
>
61 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/html.js"></script
>
62 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/infoController.js"></script
>
63 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/infoOverlay.js"></script
>
64 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/loader.js"></script
>
65 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/tools.js"></script
>
66 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/gui/plot.js"></script
>
67 <!-- i18n dwv wrapper
-->
68 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/dwv_i18n.js"></script
>
69 <!-- Launch the app
-->
70 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/dicom_gui.js"></script
>
71 <script src
="<?php echo $GLOBALS['web_root'] ?>/library/js/dwv/dicom_launcher.js"></script
>
73 <style type
="text/css">
75 background
-color
: #555;
79 button
, input
, li
, table
{
89 flex
-direction
: column
;
95 justify
-content
: space
-between
;
99 #pageHeader h1, h2, h3, h5, h6 {
108 #pageHeader .toolbar {
114 justify
-content
: center
;
131 pointer
-events
: none
;
140 border
: 5px dashed
#ccc;
143 .dropBoxBorder
.hover
{
145 border
: 5px dashed
#cc0;
154 list-style
-type
: none
;
161 list-style
-type
: none
;
175 text
-shadow
: 1px
1px
#000;
181 text
-shadow
: 1px
1px
#000;
190 text
-shadow
: 0 1px
0 #000;
199 text
-shadow
: 0 1px
0 #000;
207 text
-shadow
: 0 1px
0 #000;
215 text
-shadow
: 0 1px
0 #000;
223 text
-shadow
: 0 1px
0 #000;
231 text
-shadow
: 0 1px
0 #000;
240 text
-shadow
: 0 1px
0 #000;
248 text
-shadow
: 0 1px
0 #000;
261 border
-collapse
: collapse
;
262 background
-color
: #fff;
266 table
.tagsTable thead
{
267 background
-color
: #000;
271 table
.tagsTable thead th
{
272 text
-transform
: uppercase
;
277 table
.tagsTable tr
:nth
-child(even
) {
278 background
-color
: #c2c2c2;
282 border
-collapse
: collapse
;
285 table
.drawsTable td
{
286 vertical
-align
: middle
;
289 table
.drawsTable thead th
{
290 text
-transform
: uppercase
;
300 background
-color
: #fff;
302 padding
: 1rem
1.25rem
;
310 .drawList tr
:nth
-child(even
) {
311 background
-color
: #333;
325 padding
: 1rem
1.25rem
;
333 transform
: scale(1.05);
334 transition
: visibility
0s linear
0.25s
, opacity
0.25s
0s
, transform
0.25s
;
349 #loaderlist div.popup-content {
353 transform
: translate(-50%
, -50%
);
354 background
-color
: white
;
355 padding
: 1rem
1.25rem
;
357 border
-radius
: 0.5rem
;
358 padding
-left
: .325rem
;
361 .lg div
.popup
-content
{
363 border
: 2px solid
#fff;
365 border
-radius
: 0.5rem
;
368 background
-color
: white
;
371 #helpPopup div.popup-content {
372 background
-color
: black
;
387 .close
-button
:hover
{
388 background
-color
: lightcoral
;
394 transform
: scale(1.0);
395 transition
: visibility
0s linear
0s
, opacity
0.25s
0s
, transform
0.25s
;
402 background
-color
: #4CAF50;
411 margin
: .325rem
0 .325rem
;
416 <div id
="dwv" class="container-fluid" src
='<?php echo $web_path ?>'>
417 <?php
if ($web_path) { ?
>
418 <input type
="hidden" id
="state_url" value
='<?php echo $state_url ?>' />
419 <input type
="hidden" id
="csrf" value
='<?php echo $csrf ?>' />
420 <input type
="hidden" id
="doc_id" value
='<?php echo attr($docid) ?>'' />
422 <div id="pageHeader">
424 <h2>DICOM Viewer<span> <em>( Not for Diagnostics )</em></h2>
426 <span class="editspan"></span>
427 <div class="toolbar"></div>
428 </div><!-- /pageHeader -->
430 <!-- get state json data if file -->
431 <div class="openData" title="File">
432 <!-- Open image files -->
433 <div class="popup" id="loaderlist">
434 <div class="popup-content">
435 <span class="close-button" onclick="toggle('loaderlist
');">×</span>
437 <div class="openData" title="File">
438 <div class="loaderlist"></div>
439 <div id="progressbar"></div>
445 <div class="toolList" title="Toolbox"></div>
447 <div class="history" title="History"></div>
449 <div class="popup lg" id="tagsPopup">
450 <div class="popup-content">
451 <span class="close-button" onclick="toggle('tagsPopup
');">×</span>
452 <div class="tags" title="Tags">Please load a DICOM study to view image tags.</div>
456 <div class="popup lg" id="helpPopup">
457 <div class="popup-content">
458 <span class="close-button" onclick="toggle('helpPopup
');">×</span>
459 <div class="help" title="Help"></div>
462 <!-- Layer Container -->
463 <div class="layerDialog" title="Image">
464 <div class="layerContainer">
465 <div class="dropBox dropBoxBorder"></div>
466 <canvas class="imageLayer">Only for HTML5 compatible browsers...</canvas>
467 <div class="drawDiv"></div>
468 <div class="infoLayer">
469 <div class="infotl"></div>
470 <div class="infotc"></div>
471 <div class="infotr"></div>
472 <div class="infocl"></div>
473 <div class="infocr"></div>
474 <div class="infobl"></div>
475 <div class="infobc"></div>
476 <div class="infobr" style="bottom: 64px;"></div>
477 <div class="plot"></div>
478 </div><!-- /infoLayer -->
479 </div><!-- /layerContainer -->
480 </div><!-- /layerDialog -->
482 <div class="drawList" title="Draw list"></div>
483 </div><!-- /pageMain -->