annotate Resources/Samples/WebApplications/DrawingDicomizer/orthanc.js @ 1370:7b6f5115607f query-retrieve

integration mainline->query-retrieve
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 27 May 2015 12:32:43 +0200
parents 6e7e5ed91c2d
children 3d76e26b3865
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
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1120
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
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 *
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Permission is hereby granted, free of charge, to any person
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * obtaining a copy of this software and associated documentation
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * files (the "Software"), to deal in the Software without
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * restriction, including without limitation the rights to use, copy,
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify, merge, publish, distribute, sublicense, and/or sell copies
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * of the Software, and to permit persons to whom the Software is
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * furnished to do so, subject to the following conditions:
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * The above copyright notice and this permission notice shall be
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * included in all copies or substantial portions of the Software.
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * SOFTWARE.
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 **/
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
27 function guid4Block() {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
28 return Math.floor((1 + Math.random()) * 0x10000)
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
29 .toString(16)
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
30 .substring(1);
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
31 }
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 function guid() {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
34 return (guid4Block() + guid4Block() + '-' + guid4Block() + '-' + guid4Block() + '-' +
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
35 guid4Block() + '-' + guid4Block() + guid4Block() + guid4Block());
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
36 }
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
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 $(document).ready(function() {
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
40 $('#patientID').val(guid());
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
41
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 $('#submit').click(function(event) {
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 var png = context.canvas.toDataURL();
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 $.ajax({
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 type: 'POST',
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 url: '/orthanc/tools/create-dicom',
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
48 dataType: 'text',
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 data: {
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
50 PatientID: $('#patientID').val(),
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 PatientName: $('#patientName').val(),
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
52 StudyDescription: $('#studyDescription').val(),
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
53 SeriesDescription: $('#seriesDescription').val(),
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 PixelData: png,
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
55 Modality: 'RX'
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
56 },
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
57 success : function(msg) {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
58 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
59 },
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
60 error : function() {
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
61 alert('Error while DICOM-izing the drawing');
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
1120
009dce4ea2f6 /tools/create-dicom now accepts PatientID
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
63 });
805
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 return false;
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 });
56a813a4714d drawing dicomizer sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 });