annotate Resources/Samples/WebApplications/DrawingDicomizer/orthanc.js @ 2208:90ea60bee5ff

New metadata automatically computed at the instance level: "SopClassUid"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Dec 2016 14:48:31 +0100
parents b1291df2f780
children a3a65de1840f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1375
diff changeset
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
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
1375
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
6 * 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
7 * 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
8 * 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
9 * License, or (at your option) any later version.
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
10 *
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
11 * 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
12 * 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
13 * 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
14 * General Public License for more details.
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 *
1375
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
16 * 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
17 * 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
18 **/
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
1375
3d76e26b3865 fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
20
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
21 function guid4Block() {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
22 return Math.floor((1 + Math.random()) * 0x10000)
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
23 .toString(16)
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
24 .substring(1);
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
25 }
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
26
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
27 function guid() {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
28 return (guid4Block() + guid4Block() + '-' + guid4Block() + '-' + guid4Block() + '-' +
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
29 guid4Block() + '-' + guid4Block() + guid4Block() + guid4Block());
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
30 }
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
31
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 $(document).ready(function() {
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
34 $('#patientID').val(guid());
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
35
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 $('#submit').click(function(event) {
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 var png = context.canvas.toDataURL();
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 $.ajax({
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 type: 'POST',
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 url: '/orthanc/tools/create-dicom',
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
42 dataType: 'text',
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 data: {
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
44 PatientID: $('#patientID').val(),
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 PatientName: $('#patientName').val(),
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
46 StudyDescription: $('#studyDescription').val(),
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
47 SeriesDescription: $('#seriesDescription').val(),
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 PixelData: png,
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
49 Modality: 'RX'
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
50 },
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
51 success : function(msg) {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
52 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
53 },
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
54 error : function() {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
55 alert('Error while DICOM-izing the drawing');
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 }
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
57 });
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 return false;
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 });