Mercurial > hg > orthanc
comparison OrthancServer/Resources/Samples/WebApplications/DrawingDicomizer/orthanc.js @ 4044:d25f4c0fa160 framework
splitting code into OrthancFramework and OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 20:30:34 +0200 |
parents | Resources/Samples/WebApplications/DrawingDicomizer/orthanc.js@94f4a18a79cc |
children | d9473bd5ed43 |
comparison
equal
deleted
inserted
replaced
4043:6c6239aec462 | 4044:d25f4c0fa160 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 function guid4Block() { | |
23 return Math.floor((1 + Math.random()) * 0x10000) | |
24 .toString(16) | |
25 .substring(1); | |
26 } | |
27 | |
28 function guid() { | |
29 return (guid4Block() + guid4Block() + '-' + guid4Block() + '-' + guid4Block() + '-' + | |
30 guid4Block() + '-' + guid4Block() + guid4Block() + guid4Block()); | |
31 } | |
32 | |
33 | |
34 $(document).ready(function() { | |
35 $('#patientID').val(guid()); | |
36 | |
37 $('#submit').click(function(event) { | |
38 var png = context.canvas.toDataURL(); | |
39 | |
40 $.ajax({ | |
41 type: 'POST', | |
42 url: '/orthanc/tools/create-dicom', | |
43 dataType: 'text', | |
44 data: { | |
45 PatientID: $('#patientID').val(), | |
46 PatientName: $('#patientName').val(), | |
47 StudyDescription: $('#studyDescription').val(), | |
48 SeriesDescription: $('#seriesDescription').val(), | |
49 PixelData: png, | |
50 Modality: 'RX' | |
51 }, | |
52 success : function(msg) { | |
53 alert('Your drawing has been DICOM-ized!\n\n' + msg); | |
54 }, | |
55 error : function() { | |
56 alert('Error while DICOM-izing the drawing'); | |
57 } | |
58 }); | |
59 | |
60 return false; | |
61 }); | |
62 }); |