Mercurial > hg > orthanc
annotate Core/DicomNetworking/DicomUserConnection.cpp @ 3824:6762506ef4fb transcoding
reorganization of CheckCondition()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 10 Apr 2020 15:24:02 +0200 |
parents | 1237bd0bbdb2 |
children | 4fde7933e504 |
rev | line source |
---|---|
0 | 1 /** |
62 | 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:
1285
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
136 | 11 * |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
0 | 23 * |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
34 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
35 /*========================================================================= |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
36 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
37 This file is based on portions of the following project: |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
38 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
39 Program: DCMTK 3.6.0 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
40 Module: http://dicom.offis.de/dcmtk.php.en |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
41 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
42 Copyright (C) 1994-2011, OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
43 All rights reserved. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
44 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
45 This software and supporting documentation were developed by |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
46 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
47 OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
48 R&D Division Health |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
49 Escherweg 2 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
50 26121 Oldenburg, Germany |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
51 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
52 Redistribution and use in source and binary forms, with or without |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
53 modification, are permitted provided that the following conditions |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
54 are met: |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
55 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
56 - Redistributions of source code must retain the above copyright |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
57 notice, this list of conditions and the following disclaimer. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
58 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
59 - Redistributions in binary form must reproduce the above copyright |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
60 notice, this list of conditions and the following disclaimer in the |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
61 documentation and/or other materials provided with the distribution. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
62 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
63 - Neither the name of OFFIS nor the names of its contributors may be |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
64 used to endorse or promote products derived from this software |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
65 without specific prior written permission. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
66 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
67 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
68 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
69 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
70 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
71 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
72 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
73 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
74 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
75 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
76 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
77 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
78 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
79 =========================================================================*/ |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
80 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
763
diff
changeset
|
81 |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
82 #include "../PrecompiledHeaders.h" |
0 | 83 #include "DicomUserConnection.h" |
84 | |
3117 | 85 #if !defined(DCMTK_VERSION_NUMBER) |
86 # error The macro DCMTK_VERSION_NUMBER must be defined | |
87 #endif | |
88 | |
3767 | 89 #include "../Compatibility.h" |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
90 #include "../DicomFormat/DicomArray.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
91 #include "../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
92 #include "../OrthancException.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
93 #include "../DicomParsing/FromDcmtkBridge.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
94 #include "../DicomParsing/ToDcmtkBridge.h" |
0 | 95 |
3369 | 96 #include <dcmtk/dcmdata/dcdeftag.h> |
97 #include <dcmtk/dcmdata/dcfilefo.h> | |
0 | 98 #include <dcmtk/dcmdata/dcistrmb.h> |
99 #include <dcmtk/dcmdata/dcistrmf.h> | |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
100 #include <dcmtk/dcmdata/dcmetinf.h> |
0 | 101 #include <dcmtk/dcmnet/diutil.h> |
102 | |
103 #include <set> | |
104 | |
105 | |
106 #ifdef _WIN32 | |
107 /** | |
108 * "The maximum length, in bytes, of the string returned in the buffer | |
109 * pointed to by the name parameter is dependent on the namespace provider, | |
110 * but this string must be 256 bytes or less. | |
111 * http://msdn.microsoft.com/en-us/library/windows/desktop/ms738527(v=vs.85).aspx | |
112 **/ | |
2340 | 113 # define HOST_NAME_MAX 256 |
114 # include <winsock.h> | |
0 | 115 #endif |
116 | |
117 | |
918 | 118 #if !defined(HOST_NAME_MAX) && defined(_POSIX_HOST_NAME_MAX) |
890 | 119 /** |
120 * TO IMPROVE: "_POSIX_HOST_NAME_MAX is only the minimum value that | |
121 * HOST_NAME_MAX can ever have [...] Therefore you cannot allocate an | |
122 * array of size _POSIX_HOST_NAME_MAX, invoke gethostname() and expect | |
123 * that the result will fit." | |
124 * http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00128.html | |
125 **/ | |
126 #define HOST_NAME_MAX _POSIX_HOST_NAME_MAX | |
127 #endif | |
128 | |
129 | |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
130 static const char* DEFAULT_PREFERRED_TRANSFER_SYNTAX = UID_LittleEndianImplicitTransferSyntax; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
131 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
132 /** |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
133 * "If we have more than 64 storage SOP classes, tools such as |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
134 * storescu will fail because they attempt to negotiate two |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
135 * presentation contexts for each SOP class, and there is a total |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
136 * limit of 128 contexts for one association." |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
137 **/ |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
138 static const unsigned int MAXIMUM_STORAGE_SOP_CLASSES = 64; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
139 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
140 |
62 | 141 namespace Orthanc |
0 | 142 { |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
143 // By default, the timeout for DICOM SCU (client) connections is set to 10 seconds |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
144 static uint32_t defaultTimeout_ = 10; |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
145 |
0 | 146 struct DicomUserConnection::PImpl |
147 { | |
148 // Connection state | |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
149 uint32_t dimseTimeout_; |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
150 uint32_t acseTimeout_; |
0 | 151 T_ASC_Network* net_; |
152 T_ASC_Parameters* params_; | |
153 T_ASC_Association* assoc_; | |
154 | |
155 bool IsOpen() const | |
156 { | |
157 return assoc_ != NULL; | |
158 } | |
159 | |
160 void CheckIsOpen() const; | |
161 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
162 void Store(std::string& sopClassUidOut /* out */, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
163 std::string& sopInstanceUidOut /* out */, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
164 DcmInputStream& is, |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
165 DicomUserConnection& connection, |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
166 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
167 uint16_t moveOriginatorID); |
0 | 168 }; |
169 | |
170 | |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
171 static void Check(const OFCondition& cond, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
172 const std::string& aet, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
173 const std::string& command) |
0 | 174 { |
175 if (cond.bad()) | |
176 { | |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
177 // Reformat the error message from DCMTK by turning multiline |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
178 // errors into a single line |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
179 |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
180 std::string s(cond.text()); |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
181 std::string info; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
182 info.reserve(s.size()); |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
183 |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
184 bool isMultiline = false; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
185 for (size_t i = 0; i < s.size(); i++) |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
186 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
187 if (s[i] == '\r') |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
188 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
189 // Ignore |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
190 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
191 else if (s[i] == '\n') |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
192 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
193 if (isMultiline) |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
194 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
195 info += "; "; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
196 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
197 else |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
198 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
199 info += " ("; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
200 isMultiline = true; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
201 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
202 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
203 else |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
204 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
205 info.push_back(s[i]); |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
206 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
207 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
208 |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
209 if (isMultiline) |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
210 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
211 info += ")"; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
212 } |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
213 |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2888
diff
changeset
|
214 throw OrthancException(ErrorCode_NetworkProtocol, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
215 "DicomUserConnection - " + command + |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
216 " to AET \"" + aet + "\": " + info); |
0 | 217 } |
218 } | |
219 | |
220 void DicomUserConnection::PImpl::CheckIsOpen() const | |
221 { | |
222 if (!IsOpen()) | |
223 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2888
diff
changeset
|
224 throw OrthancException(ErrorCode_NetworkProtocol, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2888
diff
changeset
|
225 "DicomUserConnection: First open the connection"); |
0 | 226 } |
227 } | |
228 | |
229 | |
230 void DicomUserConnection::CheckIsOpen() const | |
231 { | |
232 pimpl_->CheckIsOpen(); | |
233 } | |
234 | |
235 | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
236 static void RegisterStorageSOPClass(T_ASC_Parameters* params, |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
237 unsigned int& presentationContextId, |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
238 const std::string& sopClass, |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
239 const char* asPreferred[], |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
240 std::vector<const char*>& asFallback, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
241 const std::string& aet) |
0 | 242 { |
3819
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
243 // Presentation context IDs must be odd numbers, hence the |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
244 // increments by 2: |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
245 // http://dicom.nema.org/medical/dicom/2019e/output/chtml/part08/sect_9.3.2.2.html |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
246 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
247 Check(ASC_addPresentationContext(params, presentationContextId, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
248 sopClass.c_str(), asPreferred, 1), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
249 aet, "initializing"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
250 presentationContextId += 2; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
251 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
252 if (asFallback.size() > 0) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
253 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
254 Check(ASC_addPresentationContext(params, presentationContextId, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
255 sopClass.c_str(), &asFallback[0], asFallback.size()), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
256 aet, "initializing"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
257 presentationContextId += 2; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
258 } |
0 | 259 } |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
260 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
261 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
262 void DicomUserConnection::SetupPresentationContexts(Mode mode, |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
263 const std::string& preferredTransferSyntax) |
0 | 264 { |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
265 // Flatten an array with the preferred transfer syntax |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
266 const char* asPreferred[1] = { preferredTransferSyntax.c_str() }; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
267 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
268 // Setup the fallback transfer syntaxes |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
269 std::set<std::string> fallbackSyntaxes; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
270 fallbackSyntaxes.insert(UID_LittleEndianExplicitTransferSyntax); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
271 fallbackSyntaxes.insert(UID_BigEndianExplicitTransferSyntax); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
272 fallbackSyntaxes.insert(UID_LittleEndianImplicitTransferSyntax); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
273 fallbackSyntaxes.erase(preferredTransferSyntax); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
274 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
275 // Flatten an array with the fallback transfer syntaxes |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
276 std::vector<const char*> asFallback; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
277 asFallback.reserve(fallbackSyntaxes.size()); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
278 for (std::set<std::string>::const_iterator |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
279 it = fallbackSyntaxes.begin(); it != fallbackSyntaxes.end(); ++it) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
280 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
281 asFallback.push_back(it->c_str()); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
282 } |
0 | 283 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
284 CheckStorageSOPClassesInvariant(); |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
285 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
286 switch (mode) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
287 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
288 case Mode_Generic: |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
289 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
290 unsigned int presentationContextId = 1; |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
291 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
292 for (std::list<std::string>::const_iterator it = reservedStorageSOPClasses_.begin(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
293 it != reservedStorageSOPClasses_.end(); ++it) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
294 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
295 RegisterStorageSOPClass(pimpl_->params_, presentationContextId, |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
296 *it, asPreferred, asFallback, remoteAet_); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
297 } |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
298 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
299 for (std::set<std::string>::const_iterator it = storageSOPClasses_.begin(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
300 it != storageSOPClasses_.end(); ++it) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
301 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
302 RegisterStorageSOPClass(pimpl_->params_, presentationContextId, |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
303 *it, asPreferred, asFallback, remoteAet_); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
304 } |
0 | 305 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
306 for (std::set<std::string>::const_iterator it = defaultStorageSOPClasses_.begin(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
307 it != defaultStorageSOPClasses_.end(); ++it) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
308 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
309 RegisterStorageSOPClass(pimpl_->params_, presentationContextId, |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
310 *it, asPreferred, asFallback, remoteAet_); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
311 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
312 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
313 break; |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
314 } |
0 | 315 |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
316 case Mode_RequestStorageCommitment: |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
317 case Mode_ReportStorageCommitment: |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
318 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
319 const char* as = UID_StorageCommitmentPushModelSOPClass; |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
320 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
321 std::vector<const char*> ts; |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
322 ts.push_back(UID_LittleEndianExplicitTransferSyntax); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
323 ts.push_back(UID_LittleEndianImplicitTransferSyntax); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
324 |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
325 T_ASC_SC_ROLE role; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
326 switch (mode) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
327 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
328 case Mode_RequestStorageCommitment: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
329 role = ASC_SC_ROLE_DEFAULT; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
330 break; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
331 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
332 case Mode_ReportStorageCommitment: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
333 role = ASC_SC_ROLE_SCP; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
334 break; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
335 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
336 default: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
337 throw OrthancException(ErrorCode_InternalError); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
338 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
339 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
340 Check(ASC_addPresentationContext(pimpl_->params_, 1 /*presentationContextId*/, |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
341 as, &ts[0], ts.size(), role), |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
342 remoteAet_, "initializing"); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
343 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
344 break; |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
345 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
346 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
347 default: |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
348 throw OrthancException(ErrorCode_InternalError); |
0 | 349 } |
350 } | |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
351 |
0 | 352 |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
353 static bool IsGenericTransferSyntax(const std::string& syntax) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
354 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
355 return (syntax == UID_LittleEndianExplicitTransferSyntax || |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
356 syntax == UID_BigEndianExplicitTransferSyntax || |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
357 syntax == UID_LittleEndianImplicitTransferSyntax); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
358 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
359 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
360 |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
361 void DicomUserConnection::PImpl::Store(std::string& sopClassUidOut, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
362 std::string& sopInstanceUidOut, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
363 DcmInputStream& is, |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
364 DicomUserConnection& connection, |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
365 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
366 uint16_t moveOriginatorID) |
0 | 367 { |
368 DcmFileFormat dcmff; | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
369 Check(dcmff.read(is, EXS_Unknown, EGL_noChange, DCM_MaxReadLength), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
370 connection.remoteAet_, "C-STORE"); |
0 | 371 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
372 // Determine the storage SOP class UID for this instance |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
373 OFString sopClassUid; |
3369 | 374 if (dcmff.getDataset()->findAndGetOFString(DCM_SOPClassUID, sopClassUid).good()) |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
375 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
376 connection.AddStorageSOPClass(sopClassUid.c_str()); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
377 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
378 |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
379 // Determine whether a new presentation context must be |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
380 // negotiated, depending on the transfer syntax of this instance |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
381 DcmXfer xfer(dcmff.getDataset()->getOriginalXfer()); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
382 const std::string syntax(xfer.getXferID()); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
383 bool isGeneric = IsGenericTransferSyntax(syntax); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
384 |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
385 bool renegotiate; |
2580
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
386 |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
387 if (!IsOpen()) |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
388 { |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
389 renegotiate = true; |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
390 } |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
391 else if (isGeneric) |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
392 { |
1684
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
393 // Are we making a generic-to-specific or specific-to-generic change of |
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
394 // the transfer syntax? If this is the case, renegotiate the connection. |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
395 renegotiate = !IsGenericTransferSyntax(connection.GetPreferredTransferSyntax()); |
2580
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
396 |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
397 if (renegotiate) |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
398 { |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
399 LOG(INFO) << "Use of non-generic transfer syntax: the C-Store associated must be renegotiated"; |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
400 } |
1684
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
401 } |
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
402 else |
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
403 { |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
404 // We are using a specific transfer syntax. Renegotiate if the |
1684
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
405 // current connection does not match this transfer syntax. |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
406 renegotiate = (syntax != connection.GetPreferredTransferSyntax()); |
2580
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
407 |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
408 if (renegotiate) |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
409 { |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
410 LOG(INFO) << "Change in the transfer syntax: the C-Store associated must be renegotiated"; |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
411 } |
1684
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
412 } |
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
413 |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
414 if (renegotiate) |
1684
7dae55228b16
Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1582
diff
changeset
|
415 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
416 if (isGeneric) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
417 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
418 connection.ResetPreferredTransferSyntax(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
419 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
420 else |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
421 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
422 connection.SetPreferredTransferSyntax(syntax); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
423 } |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
424 } |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
425 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
426 if (!connection.IsOpen()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
427 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
428 connection.Open(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
429 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
430 |
0 | 431 // Figure out which SOP class and SOP instance is encapsulated in the file |
432 DIC_UI sopClass; | |
433 DIC_UI sopInstance; | |
3117 | 434 |
435 #if DCMTK_VERSION_NUMBER >= 364 | |
436 if (!DU_findSOPClassAndInstanceInDataSet(dcmff.getDataset(), sopClass, sizeof(sopClass), sopInstance, sizeof(sopInstance))) | |
437 #else | |
0 | 438 if (!DU_findSOPClassAndInstanceInDataSet(dcmff.getDataset(), sopClass, sopInstance)) |
3117 | 439 #endif |
0 | 440 { |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
441 throw OrthancException(ErrorCode_NoSopClassOrInstance, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
442 "Unable to determine the SOP class/instance for C-STORE with AET " + |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
443 connection.remoteAet_); |
0 | 444 } |
445 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
446 sopClassUidOut.assign(sopClass); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
447 sopInstanceUidOut.assign(sopInstance); |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
448 |
0 | 449 // Figure out which of the accepted presentation contexts should be used |
450 int presID = ASC_findAcceptedPresentationContextID(assoc_, sopClass); | |
451 if (presID == 0) | |
452 { | |
453 const char *modalityName = dcmSOPClassUIDToModality(sopClass); | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
454 if (modalityName == NULL) modalityName = dcmFindNameOfUID(sopClass); |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
455 if (modalityName == NULL) modalityName = "unknown SOP class"; |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
456 throw OrthancException(ErrorCode_NoPresentationContext, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
457 "Unable to determine the accepted presentation contexts for C-STORE with AET " + |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
458 connection.remoteAet_ + " (" + std::string(modalityName) + ")"); |
0 | 459 } |
460 | |
461 // Prepare the transmission of data | |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
462 T_DIMSE_C_StoreRQ request; |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
463 memset(&request, 0, sizeof(request)); |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
464 request.MessageID = assoc_->nextMsgID++; |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
465 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN); |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
466 request.Priority = DIMSE_PRIORITY_MEDIUM; |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
467 request.DataSetType = DIMSE_DATASET_PRESENT; |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
468 strncpy(request.AffectedSOPInstanceUID, sopInstance, DIC_UI_LEN); |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
469 |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
470 if (!moveOriginatorAET.empty()) |
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
471 { |
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
472 strncpy(request.MoveOriginatorApplicationEntityTitle, |
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
473 moveOriginatorAET.c_str(), DIC_AE_LEN); |
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
474 request.opts = O_STORE_MOVEORIGINATORAETITLE; |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
475 |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
476 request.MoveOriginatorID = moveOriginatorID; // The type DIC_US is an alias for uint16_t |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
477 request.opts |= O_STORE_MOVEORIGINATORID; |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
478 } |
0 | 479 |
480 // Finally conduct transmission of data | |
3700
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
481 T_DIMSE_C_StoreRSP response; |
0 | 482 DcmDataset* statusDetail = NULL; |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
483 Check(DIMSE_storeUser(assoc_, presID, &request, |
0 | 484 NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL, |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3700
diff
changeset
|
485 /*opt_blockMode*/ (dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3700
diff
changeset
|
486 /*opt_dimse_timeout*/ dimseTimeout_, |
3700
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
487 &response, &statusDetail, NULL), |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
488 connection.remoteAet_, "C-STORE"); |
0 | 489 |
490 if (statusDetail != NULL) | |
491 { | |
492 delete statusDetail; | |
493 } | |
3700
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
494 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
495 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
496 /** |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
497 * New in Orthanc 1.6.0: Deal with failures during C-STORE. |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
498 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.2.3.html#table_B.2-1 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
499 **/ |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
500 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
501 if (response.DimseStatus != 0x0000 && // Success |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
502 response.DimseStatus != 0xB000 && // Warning - Coercion of Data Elements |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
503 response.DimseStatus != 0xB007 && // Warning - Data Set does not match SOP Class |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
504 response.DimseStatus != 0xB006) // Warning - Elements Discarded |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
505 { |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
506 char buf[16]; |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
507 sprintf(buf, "%04X", response.DimseStatus); |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
508 throw OrthancException(ErrorCode_NetworkProtocol, |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
509 "C-STORE SCU to AET \"" + connection.remoteAet_ + |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
510 "\" has failed with DIMSE status 0x" + buf); |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
511 } |
0 | 512 } |
513 | |
514 | |
1366 | 515 namespace |
516 { | |
517 struct FindPayload | |
518 { | |
519 DicomFindAnswers* answers; | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
520 const char* level; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
521 bool isWorklist; |
1366 | 522 }; |
523 } | |
524 | |
525 | |
0 | 526 static void FindCallback( |
527 /* in */ | |
528 void *callbackData, | |
529 T_DIMSE_C_FindRQ *request, /* original find request */ | |
530 int responseCount, | |
531 T_DIMSE_C_FindRSP *response, /* pending response received */ | |
532 DcmDataset *responseIdentifiers /* pending response identifiers */ | |
533 ) | |
534 { | |
1366 | 535 FindPayload& payload = *reinterpret_cast<FindPayload*>(callbackData); |
0 | 536 |
537 if (responseIdentifiers != NULL) | |
538 { | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
539 if (payload.isWorklist) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
540 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
541 ParsedDicomFile answer(*responseIdentifiers); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
542 payload.answers->Add(answer); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
543 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
544 else |
1366 | 545 { |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
546 DicomMap m; |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2352
diff
changeset
|
547 FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers); |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2352
diff
changeset
|
548 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
549 if (!m.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL)) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
550 { |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
551 m.SetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL, payload.level, false); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
552 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
553 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
554 payload.answers->Add(m); |
1366 | 555 } |
0 | 556 } |
557 } | |
558 | |
1368 | 559 |
3370
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
560 static void NormalizeFindQuery(DicomMap& fixedQuery, |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
561 ResourceType level, |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
562 const DicomMap& fields) |
1368 | 563 { |
564 std::set<DicomTag> allowedTags; | |
565 | |
566 // WARNING: Do not add "break" or reorder items in this switch-case! | |
567 switch (level) | |
568 { | |
569 case ResourceType_Instance: | |
570 DicomTag::AddTagsForModule(allowedTags, DicomModule_Instance); | |
571 | |
572 case ResourceType_Series: | |
573 DicomTag::AddTagsForModule(allowedTags, DicomModule_Series); | |
574 | |
575 case ResourceType_Study: | |
576 DicomTag::AddTagsForModule(allowedTags, DicomModule_Study); | |
577 | |
578 case ResourceType_Patient: | |
579 DicomTag::AddTagsForModule(allowedTags, DicomModule_Patient); | |
580 break; | |
581 | |
582 default: | |
583 throw OrthancException(ErrorCode_InternalError); | |
584 } | |
585 | |
2005
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
586 switch (level) |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
587 { |
2005
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
588 case ResourceType_Patient: |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
589 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
590 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
591 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
592 break; |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
593 |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
594 case ResourceType_Study: |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
595 allowedTags.insert(DICOM_TAG_MODALITIES_IN_STUDY); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
596 allowedTags.insert(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
597 allowedTags.insert(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
598 allowedTags.insert(DICOM_TAG_SOP_CLASSES_IN_STUDY); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
599 break; |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
600 |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
601 case ResourceType_Series: |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
602 allowedTags.insert(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES); |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
603 break; |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
604 |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
605 default: |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
606 break; |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
607 } |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
608 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
609 allowedTags.insert(DICOM_TAG_SPECIFIC_CHARACTER_SET); |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
610 |
1368 | 611 DicomArray query(fields); |
612 for (size_t i = 0; i < query.GetSize(); i++) | |
613 { | |
614 const DicomTag& tag = query.GetElement(i).GetTag(); | |
615 if (allowedTags.find(tag) == allowedTags.end()) | |
616 { | |
1707
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
617 LOG(WARNING) << "Tag not allowed for this C-Find level, will be ignored: " << tag; |
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
618 } |
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
619 else |
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
620 { |
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
621 fixedQuery.SetValue(tag, query.GetElement(i).GetValue()); |
1368 | 622 } |
623 } | |
624 } | |
625 | |
626 | |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
627 static ParsedDicomFile* ConvertQueryFields(const DicomMap& fields, |
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
628 ModalityManufacturer manufacturer) |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
629 { |
2335 | 630 // Fix outgoing C-Find requests issue for Syngo.Via and its |
631 // solution was reported by Emsy Chan by private mail on | |
632 // 2015-06-17. According to Robert van Ommen (2015-11-30), the | |
633 // same fix is required for Agfa Impax. This was generalized for | |
634 // generic manufacturer since it seems to affect PhilipsADW, | |
635 // GEWAServer as well: | |
636 // https://bitbucket.org/sjodogne/orthanc/issues/31/ | |
2319
ae6245053bcf
made some manufacturer obsolete: MedInria (that was not used), Syngovia & AgfaImpax (replaced by GenericNoWildcardInDates) + added 'GenericNoWildcards'
amazy
parents:
2244
diff
changeset
|
637 |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
638 switch (manufacturer) |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
639 { |
2319
ae6245053bcf
made some manufacturer obsolete: MedInria (that was not used), Syngovia & AgfaImpax (replaced by GenericNoWildcardInDates) + added 'GenericNoWildcards'
amazy
parents:
2244
diff
changeset
|
640 case ModalityManufacturer_GenericNoWildcardInDates: |
2352
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2340
diff
changeset
|
641 case ModalityManufacturer_GenericNoUniversalWildcard: |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
642 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
643 std::unique_ptr<DicomMap> fix(fields.Clone()); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
644 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
645 std::set<DicomTag> tags; |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
646 fix->GetTags(tags); |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
647 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
648 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
649 { |
2335 | 650 // Replace a "*" wildcard query by an empty query ("") for |
651 // "date" or "all" value representations depending on the | |
652 // type of manufacturer. | |
2352
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2340
diff
changeset
|
653 if (manufacturer == ModalityManufacturer_GenericNoUniversalWildcard || |
2335 | 654 (manufacturer == ModalityManufacturer_GenericNoWildcardInDates && |
655 FromDcmtkBridge::LookupValueRepresentation(*it) == ValueRepresentation_Date)) | |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
656 { |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
657 const DicomValue* value = fix->TestAndGetValue(*it); |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
658 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
659 if (value != NULL && |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1707
diff
changeset
|
660 !value->IsNull() && |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1707
diff
changeset
|
661 value->GetContent() == "*") |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
662 { |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
663 fix->SetValue(*it, "", false); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
664 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
665 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
666 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
667 |
3342
63f59ad9381a
Fix issue #136 (C-Find request fails when found DICOM file does not have certain tags)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3215
diff
changeset
|
668 return new ParsedDicomFile(*fix, GetDefaultDicomEncoding(), false /* be strict */); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
669 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
670 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
671 default: |
3342
63f59ad9381a
Fix issue #136 (C-Find request fails when found DICOM file does not have certain tags)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3215
diff
changeset
|
672 return new ParsedDicomFile(fields, GetDefaultDicomEncoding(), false /* be strict */); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
673 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
674 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
675 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
676 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
677 static void ExecuteFind(DicomFindAnswers& answers, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
678 T_ASC_Association* association, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
679 DcmDataset* dataset, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
680 const char* sopClass, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
681 bool isWorklist, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
682 const char* level, |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
683 uint32_t dimseTimeout, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
684 const std::string& remoteAet) |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
685 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
686 assert(isWorklist ^ (level != NULL)); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
687 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
688 FindPayload payload; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
689 payload.answers = &answers; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
690 payload.level = level; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
691 payload.isWorklist = isWorklist; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
692 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
693 // Figure out which of the accepted presentation contexts should be used |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
694 int presID = ASC_findAcceptedPresentationContextID(association, sopClass); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
695 if (presID == 0) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
696 { |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
697 throw OrthancException(ErrorCode_DicomFindUnavailable, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
698 "Remote AET is " + remoteAet); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
699 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
700 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
701 T_DIMSE_C_FindRQ request; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
702 memset(&request, 0, sizeof(request)); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
703 request.MessageID = association->nextMsgID++; |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
704 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN); |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
705 request.Priority = DIMSE_PRIORITY_MEDIUM; |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
706 request.DataSetType = DIMSE_DATASET_PRESENT; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
707 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
708 T_DIMSE_C_FindRSP response; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
709 DcmDataset* statusDetail = NULL; |
3117 | 710 |
711 #if DCMTK_VERSION_NUMBER >= 364 | |
712 int responseCount; | |
713 #endif | |
714 | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
715 OFCondition cond = DIMSE_findUser(association, presID, &request, dataset, |
3117 | 716 #if DCMTK_VERSION_NUMBER >= 364 |
717 responseCount, | |
718 #endif | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
719 FindCallback, &payload, |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3700
diff
changeset
|
720 /*opt_blockMode*/ (dimseTimeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
721 /*opt_dimse_timeout*/ dimseTimeout, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
722 &response, &statusDetail); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
723 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
724 if (statusDetail) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
725 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
726 delete statusDetail; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
727 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
728 |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
729 Check(cond, remoteAet, "C-FIND"); |
3700
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
730 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
731 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
732 /** |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
733 * New in Orthanc 1.6.0: Deal with failures during C-FIND. |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
734 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#table_C.4-1 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
735 **/ |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
736 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
737 if (response.DimseStatus != 0x0000 && // Success |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
738 response.DimseStatus != 0xFF00 && // Pending - Matches are continuing |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
739 response.DimseStatus != 0xFF01) // Pending - Matches are continuing |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
740 { |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
741 char buf[16]; |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
742 sprintf(buf, "%04X", response.DimseStatus); |
3800
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
743 |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
744 if (response.DimseStatus == STATUS_FIND_Failed_UnableToProcess) |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
745 { |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
746 throw OrthancException(ErrorCode_NetworkProtocol, |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
747 HttpStatus_422_UnprocessableEntity, |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
748 "C-FIND SCU to AET \"" + remoteAet + |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
749 "\" has failed with DIMSE status 0x" + buf + |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
750 " (unable to process - invalid query ?)" |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
751 ); |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
752 } |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
753 else |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
754 { |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
755 throw OrthancException(ErrorCode_NetworkProtocol, |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
756 "C-FIND SCU to AET \"" + remoteAet + |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
757 "\" has failed with DIMSE status 0x" + buf); |
38b0f51781aa
improved error message when trying to execute a C-Find query that is not accepted by the remote modality
Alain Mazy <alain@mazy.be>
parents:
3799
diff
changeset
|
758 } |
3700
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
759 } |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
760 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
761 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
762 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
763 |
0 | 764 void DicomUserConnection::Find(DicomFindAnswers& result, |
1368 | 765 ResourceType level, |
3370
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
766 const DicomMap& originalFields, |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
767 bool normalize) |
0 | 768 { |
769 CheckIsOpen(); | |
770 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
771 std::unique_ptr<ParsedDicomFile> query; |
3369 | 772 |
3370
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
773 if (normalize) |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
774 { |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
775 DicomMap fields; |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
776 NormalizeFindQuery(fields, level, originalFields); |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
777 query.reset(ConvertQueryFields(fields, manufacturer_)); |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
778 } |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
779 else |
3369 | 780 { |
781 query.reset(new ParsedDicomFile(originalFields, | |
782 GetDefaultDicomEncoding(), | |
783 false /* be strict */)); | |
784 } | |
785 | |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
786 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); |
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
787 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
788 const char* clevel = NULL; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
789 const char* sopClass = NULL; |
1366 | 790 |
1368 | 791 switch (level) |
0 | 792 { |
1368 | 793 case ResourceType_Patient: |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
794 clevel = "PATIENT"; |
3369 | 795 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "PATIENT"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
796 sopClass = UID_FINDPatientRootQueryRetrieveInformationModel; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
797 break; |
0 | 798 |
1368 | 799 case ResourceType_Study: |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
800 clevel = "STUDY"; |
3369 | 801 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "STUDY"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
802 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
803 break; |
0 | 804 |
1368 | 805 case ResourceType_Series: |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
806 clevel = "SERIES"; |
3369 | 807 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "SERIES"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
808 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
809 break; |
0 | 810 |
1368 | 811 case ResourceType_Instance: |
3561
bdafff1ce443
C-Find SCU at Instance level now sets the 0008,0052 tag to IMAGE per default (was INSTANCE). Source: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/orthanc-users/FYxHXzlaQ0M/rn6d0SowAAAJ
Alain Mazy <alain@mazy.be>
parents:
3402
diff
changeset
|
812 clevel = "IMAGE"; |
bdafff1ce443
C-Find SCU at Instance level now sets the 0008,0052 tag to IMAGE per default (was INSTANCE). Source: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/orthanc-users/FYxHXzlaQ0M/rn6d0SowAAAJ
Alain Mazy <alain@mazy.be>
parents:
3402
diff
changeset
|
813 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "IMAGE"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
814 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
1368 | 815 break; |
0 | 816 |
1368 | 817 default: |
818 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
819 } | |
820 | |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
821 |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
822 const char* universal; |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
823 if (manufacturer_ == ModalityManufacturer_GE) |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
824 { |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
825 universal = "*"; |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
826 } |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
827 else |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
828 { |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
829 universal = ""; |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
830 } |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
831 |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
832 |
1368 | 833 // Add the expected tags for this query level. |
834 // WARNING: Do not reorder or add "break" in this switch-case! | |
835 switch (level) | |
836 { | |
837 case ResourceType_Instance: | |
3369 | 838 if (!dataset->tagExists(DCM_SOPInstanceUID)) |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
839 { |
3369 | 840 DU_putStringDOElement(dataset, DCM_SOPInstanceUID, universal); |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
841 } |
1368 | 842 |
843 case ResourceType_Series: | |
3369 | 844 if (!dataset->tagExists(DCM_SeriesInstanceUID)) |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
845 { |
3369 | 846 DU_putStringDOElement(dataset, DCM_SeriesInstanceUID, universal); |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
847 } |
1368 | 848 |
849 case ResourceType_Study: | |
3369 | 850 if (!dataset->tagExists(DCM_AccessionNumber)) |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
851 { |
3369 | 852 DU_putStringDOElement(dataset, DCM_AccessionNumber, universal); |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
853 } |
0 | 854 |
3369 | 855 if (!dataset->tagExists(DCM_StudyInstanceUID)) |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
856 { |
3369 | 857 DU_putStringDOElement(dataset, DCM_StudyInstanceUID, universal); |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
858 } |
0 | 859 |
1368 | 860 case ResourceType_Patient: |
3369 | 861 if (!dataset->tagExists(DCM_PatientID)) |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
862 { |
3369 | 863 DU_putStringDOElement(dataset, DCM_PatientID, universal); |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
864 } |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
865 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
866 break; |
0 | 867 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
868 default: |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
869 throw OrthancException(ErrorCode_ParameterOutOfRange); |
0 | 870 } |
871 | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
872 assert(clevel != NULL && sopClass != NULL); |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
873 ExecuteFind(result, pimpl_->assoc_, dataset, sopClass, false, clevel, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
874 pimpl_->dimseTimeout_, remoteAet_); |
0 | 875 } |
876 | |
877 | |
1366 | 878 void DicomUserConnection::MoveInternal(const std::string& targetAet, |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
879 ResourceType level, |
1366 | 880 const DicomMap& fields) |
0 | 881 { |
882 CheckIsOpen(); | |
883 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
884 std::unique_ptr<ParsedDicomFile> query(ConvertQueryFields(fields, manufacturer_)); |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
885 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
886 |
0 | 887 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel; |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
888 switch (level) |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
889 { |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
890 case ResourceType_Patient: |
3369 | 891 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "PATIENT"); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
892 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
893 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
894 case ResourceType_Study: |
3369 | 895 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "STUDY"); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
896 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
897 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
898 case ResourceType_Series: |
3369 | 899 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "SERIES"); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
900 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
901 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
902 case ResourceType_Instance: |
3561
bdafff1ce443
C-Find SCU at Instance level now sets the 0008,0052 tag to IMAGE per default (was INSTANCE). Source: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/orthanc-users/FYxHXzlaQ0M/rn6d0SowAAAJ
Alain Mazy <alain@mazy.be>
parents:
3402
diff
changeset
|
903 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "IMAGE"); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
904 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
905 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
906 default: |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
907 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
908 } |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
909 |
0 | 910 // Figure out which of the accepted presentation contexts should be used |
911 int presID = ASC_findAcceptedPresentationContextID(pimpl_->assoc_, sopClass); | |
912 if (presID == 0) | |
913 { | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
914 throw OrthancException(ErrorCode_DicomMoveUnavailable, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
915 "Remote AET is " + remoteAet_); |
0 | 916 } |
917 | |
918 T_DIMSE_C_MoveRQ request; | |
919 memset(&request, 0, sizeof(request)); | |
920 request.MessageID = pimpl_->assoc_->nextMsgID++; | |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
921 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN); |
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
922 request.Priority = DIMSE_PRIORITY_MEDIUM; |
0 | 923 request.DataSetType = DIMSE_DATASET_PRESENT; |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
924 strncpy(request.MoveDestination, targetAet.c_str(), DIC_AE_LEN); |
0 | 925 |
926 T_DIMSE_C_MoveRSP response; | |
927 DcmDataset* statusDetail = NULL; | |
928 DcmDataset* responseIdentifiers = NULL; | |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
929 OFCondition cond = DIMSE_moveUser(pimpl_->assoc_, presID, &request, dataset, |
0 | 930 NULL, NULL, |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3700
diff
changeset
|
931 /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
932 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, |
0 | 933 pimpl_->net_, NULL, NULL, |
934 &response, &statusDetail, &responseIdentifiers); | |
935 | |
936 if (statusDetail) | |
937 { | |
938 delete statusDetail; | |
939 } | |
940 | |
941 if (responseIdentifiers) | |
942 { | |
943 delete responseIdentifiers; | |
944 } | |
945 | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
946 Check(cond, remoteAet_, "C-MOVE"); |
3700
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
947 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
948 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
949 /** |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
950 * New in Orthanc 1.6.0: Deal with failures during C-MOVE. |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
951 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.2.html#table_C.4-2 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
952 **/ |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
953 |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
954 if (response.DimseStatus != 0x0000 && // Success |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
955 response.DimseStatus != 0xFF00) // Pending - Sub-operations are continuing |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
956 { |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
957 char buf[16]; |
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
958 sprintf(buf, "%04X", response.DimseStatus); |
3798
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
959 |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
960 if (response.DimseStatus == STATUS_MOVE_Failed_UnableToProcess) |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
961 { |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
962 throw OrthancException(ErrorCode_NetworkProtocol, |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
963 HttpStatus_422_UnprocessableEntity, |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
964 "C-MOVE SCU to AET \"" + remoteAet_ + |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
965 "\" has failed with DIMSE status 0x" + buf + |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
966 " (unable to process - resource not found ?)" |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
967 ); |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
968 } |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
969 else |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
970 { |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
971 throw OrthancException(ErrorCode_NetworkProtocol, |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
972 "C-MOVE SCU to AET \"" + remoteAet_ + |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
973 "\" has failed with DIMSE status 0x" + buf); |
c38b82bb6fd3
improved error message when trying to C-Move a resource that is not found
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
974 } |
3700
5cbbf14e516b
Fix issue #103 ("queries/.../retrieve" API returns HTTP code 200 even on server errors)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
975 } |
0 | 976 } |
977 | |
978 | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
979 void DicomUserConnection::ResetStorageSOPClasses() |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
980 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
981 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
982 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
983 storageSOPClasses_.clear(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
984 defaultStorageSOPClasses_.clear(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
985 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
986 // Copy the short list of storage SOP classes from DCMTK, making |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
987 // room for the 5 SOP classes reserved for C-ECHO, C-FIND, C-MOVE at (**). |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
988 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
989 std::set<std::string> uncommon; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
990 uncommon.insert(UID_BlendingSoftcopyPresentationStateStorage); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
991 uncommon.insert(UID_GrayscaleSoftcopyPresentationStateStorage); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
992 uncommon.insert(UID_ColorSoftcopyPresentationStateStorage); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
993 uncommon.insert(UID_PseudoColorSoftcopyPresentationStateStorage); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
994 uncommon.insert(UID_XAXRFGrayscaleSoftcopyPresentationStateStorage); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
995 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
996 // Add the storage syntaxes for C-STORE |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
997 for (int i = 0; i < numberOfDcmShortSCUStorageSOPClassUIDs - 1; i++) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
998 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
999 if (uncommon.find(dcmShortSCUStorageSOPClassUIDs[i]) == uncommon.end()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1000 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1001 defaultStorageSOPClasses_.insert(dcmShortSCUStorageSOPClassUIDs[i]); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1002 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1003 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1004 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1005 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1006 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1007 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1008 |
2587
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1009 void DicomUserConnection::DefaultSetup() |
0 | 1010 { |
2587
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1011 preferredTransferSyntax_ = DEFAULT_PREFERRED_TRANSFER_SYNTAX; |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1012 localAet_ = "STORESCU"; |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1013 remoteAet_ = "ANY-SCP"; |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1014 remoteHost_ = "127.0.0.1"; |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1015 remotePort_ = 104; |
519
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1016 manufacturer_ = ModalityManufacturer_Generic; |
0 | 1017 |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1018 SetTimeout(defaultTimeout_); |
0 | 1019 pimpl_->net_ = NULL; |
1020 pimpl_->params_ = NULL; | |
1021 pimpl_->assoc_ = NULL; | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1022 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1023 // SOP classes for C-ECHO, C-FIND and C-MOVE (**) |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1024 reservedStorageSOPClasses_.push_back(UID_VerificationSOPClass); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1025 reservedStorageSOPClasses_.push_back(UID_FINDPatientRootQueryRetrieveInformationModel); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1026 reservedStorageSOPClasses_.push_back(UID_FINDStudyRootQueryRetrieveInformationModel); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1027 reservedStorageSOPClasses_.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1028 reservedStorageSOPClasses_.push_back(UID_FINDModalityWorklistInformationModel); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1029 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1030 ResetStorageSOPClasses(); |
0 | 1031 } |
2587
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1032 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1033 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1034 DicomUserConnection::DicomUserConnection() : |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1035 pimpl_(new PImpl) |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1036 { |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1037 DefaultSetup(); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1038 } |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1039 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1040 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1041 DicomUserConnection::DicomUserConnection(const std::string& localAet, |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1042 const RemoteModalityParameters& remote) : |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1043 pimpl_(new PImpl) |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1044 { |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1045 DefaultSetup(); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1046 SetLocalApplicationEntityTitle(localAet); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1047 SetRemoteModality(remote); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1048 } |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
1049 |
0 | 1050 |
1051 DicomUserConnection::~DicomUserConnection() | |
1052 { | |
1053 Close(); | |
1054 } | |
1055 | |
772
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
1056 |
1427
d710ea64f0fd
Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1371
diff
changeset
|
1057 void DicomUserConnection::SetRemoteModality(const RemoteModalityParameters& parameters) |
772
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
1058 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1059 SetRemoteApplicationEntityTitle(parameters.GetApplicationEntityTitle()); |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1060 SetRemoteHost(parameters.GetHost()); |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2601
diff
changeset
|
1061 SetRemotePort(parameters.GetPortNumber()); |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1062 SetRemoteManufacturer(parameters.GetManufacturer()); |
772
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
1063 } |
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
1064 |
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
1065 |
0 | 1066 void DicomUserConnection::SetLocalApplicationEntityTitle(const std::string& aet) |
1067 { | |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1068 if (localAet_ != aet) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1069 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1070 Close(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1071 localAet_ = aet; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1072 } |
0 | 1073 } |
1074 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1075 void DicomUserConnection::SetRemoteApplicationEntityTitle(const std::string& aet) |
0 | 1076 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1077 if (remoteAet_ != aet) |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1078 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1079 Close(); |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1080 remoteAet_ = aet; |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1081 } |
0 | 1082 } |
1083 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1084 void DicomUserConnection::SetRemoteManufacturer(ModalityManufacturer manufacturer) |
519
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1085 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1086 if (manufacturer_ != manufacturer) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1087 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1088 Close(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1089 manufacturer_ = manufacturer; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1090 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1091 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1092 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1093 void DicomUserConnection::ResetPreferredTransferSyntax() |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1094 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1095 SetPreferredTransferSyntax(DEFAULT_PREFERRED_TRANSFER_SYNTAX); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1096 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1097 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1098 void DicomUserConnection::SetPreferredTransferSyntax(const std::string& preferredTransferSyntax) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1099 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1100 if (preferredTransferSyntax_ != preferredTransferSyntax) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1101 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1102 Close(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1103 preferredTransferSyntax_ = preferredTransferSyntax; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1104 } |
519
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1105 } |
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1106 |
0 | 1107 |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1108 void DicomUserConnection::SetRemoteHost(const std::string& host) |
0 | 1109 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1110 if (remoteHost_ != host) |
0 | 1111 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1112 if (host.size() > HOST_NAME_MAX - 10) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1113 { |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1114 throw OrthancException(ErrorCode_ParameterOutOfRange, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1115 "Invalid host name (too long): " + host); |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1116 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1117 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1118 Close(); |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1119 remoteHost_ = host; |
0 | 1120 } |
1121 } | |
1122 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1123 void DicomUserConnection::SetRemotePort(uint16_t port) |
0 | 1124 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1125 if (remotePort_ != port) |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1126 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1127 Close(); |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1128 remotePort_ = port; |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1129 } |
0 | 1130 } |
1131 | |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1132 void DicomUserConnection::OpenInternal(Mode mode) |
0 | 1133 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1134 if (IsOpen()) |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1135 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1136 // Don't reopen the connection |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1137 return; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1138 } |
0 | 1139 |
769
3f946e5c3802
ReusableDicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
766
diff
changeset
|
1140 LOG(INFO) << "Opening a DICOM SCU connection from AET \"" << GetLocalApplicationEntityTitle() |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1141 << "\" to AET \"" << GetRemoteApplicationEntityTitle() << "\" on host " |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1142 << GetRemoteHost() << ":" << GetRemotePort() |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1143 << " (manufacturer: " << EnumerationToString(GetRemoteManufacturer()) << ")"; |
769
3f946e5c3802
ReusableDicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
766
diff
changeset
|
1144 |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1145 Check(ASC_initializeNetwork(NET_REQUESTOR, 0, /*opt_acse_timeout*/ pimpl_->acseTimeout_, &pimpl_->net_), remoteAet_, "connecting"); |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1146 Check(ASC_createAssociationParameters(&pimpl_->params_, /*opt_maxReceivePDULength*/ ASC_DEFAULTMAXPDU), remoteAet_, "connecting"); |
0 | 1147 |
1148 // Set this application's title and the called application's title in the params | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1149 Check(ASC_setAPTitles(pimpl_->params_, localAet_.c_str(), remoteAet_.c_str(), NULL), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1150 remoteAet_, "connecting"); |
0 | 1151 |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1152 // Set the network addresses of the local and remote entities |
0 | 1153 char localHost[HOST_NAME_MAX]; |
1154 gethostname(localHost, HOST_NAME_MAX - 1); | |
1155 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1156 char remoteHostAndPort[HOST_NAME_MAX]; |
2 | 1157 |
1158 #ifdef _MSC_VER | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1159 _snprintf |
2 | 1160 #else |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1161 snprintf |
2 | 1162 #endif |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1163 (remoteHostAndPort, HOST_NAME_MAX - 1, "%s:%d", remoteHost_.c_str(), remotePort_); |
0 | 1164 |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1165 Check(ASC_setPresentationAddresses(pimpl_->params_, localHost, remoteHostAndPort), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1166 remoteAet_, "connecting"); |
0 | 1167 |
1168 // Set various options | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1169 Check(ASC_setTransportLayerType(pimpl_->params_, /*opt_secureConnection*/ false), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1170 remoteAet_, "connecting"); |
0 | 1171 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1172 SetupPresentationContexts(mode, preferredTransferSyntax_); |
0 | 1173 |
1174 // Do the association | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1175 Check(ASC_requestAssociation(pimpl_->net_, pimpl_->params_, &pimpl_->assoc_), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1176 remoteAet_, "connecting"); |
0 | 1177 |
1178 if (ASC_countAcceptedPresentationContexts(pimpl_->params_) == 0) | |
1179 { | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1180 throw OrthancException(ErrorCode_NoPresentationContext, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1181 "Unable to negotiate a presentation context with AET " + |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1182 remoteAet_); |
0 | 1183 } |
3819
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1184 |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1185 #if 0 |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1186 // Manual loop over the accepted transfer syntaxes |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1187 LST_HEAD **l = &pimpl_->params_->DULparams.acceptedPresentationContext; |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1188 if (*l != NULL) |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1189 { |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1190 DUL_PRESENTATIONCONTEXT* pc = (DUL_PRESENTATIONCONTEXT*) LST_Head(l); |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1191 LST_Position(l, (LST_NODE*)pc); |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1192 while (pc) |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1193 { |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1194 if (pc->result == ASC_P_ACCEPTANCE) |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1195 { |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1196 printf("Accepted: %d [%s] [%s]\n", pc->presentationContextID, pc->abstractSyntax, pc->acceptedTransferSyntax); |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1197 } |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1198 else |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1199 { |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1200 printf("Rejected: %d [%s]\n", pc->presentationContextID, pc->abstractSyntax); |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1201 } |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1202 pc = (DUL_PRESENTATIONCONTEXT*) LST_Next(l); |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1203 } |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1204 } |
1237bd0bbdb2
update sop class/instance uid if transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3808
diff
changeset
|
1205 #endif |
0 | 1206 } |
1207 | |
1208 void DicomUserConnection::Close() | |
1209 { | |
1210 if (pimpl_->assoc_ != NULL) | |
1211 { | |
1212 ASC_releaseAssociation(pimpl_->assoc_); | |
1213 ASC_destroyAssociation(&pimpl_->assoc_); | |
1214 pimpl_->assoc_ = NULL; | |
1215 pimpl_->params_ = NULL; | |
1216 } | |
1217 else | |
1218 { | |
1219 if (pimpl_->params_ != NULL) | |
1220 { | |
1221 ASC_destroyAssociationParameters(&pimpl_->params_); | |
1222 pimpl_->params_ = NULL; | |
1223 } | |
1224 } | |
1225 | |
1226 if (pimpl_->net_ != NULL) | |
1227 { | |
1228 ASC_dropNetwork(&pimpl_->net_); | |
1229 pimpl_->net_ = NULL; | |
1230 } | |
1231 } | |
1232 | |
1233 bool DicomUserConnection::IsOpen() const | |
1234 { | |
1235 return pimpl_->IsOpen(); | |
1236 } | |
1237 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1238 void DicomUserConnection::Store(std::string& sopClassUid /* out */, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1239 std::string& sopInstanceUid /* out */, |
3808
7f083dfae62b
new REST route: /modalities/{id}/store-straight
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3800
diff
changeset
|
1240 const void* buffer, |
1907
5011a597b6ce
Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1241 size_t size, |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
1242 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
1243 uint16_t moveOriginatorID) |
0 | 1244 { |
1245 // Prepare an input stream for the memory buffer | |
1246 DcmInputBufferStream is; | |
1247 if (size > 0) | |
1248 is.setBuffer(buffer, size); | |
1249 is.setEos(); | |
1250 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1251 pimpl_->Store(sopClassUid, sopInstanceUid, is, *this, moveOriginatorAET, moveOriginatorID); |
0 | 1252 } |
1253 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1254 void DicomUserConnection::Store(std::string& sopClassUid /* out */, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1255 std::string& sopInstanceUid /* out */, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1256 const std::string& buffer, |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
1257 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
1258 uint16_t moveOriginatorID) |
0 | 1259 { |
1260 if (buffer.size() > 0) | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1261 Store(sopClassUid, sopInstanceUid, &buffer[0], buffer.size(), |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1262 moveOriginatorAET, moveOriginatorID); |
0 | 1263 else |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1264 Store(sopClassUid, sopInstanceUid, NULL, 0, moveOriginatorAET, moveOriginatorID); |
0 | 1265 } |
1266 | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1267 void DicomUserConnection::StoreFile(std::string& sopClassUid /* out */, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1268 std::string& sopInstanceUid /* out */, |
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1269 const std::string& path, |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
1270 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
1271 uint16_t moveOriginatorID) |
0 | 1272 { |
1273 // Prepare an input stream for the file | |
1274 DcmInputFileStream is(path.c_str()); | |
3734
4fc24b69446a
triggering storage commitment scu from REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1275 pimpl_->Store(sopClassUid, sopInstanceUid, is, *this, moveOriginatorAET, moveOriginatorID); |
0 | 1276 } |
1277 | |
1278 bool DicomUserConnection::Echo() | |
1279 { | |
1280 CheckIsOpen(); | |
1281 DIC_US status; | |
1282 Check(DIMSE_echoUser(pimpl_->assoc_, pimpl_->assoc_->nextMsgID++, | |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3700
diff
changeset
|
1283 /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1284 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1285 &status, NULL), remoteAet_, "C-ECHO"); |
0 | 1286 return status == STATUS_Success; |
1287 } | |
1288 | |
1289 | |
1366 | 1290 static void TestAndCopyTag(DicomMap& result, |
1291 const DicomMap& source, | |
1292 const DicomTag& tag) | |
1293 { | |
1294 if (!source.HasTag(tag)) | |
1295 { | |
1296 throw OrthancException(ErrorCode_BadRequest); | |
1297 } | |
1298 else | |
1299 { | |
1300 result.SetValue(tag, source.GetValue(tag)); | |
1301 } | |
1302 } | |
1303 | |
1304 | |
1305 void DicomUserConnection::Move(const std::string& targetAet, | |
1998
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1306 ResourceType level, |
1366 | 1307 const DicomMap& findResult) |
0 | 1308 { |
1366 | 1309 DicomMap move; |
1310 switch (level) | |
1311 { | |
1312 case ResourceType_Patient: | |
1313 TestAndCopyTag(move, findResult, DICOM_TAG_PATIENT_ID); | |
1314 break; | |
1315 | |
1316 case ResourceType_Study: | |
1317 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID); | |
1318 break; | |
1319 | |
1320 case ResourceType_Series: | |
1321 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID); | |
1322 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID); | |
1323 break; | |
1324 | |
1325 case ResourceType_Instance: | |
1326 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID); | |
1327 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID); | |
1328 TestAndCopyTag(move, findResult, DICOM_TAG_SOP_INSTANCE_UID); | |
1329 break; | |
1330 | |
1331 default: | |
1332 throw OrthancException(ErrorCode_InternalError); | |
1333 } | |
1334 | |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1335 MoveInternal(targetAet, level, move); |
1366 | 1336 } |
1337 | |
1338 | |
1998
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1339 void DicomUserConnection::Move(const std::string& targetAet, |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1340 const DicomMap& findResult) |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1341 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1342 if (!findResult.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL)) |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1343 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1344 throw OrthancException(ErrorCode_InternalError); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1345 } |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1346 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1347 const std::string tmp = findResult.GetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL).GetContent(); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1348 ResourceType level = StringToResourceType(tmp.c_str()); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1349 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1350 Move(targetAet, level, findResult); |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1351 } |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1352 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1353 |
1366 | 1354 void DicomUserConnection::MovePatient(const std::string& targetAet, |
1355 const std::string& patientId) | |
1356 { | |
1357 DicomMap query; | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1358 query.SetValue(DICOM_TAG_PATIENT_ID, patientId, false); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1359 MoveInternal(targetAet, ResourceType_Patient, query); |
1366 | 1360 } |
1361 | |
1362 void DicomUserConnection::MoveStudy(const std::string& targetAet, | |
1363 const std::string& studyUid) | |
1364 { | |
1365 DicomMap query; | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1366 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1367 MoveInternal(targetAet, ResourceType_Study, query); |
0 | 1368 } |
1369 | |
1370 void DicomUserConnection::MoveSeries(const std::string& targetAet, | |
1371 const std::string& studyUid, | |
1372 const std::string& seriesUid) | |
1373 { | |
1366 | 1374 DicomMap query; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1375 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1376 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1377 MoveInternal(targetAet, ResourceType_Series, query); |
0 | 1378 } |
1379 | |
1380 void DicomUserConnection::MoveInstance(const std::string& targetAet, | |
1381 const std::string& studyUid, | |
1382 const std::string& seriesUid, | |
1383 const std::string& instanceUid) | |
1384 { | |
1366 | 1385 DicomMap query; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1386 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1387 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1388 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid, false); |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1389 MoveInternal(targetAet, ResourceType_Instance, query); |
0 | 1390 } |
1391 | |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1392 |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1393 void DicomUserConnection::SetTimeout(uint32_t seconds) |
0 | 1394 { |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1395 if (seconds == 0) |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1396 { |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1397 DisableTimeout(); |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1398 } |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1399 else |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1400 { |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1401 dcmConnectionTimeout.set(seconds); |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1402 pimpl_->dimseTimeout_ = seconds; |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3700
diff
changeset
|
1403 pimpl_->acseTimeout_ = seconds; // Timeout used during association negociation and ASC_releaseAssociation() |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1404 } |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1405 } |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1406 |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1407 |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1408 void DicomUserConnection::DisableTimeout() |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1409 { |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1410 /** |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1411 * Global timeout (seconds) for connecting to remote hosts. |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1412 * Default value is -1 which selects infinite timeout, i.e. blocking connect(). |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1413 */ |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1414 dcmConnectionTimeout.set(-1); |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1415 pimpl_->dimseTimeout_ = 0; |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3700
diff
changeset
|
1416 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation and ASC_releaseAssociation() |
0 | 1417 } |
1418 | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1419 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1420 void DicomUserConnection::CheckStorageSOPClassesInvariant() const |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1421 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1422 assert(storageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1423 defaultStorageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1424 reservedStorageSOPClasses_.size() <= MAXIMUM_STORAGE_SOP_CLASSES); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1425 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1426 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1427 void DicomUserConnection::AddStorageSOPClass(const char* sop) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1428 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1429 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1430 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1431 if (storageSOPClasses_.find(sop) != storageSOPClasses_.end()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1432 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1433 // This storage SOP class is already explicitly registered. Do |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1434 // nothing. |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1435 return; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1436 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1437 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1438 if (defaultStorageSOPClasses_.find(sop) != defaultStorageSOPClasses_.end()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1439 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1440 // This storage SOP class is not explicitly registered, but is |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1441 // used by default. Just register it explicitly. |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1442 defaultStorageSOPClasses_.erase(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1443 storageSOPClasses_.insert(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1444 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1445 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1446 return; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1447 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1448 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1449 // This storage SOP class is neither explicitly, nor implicitly |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1450 // registered. Close the connection and register it explicitly. |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1451 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1452 Close(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1453 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1454 if (reservedStorageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1455 storageSOPClasses_.size() >= MAXIMUM_STORAGE_SOP_CLASSES) // (*) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1456 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1457 // The maximum number of SOP classes is reached |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1458 ResetStorageSOPClasses(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1459 defaultStorageSOPClasses_.erase(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1460 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1461 else if (reservedStorageSOPClasses_.size() + storageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1462 defaultStorageSOPClasses_.size() >= MAXIMUM_STORAGE_SOP_CLASSES) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1463 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1464 // Make room in the default storage syntaxes |
1303 | 1465 assert(!defaultStorageSOPClasses_.empty()); // Necessarily true because condition (*) is false |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1466 defaultStorageSOPClasses_.erase(*defaultStorageSOPClasses_.rbegin()); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1467 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1468 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1469 // Explicitly register the new storage syntax |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1470 storageSOPClasses_.insert(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1471 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1472 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1473 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1474 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1475 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1476 void DicomUserConnection::FindWorklist(DicomFindAnswers& result, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1477 ParsedDicomFile& query) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1478 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1479 CheckIsOpen(); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1480 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1481 DcmDataset* dataset = query.GetDcmtkObject().getDataset(); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1482 const char* sopClass = UID_FINDModalityWorklistInformationModel; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1483 |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
1484 ExecuteFind(result, pimpl_->assoc_, dataset, sopClass, true, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
1485 NULL, pimpl_->dimseTimeout_, remoteAet_); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1486 } |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1487 |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1488 |
2601 | 1489 void DicomUserConnection::SetDefaultTimeout(uint32_t seconds) |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1490 { |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1491 LOG(INFO) << "Default timeout for DICOM connections if Orthanc acts as SCU (client): " |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1492 << seconds << " seconds (0 = no timeout)"; |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1493 defaultTimeout_ = seconds; |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1494 } |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1495 |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1496 |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1497 bool DicomUserConnection::IsSameAssociation(const std::string& localAet, |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1498 const RemoteModalityParameters& remote) const |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1499 { |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1500 return (localAet_ == localAet && |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1501 remoteAet_ == remote.GetApplicationEntityTitle() && |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1502 remoteHost_ == remote.GetHost() && |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2601
diff
changeset
|
1503 remotePort_ == remote.GetPortNumber() && |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1504 manufacturer_ == remote.GetManufacturer()); |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1505 } |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1506 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1507 |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1508 static void FillSopSequence(DcmDataset& dataset, |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1509 const DcmTagKey& tag, |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1510 const std::vector<std::string>& sopClassUids, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1511 const std::vector<std::string>& sopInstanceUids, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1512 const std::vector<StorageCommitmentFailureReason>& failureReasons, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1513 bool hasFailureReasons) |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1514 { |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1515 assert(sopClassUids.size() == sopInstanceUids.size() && |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1516 (hasFailureReasons ? |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1517 failureReasons.size() == sopClassUids.size() : |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1518 failureReasons.empty())); |
3635
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1519 |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1520 if (sopInstanceUids.empty()) |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1521 { |
3635
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1522 // Add an empty sequence |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1523 if (!dataset.insertEmptyElement(tag).good()) |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1524 { |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1525 throw OrthancException(ErrorCode_InternalError); |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1526 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1527 } |
3635
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1528 else |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1529 { |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1530 for (size_t i = 0; i < sopClassUids.size(); i++) |
3635
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1531 { |
3767 | 1532 std::unique_ptr<DcmItem> item(new DcmItem); |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1533 if (!item->putAndInsertString(DCM_ReferencedSOPClassUID, sopClassUids[i].c_str()).good() || |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1534 !item->putAndInsertString(DCM_ReferencedSOPInstanceUID, sopInstanceUids[i].c_str()).good() || |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1535 (hasFailureReasons && |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1536 !item->putAndInsertUint16(DCM_FailureReason, failureReasons[i]).good()) || |
3635
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1537 !dataset.insertSequenceItem(tag, item.release()).good()) |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1538 { |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1539 throw OrthancException(ErrorCode_InternalError); |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1540 } |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1541 } |
8c0ef729d5a8
StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1542 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1543 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1544 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1545 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1546 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1547 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1548 void DicomUserConnection::ReportStorageCommitment( |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1549 const std::string& transactionUid, |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1550 const std::vector<std::string>& sopClassUids, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1551 const std::vector<std::string>& sopInstanceUids, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1552 const std::vector<StorageCommitmentFailureReason>& failureReasons) |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1553 { |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1554 if (sopClassUids.size() != sopInstanceUids.size() || |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1555 sopClassUids.size() != failureReasons.size()) |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1556 { |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1557 throw OrthancException(ErrorCode_ParameterOutOfRange); |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1558 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1559 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1560 if (IsOpen()) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1561 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1562 Close(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1563 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1564 |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1565 std::vector<std::string> successSopClassUids, successSopInstanceUids, failedSopClassUids, failedSopInstanceUids; |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1566 std::vector<StorageCommitmentFailureReason> failedReasons; |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1567 |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1568 successSopClassUids.reserve(sopClassUids.size()); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1569 successSopInstanceUids.reserve(sopClassUids.size()); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1570 failedSopClassUids.reserve(sopClassUids.size()); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1571 failedSopInstanceUids.reserve(sopClassUids.size()); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1572 failedReasons.reserve(sopClassUids.size()); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1573 |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1574 for (size_t i = 0; i < sopClassUids.size(); i++) |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1575 { |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1576 switch (failureReasons[i]) |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1577 { |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1578 case StorageCommitmentFailureReason_Success: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1579 successSopClassUids.push_back(sopClassUids[i]); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1580 successSopInstanceUids.push_back(sopInstanceUids[i]); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1581 break; |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1582 |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1583 case StorageCommitmentFailureReason_ProcessingFailure: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1584 case StorageCommitmentFailureReason_NoSuchObjectInstance: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1585 case StorageCommitmentFailureReason_ResourceLimitation: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1586 case StorageCommitmentFailureReason_ReferencedSOPClassNotSupported: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1587 case StorageCommitmentFailureReason_ClassInstanceConflict: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1588 case StorageCommitmentFailureReason_DuplicateTransactionUID: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1589 failedSopClassUids.push_back(sopClassUids[i]); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1590 failedSopInstanceUids.push_back(sopInstanceUids[i]); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1591 failedReasons.push_back(failureReasons[i]); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1592 break; |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1593 |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1594 default: |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1595 { |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1596 char buf[16]; |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1597 sprintf(buf, "%04xH", failureReasons[i]); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1598 throw OrthancException(ErrorCode_ParameterOutOfRange, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1599 "Unsupported failure reason for storage commitment: " + std::string(buf)); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1600 } |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1601 } |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1602 } |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1603 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1604 try |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1605 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1606 OpenInternal(Mode_ReportStorageCommitment); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1607 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1608 /** |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1609 * N-EVENT-REPORT |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1610 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1611 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-1 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1612 * |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1613 * Status code: |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1614 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#sect_10.1.1.1.8 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1615 **/ |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1616 |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1617 /** |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1618 * Send the "EVENT_REPORT_RQ" request |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1619 **/ |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1620 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1621 LOG(INFO) << "Reporting modality \"" << remoteAet_ |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1622 << "\" about storage commitment transaction: " << transactionUid |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1623 << " (" << successSopClassUids.size() << " successes, " |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1624 << failedSopClassUids.size() << " failures)"; |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1625 const DIC_US messageId = pimpl_->assoc_->nextMsgID++; |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1626 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1627 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1628 T_DIMSE_Message message; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1629 memset(&message, 0, sizeof(message)); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1630 message.CommandField = DIMSE_N_EVENT_REPORT_RQ; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1631 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1632 T_DIMSE_N_EventReportRQ& content = message.msg.NEventReportRQ; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1633 content.MessageID = messageId; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1634 strncpy(content.AffectedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1635 strncpy(content.AffectedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1636 content.DataSetType = DIMSE_DATASET_PRESENT; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1637 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1638 DcmDataset dataset; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1639 if (!dataset.putAndInsertString(DCM_TransactionUID, transactionUid.c_str()).good()) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1640 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1641 throw OrthancException(ErrorCode_InternalError); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1642 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1643 |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1644 { |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1645 std::vector<StorageCommitmentFailureReason> empty; |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1646 FillSopSequence(dataset, DCM_ReferencedSOPSequence, successSopClassUids, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1647 successSopInstanceUids, empty, false); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1648 } |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1649 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1650 // http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1651 if (failedSopClassUids.empty()) |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1652 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1653 content.EventTypeID = 1; // "Storage Commitment Request Successful" |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1654 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1655 else |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1656 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1657 content.EventTypeID = 2; // "Storage Commitment Request Complete - Failures Exist" |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1658 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1659 // Failure reason |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1660 // http://dicom.nema.org/medical/dicom/2019a/output/chtml/part03/sect_C.14.html#sect_C.14.1.1 |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1661 FillSopSequence(dataset, DCM_FailedSOPSequence, failedSopClassUids, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1662 failedSopInstanceUids, failedReasons, true); |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1663 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1664 |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1665 int presID = ASC_findAcceptedPresentationContextID( |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1666 pimpl_->assoc_, UID_StorageCommitmentPushModelSOPClass); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1667 if (presID == 0) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1668 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1669 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1670 "Unable to send N-EVENT-REPORT request to AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1671 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1672 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1673 if (!DIMSE_sendMessageUsingMemoryData( |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1674 pimpl_->assoc_, presID, &message, NULL /* status detail */, |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1675 &dataset, NULL /* callback */, NULL /* callback context */, |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1676 NULL /* commandSet */).good()) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1677 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1678 throw OrthancException(ErrorCode_NetworkProtocol); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1679 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1680 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1681 |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1682 /** |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1683 * Read the "EVENT_REPORT_RSP" response |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1684 **/ |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1685 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1686 { |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1687 T_ASC_PresentationContextID presID = 0; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1688 T_DIMSE_Message message; |
3706
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1689 |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1690 const int timeout = pimpl_->dimseTimeout_; |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1691 if (!DIMSE_receiveCommand(pimpl_->assoc_, |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1692 (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout, |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1693 &presID, &message, NULL /* no statusDetail */).good() || |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1694 message.CommandField != DIMSE_N_EVENT_REPORT_RSP) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1695 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1696 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1697 "Unable to read N-EVENT-REPORT response from AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1698 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1699 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1700 const T_DIMSE_N_EventReportRSP& content = message.msg.NEventReportRSP; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1701 if (content.MessageIDBeingRespondedTo != messageId || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1702 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPCLASSUID) || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1703 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID) || |
3609
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1704 //(content.opts & O_NEVENTREPORT_EVENTTYPEID) || // Pedantic test - The "content.EventTypeID" is not used by Orthanc |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1705 std::string(content.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1706 std::string(content.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1707 content.DataSetType != DIMSE_DATASET_NULL) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1708 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1709 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1710 "Badly formatted N-EVENT-REPORT response from AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1711 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1712 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1713 if (content.DimseStatus != 0 /* success */) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1714 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1715 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1716 "The request cannot be handled by remote AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1717 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1718 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1719 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1720 Close(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1721 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1722 catch (OrthancException&) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1723 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1724 Close(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1725 throw; |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1726 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1727 } |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1728 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1729 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1730 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1731 void DicomUserConnection::RequestStorageCommitment( |
3611
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1732 const std::string& transactionUid, |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1733 const std::vector<std::string>& sopClassUids, |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1734 const std::vector<std::string>& sopInstanceUids) |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1735 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1736 if (sopClassUids.size() != sopInstanceUids.size()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1737 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1738 throw OrthancException(ErrorCode_ParameterOutOfRange); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1739 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1740 |
3741 | 1741 for (size_t i = 0; i < sopClassUids.size(); i++) |
1742 { | |
1743 if (sopClassUids[i].empty() || | |
1744 sopInstanceUids[i].empty()) | |
1745 { | |
1746 throw OrthancException(ErrorCode_ParameterOutOfRange, | |
1747 "The SOP class/instance UIDs cannot be empty, found: \"" + | |
1748 sopClassUids[i] + "\" / \"" + sopInstanceUids[i] + "\""); | |
1749 } | |
1750 } | |
1751 | |
3611
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1752 if (transactionUid.size() < 5 || |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1753 transactionUid.substr(0, 5) != "2.25.") |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1754 { |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1755 throw OrthancException(ErrorCode_ParameterOutOfRange); |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1756 } |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1757 |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1758 if (IsOpen()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1759 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1760 Close(); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1761 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1762 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1763 try |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1764 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1765 OpenInternal(Mode_RequestStorageCommitment); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1766 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1767 /** |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1768 * N-ACTION |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1769 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1770 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-4 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1771 * |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1772 * Status code: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1773 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#sect_10.1.1.1.8 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1774 **/ |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1775 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1776 /** |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1777 * Send the "N_ACTION_RQ" request |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1778 **/ |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1779 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1780 LOG(INFO) << "Request to modality \"" << remoteAet_ |
3611
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1781 << "\" about storage commitment for " << sopClassUids.size() |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1782 << " instances, with transaction UID: " << transactionUid; |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1783 const DIC_US messageId = pimpl_->assoc_->nextMsgID++; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1784 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1785 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1786 T_DIMSE_Message message; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1787 memset(&message, 0, sizeof(message)); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1788 message.CommandField = DIMSE_N_ACTION_RQ; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1789 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1790 T_DIMSE_N_ActionRQ& content = message.msg.NActionRQ; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1791 content.MessageID = messageId; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1792 strncpy(content.RequestedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1793 strncpy(content.RequestedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1794 content.ActionTypeID = 1; // "Request Storage Commitment" |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1795 content.DataSetType = DIMSE_DATASET_PRESENT; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1796 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1797 DcmDataset dataset; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1798 if (!dataset.putAndInsertString(DCM_TransactionUID, transactionUid.c_str()).good()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1799 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1800 throw OrthancException(ErrorCode_InternalError); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1801 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1802 |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1803 { |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1804 std::vector<StorageCommitmentFailureReason> empty; |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1805 FillSopSequence(dataset, DCM_ReferencedSOPSequence, sopClassUids, sopInstanceUids, empty, false); |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1806 } |
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1807 |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1808 int presID = ASC_findAcceptedPresentationContextID( |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1809 pimpl_->assoc_, UID_StorageCommitmentPushModelSOPClass); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1810 if (presID == 0) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1811 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1812 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
3609
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1813 "Unable to send N-ACTION request to AET: " + remoteAet_); |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1814 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1815 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1816 if (!DIMSE_sendMessageUsingMemoryData( |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1817 pimpl_->assoc_, presID, &message, NULL /* status detail */, |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1818 &dataset, NULL /* callback */, NULL /* callback context */, |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1819 NULL /* commandSet */).good()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1820 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1821 throw OrthancException(ErrorCode_NetworkProtocol); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1822 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1823 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1824 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1825 /** |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1826 * Read the "N_ACTION_RSP" response |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1827 **/ |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1828 |
3609
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1829 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1830 T_ASC_PresentationContextID presID = 0; |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1831 T_DIMSE_Message message; |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1832 |
3706
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1833 const int timeout = pimpl_->dimseTimeout_; |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1834 if (!DIMSE_receiveCommand(pimpl_->assoc_, |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1835 (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout, |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1836 &presID, &message, NULL /* no statusDetail */).good() || |
3609
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1837 message.CommandField != DIMSE_N_ACTION_RSP) |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1838 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1839 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1840 "Unable to read N-ACTION response from AET: " + remoteAet_); |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1841 } |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1842 |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1843 const T_DIMSE_N_ActionRSP& content = message.msg.NActionRSP; |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1844 if (content.MessageIDBeingRespondedTo != messageId || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1845 !(content.opts & O_NACTION_AFFECTEDSOPCLASSUID) || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1846 !(content.opts & O_NACTION_AFFECTEDSOPINSTANCEUID) || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1847 //(content.opts & O_NACTION_ACTIONTYPEID) || // Pedantic test - The "content.ActionTypeID" is not used by Orthanc |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1848 std::string(content.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1849 std::string(content.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1850 content.DataSetType != DIMSE_DATASET_NULL) |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1851 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1852 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1853 "Badly formatted N-ACTION response from AET: " + remoteAet_); |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1854 } |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1855 |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1856 if (content.DimseStatus != 0 /* success */) |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1857 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1858 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1859 "The request cannot be handled by remote AET: " + remoteAet_); |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1860 } |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1861 } |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1862 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1863 Close(); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1864 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1865 catch (OrthancException&) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1866 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1867 Close(); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1868 throw; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1869 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1870 } |
0 | 1871 } |