Mercurial > hg > orthanc
annotate OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp @ 5640:f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 30 May 2024 21:19:57 +0200 |
parents | 1a995c6f9dae |
children | c93ca8047550 |
rev | line source |
---|---|
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
96b7918a6a18
start of the refactoring of the Orthanc REST API
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:
1103
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5611
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5611
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5430
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License as |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * published by the Free Software Foundation, either version 3 of the |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * License, or (at your option) any later version. |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * General Public License for more details. |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
24 #include "../PrecompiledHeadersServer.h" |
230 | 25 #include "OrthancRestApi.h" |
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
4045 | 27 #include "../../../OrthancFramework/Sources/Compression/GzipCompressor.h" |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
28 #include "../../../OrthancFramework/Sources/Compression/ZipReader.h" |
4045 | 29 #include "../../../OrthancFramework/Sources/Logging.h" |
30 #include "../../../OrthancFramework/Sources/MetricsRegistry.h" | |
31 #include "../../../OrthancFramework/Sources/SerializationToolbox.h" | |
4936
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
32 #include "../../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" |
4505
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
33 #include "../OrthancConfiguration.h" |
1437
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
34 #include "../ServerContext.h" |
796
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
35 |
3689
e85bfba2d307
"/instances": Support "Content-Encoding: gzip" to upload gzip-compressed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
36 #include <boost/algorithm/string/predicate.hpp> |
e85bfba2d307
"/instances": Support "Content-Encoding: gzip" to upload gzip-compressed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
37 |
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 namespace Orthanc |
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 { |
2899
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
40 static void SetupResourceAnswer(Json::Value& result, |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
41 const std::string& publicId, |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
42 ResourceType resourceType, |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
43 StoreStatus status) |
796
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
44 { |
2899
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
45 result = Json::objectValue; |
796
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
46 |
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
47 if (status != StoreStatus_Failure) |
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
48 { |
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
49 result["ID"] = publicId; |
1564
1b7def486e62
creation of DICOM series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
50 result["Path"] = GetBasePath(resourceType, publicId); |
796
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
51 } |
2899
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
52 |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
53 result["Status"] = EnumerationToString(status); |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
54 } |
796
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
55 |
2899
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
56 |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
57 static void SetupResourceAnswer(Json::Value& result, |
4519 | 58 const DicomInstanceToStore& instance, |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
59 StoreStatus status, |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
60 const std::string& instanceId) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
61 { |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
62 SetupResourceAnswer(result, instanceId, ResourceType_Instance, status); |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
63 |
4505
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
64 DicomMap summary; |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4505
diff
changeset
|
65 instance.GetSummary(summary); |
4505
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
66 |
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
67 DicomInstanceHasher hasher(summary); |
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
68 result["ParentPatient"] = hasher.HashPatient(); |
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
69 result["ParentStudy"] = hasher.HashStudy(); |
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
70 result["ParentSeries"] = hasher.HashSeries(); |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
71 } |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
72 |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
73 |
2899
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
74 void OrthancRestApi::AnswerStoredInstance(RestApiPostCall& call, |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
75 DicomInstanceToStore& instance, |
3912
7610af1532c3
prototyping automated transcoding of incoming DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3848
diff
changeset
|
76 StoreStatus status, |
7610af1532c3
prototyping automated transcoding of incoming DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3848
diff
changeset
|
77 const std::string& instanceId) const |
2899
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
78 { |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
79 Json::Value result; |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
80 SetupResourceAnswer(result, instance, status, instanceId); |
2899
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
81 call.GetOutput().AnswerJson(result); |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
82 } |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
83 |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
84 |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
85 void OrthancRestApi::AnswerStoredResource(RestApiPostCall& call, |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
86 const std::string& publicId, |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
87 ResourceType resourceType, |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
88 StoreStatus status) const |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
89 { |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
90 Json::Value result; |
5dd649de253d
POST-ing a DICOM file to "/instances" also answers the patient/study/series ID
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
91 SetupResourceAnswer(result, publicId, resourceType, status); |
796
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
92 call.GetOutput().AnswerJson(result); |
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
93 } |
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
94 |
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
95 |
1103
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
96 void OrthancRestApi::ResetOrthanc(RestApiPostCall& call) |
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
97 { |
4403 | 98 if (call.IsDocumentation()) |
99 { | |
100 call.GetDocumentation() | |
101 .SetTag("System") | |
102 .SetSummary("Restart Orthanc"); | |
103 return; | |
104 } | |
105 | |
1730
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
106 OrthancRestApi::GetApi(call).leaveBarrier_ = true; |
1103
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
107 OrthancRestApi::GetApi(call).resetRequestReceived_ = true; |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
108 call.GetOutput().AnswerBuffer("{}", MimeType_Json); |
1103
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
109 } |
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
110 |
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
111 |
1730
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
112 void OrthancRestApi::ShutdownOrthanc(RestApiPostCall& call) |
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
113 { |
4403 | 114 if (call.IsDocumentation()) |
115 { | |
116 call.GetDocumentation() | |
117 .SetTag("System") | |
118 .SetSummary("Shutdown Orthanc"); | |
119 return; | |
120 } | |
121 | |
1730
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
122 OrthancRestApi::GetApi(call).leaveBarrier_ = true; |
2908
9d277f8ad698
new enumeration: MimeType
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2905
diff
changeset
|
123 call.GetOutput().AnswerBuffer("{}", MimeType_Json); |
1730
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
124 LOG(WARNING) << "Shutdown request received"; |
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
125 } |
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
126 |
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
127 |
1103
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
128 |
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
129 |
796
e7b1ca0f1e04
creation of dicom files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
751
diff
changeset
|
130 |
216
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
131 // Upload of DICOM files through HTTP --------------------------------------- |
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
132 |
974 | 133 static void UploadDicomFile(RestApiPostCall& call) |
216
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
134 { |
4399
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
135 if (call.GetRequestOrigin() == RequestOrigin_Documentation) |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
136 { |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
137 Json::Value sample = Json::objectValue; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
138 sample["ID"] = "19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5"; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
139 sample["ParentPatient"] = "ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3"; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
140 sample["ParentSeries"] = "3774320f-ccda46d8-69ee8641-9e791cbf-3ecbbcc6"; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
141 sample["ParentStudy"] = "66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e"; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
142 sample["Path"] = "/instances/19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5"; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
143 sample["Status"] = "Success"; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
144 |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
145 call.GetDocumentation() |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
146 .SetTag("Instances") |
4403 | 147 .SetSummary("Upload DICOM instances") |
4399
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
148 .AddRequestType(MimeType_Dicom, "DICOM file to be uploaded") |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
149 .AddRequestType(MimeType_Zip, "ZIP archive containing DICOM files (new in Orthanc 1.8.2)") |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
150 .AddAnswerType(MimeType_Json, "Information about the uploaded instance, " |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
151 "or list of information for each uploaded instance in the case of ZIP archive") |
4404 | 152 .SetAnswerField("ID", RestApiCallDocumentation::Type_String, "Orthanc identifier of the new instance") |
153 .SetAnswerField("Path", RestApiCallDocumentation::Type_String, "Path to the new instance in the REST API") | |
154 .SetAnswerField("Status", RestApiCallDocumentation::Type_String, "Can be `Success`, `AlreadyStored`, `Failure`, or `FilteredOut` (removed by some `NewInstanceFilter`)") | |
4413 | 155 .SetAnswerField("ParentPatient", RestApiCallDocumentation::Type_String, "Orthanc identifier of the parent patient") |
156 .SetAnswerField("ParentStudy", RestApiCallDocumentation::Type_String, "Orthanc identifier of the parent study") | |
157 .SetAnswerField("ParentSeries", RestApiCallDocumentation::Type_String, "Orthanc identifier of the parent series") | |
4399
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
158 .SetSample(sample); |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
159 return; |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
160 } |
80fd140b12ba
New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4378
diff
changeset
|
161 |
746
478f4f9de9eb
getting rid of macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
745
diff
changeset
|
162 ServerContext& context = OrthancRestApi::GetContext(call); |
216
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
163 |
5430
b83192e7ad10
Now displaying timings when reading from/writing to disk in the verbose logs
Alain Mazy <am@osimis.io>
parents:
5337
diff
changeset
|
164 CLOG(INFO, HTTP) << "Receiving a DICOM file of " << Toolbox::GetHumanFileSize(static_cast<uint64_t>(call.GetBodySize())) << " through HTTP"; |
3491
22bdb9c91ebf
Log an explicit error if uploading an empty DICOM file using REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
165 |
1446
8dc80ba768aa
refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1437
diff
changeset
|
166 if (call.GetBodySize() == 0) |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
167 { |
3491
22bdb9c91ebf
Log an explicit error if uploading an empty DICOM file using REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
168 throw OrthancException(ErrorCode_BadFileFormat, |
22bdb9c91ebf
Log an explicit error if uploading an empty DICOM file using REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3401
diff
changeset
|
169 "Received an empty DICOM file"); |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
285
diff
changeset
|
170 } |
216
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
171 |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
172 if (ZipReader::IsZipMemoryBuffer(call.GetBodyData(), call.GetBodySize())) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
173 { |
4374
79ef2b6d8e76
there will be a 1.8.2 release before 1.9.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4357
diff
changeset
|
174 // New in Orthanc 1.8.2 |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
175 std::unique_ptr<ZipReader> reader(ZipReader::CreateFromMemory(call.GetBodyData(), call.GetBodySize())); |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
176 |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
177 Json::Value answer = Json::arrayValue; |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
178 |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
179 std::string filename, content; |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
180 while (reader->ReadNextFile(filename, content)) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
181 { |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
182 if (!content.empty()) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
183 { |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
184 LOG(INFO) << "Uploading DICOM file from ZIP archive: " << filename; |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
185 |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
186 std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromBuffer(content)); |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
187 toStore->SetOrigin(DicomInstanceOrigin::FromRest(call)); |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
188 |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
189 std::string publicId; |
3689
e85bfba2d307
"/instances": Support "Content-Encoding: gzip" to upload gzip-compressed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
190 |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
191 try |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
192 { |
4796
94616af363ec
added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents:
4765
diff
changeset
|
193 ServerContext::StoreResult result = context.Store(publicId, *toStore, StoreInstanceMode_Default); |
3841
be7df7fe3d80
avoid one memcpy of the DICOM buffer on "POST /instances"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
194 |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
195 Json::Value info; |
4796
94616af363ec
added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents:
4765
diff
changeset
|
196 SetupResourceAnswer(info, *toStore, result.GetStatus(), publicId); |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
197 answer.append(info); |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
198 } |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
199 catch (OrthancException& e) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
200 { |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
201 if (e.GetErrorCode() == ErrorCode_BadFileFormat) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
202 { |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
203 LOG(ERROR) << "Cannot import non-DICOM file from ZIP archive: " << filename; |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
204 } |
4765
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
205 else if (e.GetErrorCode() == ErrorCode_InexistentTag) |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
206 { |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
207 /** |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
208 * Allow upload of ZIP archives containing a DICOMDIR |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
209 * file (new in Orthanc 1.9.7): |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
210 * https://groups.google.com/g/orthanc-users/c/sgBU89o4nhU/m/kbRAYiQUAAAJ |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
211 **/ |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
212 LOG(ERROR) << "Ignoring what is probably a DICOMDIR file within a ZIP archive: \"" << filename << "\""; |
71fbdee4b832
Fix upload of ZIP archives containing a DICOMDIR file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4698
diff
changeset
|
213 } |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
214 else |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
215 { |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
216 throw; |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
217 } |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
218 } |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
219 } |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
220 } |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
221 |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
222 call.GetOutput().AnswerJson(answer); |
3689
e85bfba2d307
"/instances": Support "Content-Encoding: gzip" to upload gzip-compressed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
223 } |
e85bfba2d307
"/instances": Support "Content-Encoding: gzip" to upload gzip-compressed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
224 else |
e85bfba2d307
"/instances": Support "Content-Encoding: gzip" to upload gzip-compressed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
225 { |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
226 // The lifetime of "dicom" must be longer than "toStore", as the |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
227 // latter can possibly store a reference to the former (*) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
228 std::string dicom; |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
229 |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
230 std::unique_ptr<DicomInstanceToStore> toStore; |
1005
84b6d7bca6db
refactoring of ServerContext::Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
974
diff
changeset
|
231 |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
232 if (boost::iequals(call.GetHttpHeader("content-encoding", ""), "gzip")) |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
233 { |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
234 GzipCompressor compressor; |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
235 compressor.Uncompress(dicom, call.GetBodyData(), call.GetBodySize()); |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
236 toStore.reset(DicomInstanceToStore::CreateFromBuffer(dicom)); // (*) |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
237 } |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
238 else |
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
239 { |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
240 toStore.reset(DicomInstanceToStore::CreateFromBuffer(call.GetBodyData(), call.GetBodySize())); |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
241 } |
216
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
242 |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
243 toStore->SetOrigin(DicomInstanceOrigin::FromRest(call)); |
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
244 |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
245 std::string publicId; |
4796
94616af363ec
added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents:
4765
diff
changeset
|
246 ServerContext::StoreResult result = context.Store(publicId, *toStore, StoreInstanceMode_Default); |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
247 |
4796
94616af363ec
added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents:
4765
diff
changeset
|
248 OrthancRestApi::GetApi(call).AnswerStoredInstance(call, *toStore, result.GetStatus(), publicId); |
4357
886bc367aeb2
"/instances" can be used to import ZIP archives provided in the POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4330
diff
changeset
|
249 } |
216
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
250 } |
215
c07170f3f4f7
refactoring of access to images in REST
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
214
diff
changeset
|
251 |
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 |
304 | 253 |
213
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
254 // Registration of the various REST handlers -------------------------------- |
4ce7fdcc8879
access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
255 |
4378
9e2fc6911ac8
adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents:
4374
diff
changeset
|
256 OrthancRestApi::OrthancRestApi(ServerContext& context, |
9e2fc6911ac8
adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents:
4374
diff
changeset
|
257 bool orthancExplorerEnabled) : |
1103
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
258 context_(context), |
1730
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
259 leaveBarrier_(false), |
3176
784bbb03fb54
new metrics: orthanc_rest_api_active_requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3175
diff
changeset
|
260 resetRequestReceived_(false), |
784bbb03fb54
new metrics: orthanc_rest_api_active_requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3175
diff
changeset
|
261 activeRequests_(context.GetMetricsRegistry(), |
784bbb03fb54
new metrics: orthanc_rest_api_active_requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3175
diff
changeset
|
262 "orthanc_rest_api_active_requests", |
5337
b376abae664a
Metrics can be stored either as floating-point numbers, or as integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5336
diff
changeset
|
263 MetricsUpdatePolicy_MaxOver10Seconds) |
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 { |
4378
9e2fc6911ac8
adding option to disable orthance explorer when http server is enabled
Andrew Wallis <andrew.wallis@varian.com>>
parents:
4374
diff
changeset
|
265 RegisterSystem(orthancExplorerEnabled); |
751
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
266 |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
267 RegisterChanges(); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
268 RegisterResources(); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
269 RegisterModalities(); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
270 RegisterAnonymizeModify(); |
5197fd35333c
refactoring of OrthancRestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
750
diff
changeset
|
271 RegisterArchive(); |
211 | 272 |
216
e5d5d4a9a326
refactored upload of dicom through http
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
215
diff
changeset
|
273 Register("/instances", UploadDicomFile); |
1063
0332e6e8c679
Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1005
diff
changeset
|
274 |
0332e6e8c679
Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1005
diff
changeset
|
275 // Auto-generated directories |
0332e6e8c679
Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1005
diff
changeset
|
276 Register("/tools", RestApi::AutoListChildren); |
1103
bec1eccf976c
Hot restart of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
277 Register("/tools/reset", ResetOrthanc); |
1730
bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1572
diff
changeset
|
278 Register("/tools/shutdown", ShutdownOrthanc); |
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 } |
1437
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
280 |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
281 |
3175
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
282 bool OrthancRestApi::Handle(HttpOutput& output, |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
283 RequestOrigin origin, |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
284 const char* remoteIp, |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
285 const char* username, |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
286 HttpMethod method, |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
287 const UriComponents& uri, |
4330
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4294
diff
changeset
|
288 const HttpToolbox::Arguments& headers, |
a01b1c9cbef4
moving generic type definitions from IHttpHandler to HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4294
diff
changeset
|
289 const HttpToolbox::GetArguments& getArguments, |
3401 | 290 const void* bodyData, |
3175
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
291 size_t bodySize) |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
292 { |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
293 MetricsRegistry::Timer timer(context_.GetMetricsRegistry(), "orthanc_rest_api_duration_ms"); |
3176
784bbb03fb54
new metrics: orthanc_rest_api_active_requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3175
diff
changeset
|
294 MetricsRegistry::ActiveCounter counter(activeRequests_); |
3175
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
295 |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
296 return RestApi::Handle(output, origin, remoteIp, username, method, |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
297 uri, headers, getArguments, bodyData, bodySize); |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
298 } |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
299 |
574890d14c92
new metrics: orthanc_store_dicom_duration_ms, orthanc_storage_[create|read|remove]_duration_ms
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
300 |
1437
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
301 ServerContext& OrthancRestApi::GetContext(RestApiCall& call) |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
302 { |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
303 return GetApi(call).context_; |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
304 } |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
305 |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
306 |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
307 ServerIndex& OrthancRestApi::GetIndex(RestApiCall& call) |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
308 { |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
309 return GetContext(call).GetIndex(); |
02f5a3f5c0a0
access to the REST API from Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
310 } |
2867 | 311 |
312 | |
313 | |
314 static const char* KEY_PERMISSIVE = "Permissive"; | |
315 static const char* KEY_PRIORITY = "Priority"; | |
316 static const char* KEY_SYNCHRONOUS = "Synchronous"; | |
317 static const char* KEY_ASYNCHRONOUS = "Asynchronous"; | |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
318 |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
319 |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
320 bool OrthancRestApi::IsSynchronousJobRequest(bool isDefaultSynchronous, |
2966 | 321 const Json::Value& body) |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
322 { |
2966 | 323 if (body.type() != Json::objectValue) |
324 { | |
325 return isDefaultSynchronous; | |
326 } | |
327 else if (body.isMember(KEY_SYNCHRONOUS)) | |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
328 { |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
329 return SerializationToolbox::ReadBoolean(body, KEY_SYNCHRONOUS); |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
330 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
331 else if (body.isMember(KEY_ASYNCHRONOUS)) |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
332 { |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
333 return !SerializationToolbox::ReadBoolean(body, KEY_ASYNCHRONOUS); |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
334 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
335 else |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
336 { |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
337 return isDefaultSynchronous; |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
338 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
339 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
340 |
2970
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
341 |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
342 unsigned int OrthancRestApi::GetJobRequestPriority(const Json::Value& body) |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
343 { |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
344 if (body.type() != Json::objectValue || |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
345 !body.isMember(KEY_PRIORITY)) |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
346 { |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
347 return 0; // Default priority |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
348 } |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
349 else |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
350 { |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
351 return SerializationToolbox::ReadInteger(body, KEY_PRIORITY); |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
352 } |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
353 } |
eea66afed0db
remove redundancies
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
354 |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
355 |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
356 void OrthancRestApi::SubmitGenericJob(RestApiOutput& output, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
357 ServerContext& context, |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
358 IJob* job, |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
359 bool synchronous, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
360 int priority) |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
361 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3689
diff
changeset
|
362 std::unique_ptr<IJob> raii(job); |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
363 |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
364 if (job == NULL) |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
365 { |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
366 throw OrthancException(ErrorCode_NullPointer); |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
367 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
368 |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
369 if (synchronous) |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
370 { |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
371 Json::Value successContent; |
3240
e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3176
diff
changeset
|
372 context.GetJobsEngine().GetRegistry().SubmitAndWait |
e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3176
diff
changeset
|
373 (successContent, raii.release(), priority); |
e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3176
diff
changeset
|
374 |
e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3176
diff
changeset
|
375 // Success in synchronous execution |
e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3176
diff
changeset
|
376 output.AnswerJson(successContent); |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
377 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
378 else |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
379 { |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
380 // Asynchronous mode: Submit the job, but don't wait for its completion |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
381 std::string id; |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
382 context.GetJobsEngine().GetRegistry().Submit |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
383 (id, raii.release(), priority); |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
384 |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
385 Json::Value v; |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
386 v["ID"] = id; |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
387 v["Path"] = "/jobs/" + id; |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
388 output.AnswerJson(v); |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
389 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
390 } |
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
391 |
2867 | 392 |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
393 void OrthancRestApi::SubmitGenericJob(RestApiPostCall& call, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
394 IJob* job, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
395 bool isDefaultSynchronous, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
396 const Json::Value& body) const |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
397 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3689
diff
changeset
|
398 std::unique_ptr<IJob> raii(job); |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
399 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
400 if (body.type() != Json::objectValue) |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
401 { |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
402 throw OrthancException(ErrorCode_BadFileFormat); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
403 } |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
404 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
405 bool synchronous = IsSynchronousJobRequest(isDefaultSynchronous, body); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
406 int priority = GetJobRequestPriority(body); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
407 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
408 SubmitGenericJob(call.GetOutput(), context_, raii.release(), synchronous, priority); |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
409 } |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
410 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2970
diff
changeset
|
411 |
2867 | 412 void OrthancRestApi::SubmitCommandsJob(RestApiPostCall& call, |
413 SetOfCommandsJob* job, | |
414 bool isDefaultSynchronous, | |
415 const Json::Value& body) const | |
416 { | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3689
diff
changeset
|
417 std::unique_ptr<SetOfCommandsJob> raii(job); |
2867 | 418 |
419 if (body.type() != Json::objectValue) | |
420 { | |
421 throw OrthancException(ErrorCode_BadFileFormat); | |
422 } | |
423 | |
424 job->SetDescription("REST API"); | |
425 | |
426 if (body.isMember(KEY_PERMISSIVE)) | |
427 { | |
428 job->SetPermissive(SerializationToolbox::ReadBoolean(body, KEY_PERMISSIVE)); | |
429 } | |
430 else | |
431 { | |
432 job->SetPermissive(false); | |
433 } | |
434 | |
2965
9c0b0a6d8b54
MediaArchiveSize configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2908
diff
changeset
|
435 SubmitGenericJob(call, raii.release(), isDefaultSynchronous, body); |
2867 | 436 } |
4419 | 437 |
5130
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
438 void OrthancRestApi::SubmitThreadedInstancesJob(RestApiPostCall& call, |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
439 ThreadedSetOfInstancesJob* job, |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
440 bool isDefaultSynchronous, |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
441 const Json::Value& body) const |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
442 { |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
443 std::unique_ptr<ThreadedSetOfInstancesJob> raii(job); |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
444 |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
445 if (body.type() != Json::objectValue) |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
446 { |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
447 throw OrthancException(ErrorCode_BadFileFormat); |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
448 } |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
449 |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
450 job->SetDescription("REST API"); |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
451 |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
452 if (body.isMember(KEY_PERMISSIVE)) |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
453 { |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
454 job->SetPermissive(SerializationToolbox::ReadBoolean(body, KEY_PERMISSIVE)); |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
455 } |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
456 else |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
457 { |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
458 job->SetPermissive(false); |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
459 } |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
460 |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
461 SubmitGenericJob(call, raii.release(), isDefaultSynchronous, body); |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
462 } |
f2dcdbe05884
ResourceModification jobs can now use multiple threads
Alain Mazy <am@osimis.io>
parents:
4936
diff
changeset
|
463 |
4419 | 464 void OrthancRestApi::DocumentSubmitGenericJob(RestApiPostCall& call) |
465 { | |
466 call.GetDocumentation() | |
467 .SetRequestField(KEY_SYNCHRONOUS, RestApiCallDocumentation::Type_Boolean, | |
468 "If `true`, run the job in synchronous mode, which means that the HTTP answer will directly " | |
469 "contain the result of the job. This is the default, easy behavior, but it is *not* desirable for " | |
470 "long jobs, as it might lead to network timeouts.", false) | |
471 .SetRequestField(KEY_ASYNCHRONOUS, RestApiCallDocumentation::Type_Boolean, | |
472 "If `true`, run the job in asynchronous mode, which means that the REST API call will immediately " | |
473 "return, reporting the identifier of a job. Prefer this flavor wherever possible.", false) | |
474 .SetRequestField(KEY_PRIORITY, RestApiCallDocumentation::Type_Number, | |
475 "In asynchronous mode, the priority of the job. The lower the value, the higher the priority.", false) | |
476 .SetAnswerField("ID", RestApiCallDocumentation::Type_String, "In asynchronous mode, identifier of the job") | |
477 .SetAnswerField("Path", RestApiCallDocumentation::Type_String, "In asynchronous mode, path to access the job in the REST API"); | |
478 } | |
479 | |
480 | |
481 void OrthancRestApi::DocumentSubmitCommandsJob(RestApiPostCall& call) | |
482 { | |
483 DocumentSubmitGenericJob(call); | |
484 call.GetDocumentation() | |
485 .SetRequestField(KEY_PERMISSIVE, RestApiCallDocumentation::Type_Boolean, | |
486 "If `true`, ignore errors during the individual steps of the job.", false); | |
487 } | |
4697
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
488 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
489 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
490 static const std::string GET_SIMPLIFY = "simplify"; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
491 static const std::string GET_FULL = "full"; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
492 static const std::string GET_SHORT = "short"; |
5611
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
493 static const std::string GET_REQUESTED_TAGS_OLD = "requestedTags"; // This was the only option in Orthanc <= 1.12.3 |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
494 static const std::string GET_REQUESTED_TAGS = "requested-tags"; |
4697
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
495 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
496 static const std::string POST_SIMPLIFY = "Simplify"; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
497 static const std::string POST_FULL = "Full"; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
498 static const std::string POST_SHORT = "Short"; |
4936
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
499 static const std::string POST_REQUESTED_TAGS = "RequestedTags"; |
4697
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
500 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
501 static const std::string DOCUMENT_SIMPLIFY = |
4698
d16c3c7f11ef
new route "/tools/bulk-content" to get the content of a set of resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4697
diff
changeset
|
502 "report the DICOM tags in human-readable format (using the symbolic name of the tags)"; |
4697
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
503 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
504 static const std::string DOCUMENT_SHORT = |
4698
d16c3c7f11ef
new route "/tools/bulk-content" to get the content of a set of resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4697
diff
changeset
|
505 "report the DICOM tags in hexadecimal format"; |
4697
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
506 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
507 static const std::string DOCUMENT_FULL = |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
508 "report the DICOM tags in full format (tags indexed by their hexadecimal " |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
509 "format, associated with their symbolic name and their value)"; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
510 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
511 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
512 DicomToJsonFormat OrthancRestApi::GetDicomFormat(const RestApiGetCall& call, |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
513 DicomToJsonFormat defaultFormat) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
514 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
515 if (call.HasArgument(GET_SIMPLIFY)) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
516 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
517 return DicomToJsonFormat_Human; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
518 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
519 else if (call.HasArgument(GET_SHORT)) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
520 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
521 return DicomToJsonFormat_Short; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
522 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
523 else if (call.HasArgument(GET_FULL)) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
524 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
525 return DicomToJsonFormat_Full; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
526 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
527 else |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
528 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
529 return defaultFormat; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
530 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
531 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
532 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
533 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
534 DicomToJsonFormat OrthancRestApi::GetDicomFormat(const Json::Value& body, |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
535 DicomToJsonFormat defaultFormat) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
536 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
537 if (body.isMember(POST_SIMPLIFY) && |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
538 SerializationToolbox::ReadBoolean(body, POST_SIMPLIFY)) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
539 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
540 return DicomToJsonFormat_Human; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
541 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
542 else if (body.isMember(POST_SHORT) && |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
543 SerializationToolbox::ReadBoolean(body, POST_SHORT)) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
544 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
545 return DicomToJsonFormat_Short; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
546 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
547 else if (body.isMember(POST_FULL) && |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
548 SerializationToolbox::ReadBoolean(body, POST_FULL)) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
549 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
550 return DicomToJsonFormat_Full; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
551 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
552 else |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
553 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
554 return defaultFormat; |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
555 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
556 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
557 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
558 void OrthancRestApi::DocumentDicomFormat(RestApiGetCall& call, |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
559 DicomToJsonFormat defaultFormat) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
560 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
561 if (defaultFormat != DicomToJsonFormat_Human) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
562 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
563 call.GetDocumentation().SetHttpGetArgument( |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
564 GET_SIMPLIFY, RestApiCallDocumentation::Type_Boolean, "If present, " + DOCUMENT_SIMPLIFY, false); |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
565 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
566 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
567 if (defaultFormat != DicomToJsonFormat_Short) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
568 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
569 call.GetDocumentation().SetHttpGetArgument( |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
570 GET_SHORT, RestApiCallDocumentation::Type_Boolean, "If present, " + DOCUMENT_SHORT, false); |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
571 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
572 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
573 if (defaultFormat != DicomToJsonFormat_Full) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
574 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
575 call.GetDocumentation().SetHttpGetArgument( |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
576 GET_FULL, RestApiCallDocumentation::Type_Boolean, "If present, " + DOCUMENT_FULL, false); |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
577 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
578 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
579 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
580 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
581 void OrthancRestApi::DocumentDicomFormat(RestApiPostCall& call, |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
582 DicomToJsonFormat defaultFormat) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
583 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
584 if (defaultFormat != DicomToJsonFormat_Human) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
585 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
586 call.GetDocumentation().SetRequestField(POST_SIMPLIFY, RestApiCallDocumentation::Type_Boolean, |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
587 "If set to `true`, " + DOCUMENT_SIMPLIFY, false); |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
588 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
589 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
590 if (defaultFormat != DicomToJsonFormat_Short) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
591 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
592 call.GetDocumentation().SetRequestField(POST_SHORT, RestApiCallDocumentation::Type_Boolean, |
4698
d16c3c7f11ef
new route "/tools/bulk-content" to get the content of a set of resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4697
diff
changeset
|
593 "If set to `true`, " + DOCUMENT_SHORT, false); |
4697
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
594 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
595 |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
596 if (defaultFormat != DicomToJsonFormat_Full) |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
597 { |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
598 call.GetDocumentation().SetRequestField(POST_FULL, RestApiCallDocumentation::Type_Boolean, |
4698
d16c3c7f11ef
new route "/tools/bulk-content" to get the content of a set of resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4697
diff
changeset
|
599 "If set to `true`, " + DOCUMENT_FULL, false); |
4697
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
600 } |
569d9ef165b1
Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
601 } |
4936
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
602 |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
603 void OrthancRestApi::GetRequestedTags(std::set<DicomTag>& requestedTags, |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
604 const RestApiGetCall& call) |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
605 { |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
606 requestedTags.clear(); |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
607 |
5611
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
608 std::string s; |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
609 |
4936
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
610 if (call.HasArgument(GET_REQUESTED_TAGS)) |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
611 { |
5611
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
612 s = call.GetArgument(GET_REQUESTED_TAGS, ""); |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
613 } |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
614 else if (call.HasArgument(GET_REQUESTED_TAGS_OLD)) |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
615 { |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
616 // This is for backward compatibility with Orthanc <= 1.12.3 |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
617 s = call.GetArgument(GET_REQUESTED_TAGS_OLD, ""); |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
618 } |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
619 |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
620 if (!s.empty()) |
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
621 { |
4936
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
622 try |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
623 { |
5611
1a995c6f9dae
deprecating the "requestedTags" GET argument in favor of "requested-tags"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5562
diff
changeset
|
624 FromDcmtkBridge::ParseListOfTags(requestedTags, s); |
4936
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
625 } |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
626 catch (OrthancException& ex) |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
627 { |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
628 throw OrthancException(ErrorCode_BadRequest, std::string("Invalid requestedTags argument: ") + ex.What() + " " + ex.GetDetails()); |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
629 } |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
630 } |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
631 } |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
632 |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
633 void OrthancRestApi::DocumentRequestedTags(RestApiGetCall& call) |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
634 { |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
635 call.GetDocumentation().SetHttpGetArgument(GET_REQUESTED_TAGS, RestApiCallDocumentation::Type_String, |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
636 "If present, list the DICOM Tags you want to list in the response. This argument is a semi-column separated list " |
5562
fa000bd60bbe
ensuring consistency
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
637 "of DICOM Tags identifiers; e.g: '" + GET_REQUESTED_TAGS + "=0010,0010;PatientBirthDate'. " |
4936
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
638 "The tags requested tags are returned in the 'RequestedTags' field in the response. " |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
639 "Note that, if you are requesting tags that are not listed in the Main Dicom Tags stored in DB, building the response " |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
640 "might be slow since Orthanc will need to access the DICOM files. If not specified, Orthanc will return ", false); |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
641 } |
8422e4f99a18
Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
642 |
210
96b7918a6a18
start of the refactoring of the Orthanc REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 } |