Mercurial > hg > orthanc
annotate OrthancServer/Resources/Samples/WebApplications/DrawingDicomizer/orthanc.js @ 5294:e0e2aee4453e
Modality worklists plugin: allow searching on private tags (exact match only)
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 10 May 2023 12:52:35 +0200 |
parents | 0ea402b4d901 |
children | 48b8dae6dc77 |
rev | line source |
---|---|
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1120
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5185
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4870
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4870
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
11 * License, or (at your option) any later version. |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
12 * |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
16 * General Public License for more details. |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
22 |
1120
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
23 function guid4Block() { |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
24 return Math.floor((1 + Math.random()) * 0x10000) |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
25 .toString(16) |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
26 .substring(1); |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
27 } |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
28 |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
29 function guid() { |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
30 return (guid4Block() + guid4Block() + '-' + guid4Block() + '-' + guid4Block() + '-' + |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
31 guid4Block() + '-' + guid4Block() + guid4Block() + guid4Block()); |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
32 } |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
33 |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 $(document).ready(function() { |
1120
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
36 $('#patientID').val(guid()); |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
37 |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 $('#submit').click(function(event) { |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 var png = context.canvas.toDataURL(); |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 $.ajax({ |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 type: 'POST', |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 url: '/orthanc/tools/create-dicom', |
1120
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
44 dataType: 'text', |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 data: { |
1120
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
46 PatientID: $('#patientID').val(), |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 PatientName: $('#patientName').val(), |
1120
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
48 StudyDescription: $('#studyDescription').val(), |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
49 SeriesDescription: $('#seriesDescription').val(), |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 PixelData: png, |
1120
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
51 Modality: 'RX' |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
52 }, |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
53 success : function(msg) { |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
54 alert('Your drawing has been DICOM-ized!\n\n' + msg); |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
55 }, |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
56 error : function() { |
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
57 alert('Error while DICOM-izing the drawing'); |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 } |
1120
009dce4ea2f6
/tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
59 }); |
805
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 return false; |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 }); |
56a813a4714d
drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 }); |