Mercurial > hg > orthanc
annotate Core/DicomNetworking/DicomUserConnection.cpp @ 3634:103ee029982e storage-commitment
integration default->storage-commitment
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 29 Jan 2020 08:51:31 +0100 |
parents | c1e2b91c2ab4 |
children | 8c0ef729d5a8 |
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 |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2954
diff
changeset
|
5 * Copyright (C) 2017-2019 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 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
89 #include "../DicomFormat/DicomArray.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
90 #include "../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
91 #include "../OrthancException.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
92 #include "../DicomParsing/FromDcmtkBridge.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
93 #include "../DicomParsing/ToDcmtkBridge.h" |
0 | 94 |
3369 | 95 #include <dcmtk/dcmdata/dcdeftag.h> |
96 #include <dcmtk/dcmdata/dcfilefo.h> | |
0 | 97 #include <dcmtk/dcmdata/dcistrmb.h> |
98 #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
|
99 #include <dcmtk/dcmdata/dcmetinf.h> |
0 | 100 #include <dcmtk/dcmnet/diutil.h> |
101 | |
102 #include <set> | |
103 | |
104 | |
105 #ifdef _WIN32 | |
106 /** | |
107 * "The maximum length, in bytes, of the string returned in the buffer | |
108 * pointed to by the name parameter is dependent on the namespace provider, | |
109 * but this string must be 256 bytes or less. | |
110 * http://msdn.microsoft.com/en-us/library/windows/desktop/ms738527(v=vs.85).aspx | |
111 **/ | |
2340 | 112 # define HOST_NAME_MAX 256 |
113 # include <winsock.h> | |
0 | 114 #endif |
115 | |
116 | |
918 | 117 #if !defined(HOST_NAME_MAX) && defined(_POSIX_HOST_NAME_MAX) |
890 | 118 /** |
119 * TO IMPROVE: "_POSIX_HOST_NAME_MAX is only the minimum value that | |
120 * HOST_NAME_MAX can ever have [...] Therefore you cannot allocate an | |
121 * array of size _POSIX_HOST_NAME_MAX, invoke gethostname() and expect | |
122 * that the result will fit." | |
123 * http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00128.html | |
124 **/ | |
125 #define HOST_NAME_MAX _POSIX_HOST_NAME_MAX | |
126 #endif | |
127 | |
128 | |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
129 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
|
130 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
131 /** |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
132 * "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
|
133 * 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
|
134 * 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
|
135 * limit of 128 contexts for one association." |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
136 **/ |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
137 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
|
138 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
139 |
62 | 140 namespace Orthanc |
0 | 141 { |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
142 // 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
|
143 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
|
144 |
0 | 145 struct DicomUserConnection::PImpl |
146 { | |
147 // Connection state | |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
148 uint32_t dimseTimeout_; |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
149 uint32_t acseTimeout_; |
0 | 150 T_ASC_Network* net_; |
151 T_ASC_Parameters* params_; | |
152 T_ASC_Association* assoc_; | |
153 | |
154 bool IsOpen() const | |
155 { | |
156 return assoc_ != NULL; | |
157 } | |
158 | |
159 void CheckIsOpen() const; | |
160 | |
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
|
161 void Store(DcmInputStream& is, |
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
|
162 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
|
163 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
164 uint16_t moveOriginatorID); |
0 | 165 }; |
166 | |
167 | |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
168 static void Check(const OFCondition& cond, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
169 const std::string& aet, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
170 const std::string& command) |
0 | 171 { |
172 if (cond.bad()) | |
173 { | |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
174 // Reformat the error message from DCMTK by turning multiline |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
175 // errors into a single line |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
176 |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
177 std::string s(cond.text()); |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
178 std::string info; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
179 info.reserve(s.size()); |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
180 |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
181 bool isMultiline = false; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
182 for (size_t i = 0; i < s.size(); i++) |
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 if (s[i] == '\r') |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
185 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
186 // Ignore |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
187 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
188 else if (s[i] == '\n') |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
189 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
190 if (isMultiline) |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
191 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
192 info += "; "; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
193 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
194 else |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
195 { |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
196 info += " ("; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
197 isMultiline = true; |
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 } |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
200 else |
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 info.push_back(s[i]); |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
203 } |
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 |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
206 if (isMultiline) |
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 info += ")"; |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
209 } |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
210 |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2888
diff
changeset
|
211 throw OrthancException(ErrorCode_NetworkProtocol, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
212 "DicomUserConnection - " + command + |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
213 " to AET \"" + aet + "\": " + info); |
0 | 214 } |
215 } | |
216 | |
217 void DicomUserConnection::PImpl::CheckIsOpen() const | |
218 { | |
219 if (!IsOpen()) | |
220 { | |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2888
diff
changeset
|
221 throw OrthancException(ErrorCode_NetworkProtocol, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2888
diff
changeset
|
222 "DicomUserConnection: First open the connection"); |
0 | 223 } |
224 } | |
225 | |
226 | |
227 void DicomUserConnection::CheckIsOpen() const | |
228 { | |
229 pimpl_->CheckIsOpen(); | |
230 } | |
231 | |
232 | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
233 static void RegisterStorageSOPClass(T_ASC_Parameters* params, |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
234 unsigned int& presentationContextId, |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
235 const std::string& sopClass, |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
236 const char* asPreferred[], |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
237 std::vector<const char*>& asFallback, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
238 const std::string& aet) |
0 | 239 { |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
240 Check(ASC_addPresentationContext(params, presentationContextId, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
241 sopClass.c_str(), asPreferred, 1), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
242 aet, "initializing"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
243 presentationContextId += 2; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
244 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
245 if (asFallback.size() > 0) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
246 { |
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(), &asFallback[0], asFallback.size()), |
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 } |
0 | 252 } |
763
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 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
255 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
|
256 const std::string& preferredTransferSyntax) |
0 | 257 { |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
258 // 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
|
259 const char* asPreferred[1] = { preferredTransferSyntax.c_str() }; |
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 // 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 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
|
267 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
268 // 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
274 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
|
275 } |
0 | 276 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
277 CheckStorageSOPClassesInvariant(); |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
278 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
279 switch (mode) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
280 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
281 case Mode_Generic: |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
282 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
283 unsigned int presentationContextId = 1; |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
284 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
285 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
|
286 it != reservedStorageSOPClasses_.end(); ++it) |
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 RegisterStorageSOPClass(pimpl_->params_, presentationContextId, |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
289 *it, asPreferred, asFallback, remoteAet_); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
290 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
291 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
292 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
|
293 it != storageSOPClasses_.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 } |
0 | 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 = defaultStorageSOPClasses_.begin(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
300 it != defaultStorageSOPClasses_.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 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
305 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
306 break; |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
307 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
308 |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
309 case Mode_RequestStorageCommitment: |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
310 case Mode_ReportStorageCommitment: |
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 const char* as = UID_StorageCommitmentPushModelSOPClass; |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
313 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
314 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
|
315 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
|
316 ts.push_back(UID_LittleEndianImplicitTransferSyntax); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
317 |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
318 T_ASC_SC_ROLE role; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
319 switch (mode) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
320 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
321 case Mode_RequestStorageCommitment: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
322 role = ASC_SC_ROLE_DEFAULT; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
323 break; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
324 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
325 case Mode_ReportStorageCommitment: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
326 role = ASC_SC_ROLE_SCP; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
327 break; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
328 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
329 default: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
330 throw OrthancException(ErrorCode_InternalError); |
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 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
333 Check(ASC_addPresentationContext(pimpl_->params_, 1 /*presentationContextId*/, |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
334 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
|
335 remoteAet_, "initializing"); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
336 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
337 break; |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
338 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
339 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
340 default: |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
341 throw OrthancException(ErrorCode_InternalError); |
0 | 342 } |
343 } | |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
344 |
0 | 345 |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
346 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
|
347 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
348 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
|
349 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
|
350 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
|
351 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
352 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
353 |
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
|
354 void DicomUserConnection::PImpl::Store(DcmInputStream& is, |
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
|
355 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
|
356 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
357 uint16_t moveOriginatorID) |
0 | 358 { |
359 DcmFileFormat dcmff; | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
360 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
|
361 connection.remoteAet_, "C-STORE"); |
0 | 362 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
363 // 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
|
364 OFString sopClassUid; |
3369 | 365 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
|
366 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
367 connection.AddStorageSOPClass(sopClassUid.c_str()); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
368 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
369 |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
370 // 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
|
371 // 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
|
372 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
|
373 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
|
374 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
|
375 |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
376 bool renegotiate; |
2580
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
377 |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
378 if (!IsOpen()) |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
379 { |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
380 renegotiate = true; |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
381 } |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
382 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
|
383 { |
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
|
384 // 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
|
385 // 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
|
386 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
|
387 |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
388 if (renegotiate) |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
389 { |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
390 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
|
391 } |
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
|
392 } |
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 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
|
394 { |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
395 // 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
|
396 // current connection does not match this transfer syntax. |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
397 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
|
398 |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
399 if (renegotiate) |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
400 { |
055d7d4a823f
avoid unecessary openings of DICOM connection for C-Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
401 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
|
402 } |
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
|
403 } |
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
|
404 |
2161
7219cdce7bba
spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
405 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
|
406 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
407 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
|
408 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
409 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
|
410 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
411 else |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
412 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
413 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
|
414 } |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
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 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
417 if (!connection.IsOpen()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
418 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
419 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
|
420 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
421 |
0 | 422 // Figure out which SOP class and SOP instance is encapsulated in the file |
423 DIC_UI sopClass; | |
424 DIC_UI sopInstance; | |
3117 | 425 |
426 #if DCMTK_VERSION_NUMBER >= 364 | |
427 if (!DU_findSOPClassAndInstanceInDataSet(dcmff.getDataset(), sopClass, sizeof(sopClass), sopInstance, sizeof(sopInstance))) | |
428 #else | |
0 | 429 if (!DU_findSOPClassAndInstanceInDataSet(dcmff.getDataset(), sopClass, sopInstance)) |
3117 | 430 #endif |
0 | 431 { |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
432 throw OrthancException(ErrorCode_NoSopClassOrInstance, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
433 "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
|
434 connection.remoteAet_); |
0 | 435 } |
436 | |
437 // Figure out which of the accepted presentation contexts should be used | |
438 int presID = ASC_findAcceptedPresentationContextID(assoc_, sopClass); | |
439 if (presID == 0) | |
440 { | |
441 const char *modalityName = dcmSOPClassUIDToModality(sopClass); | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
442 if (modalityName == NULL) modalityName = dcmFindNameOfUID(sopClass); |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
443 if (modalityName == NULL) modalityName = "unknown SOP class"; |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
444 throw OrthancException(ErrorCode_NoPresentationContext, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
445 "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
|
446 connection.remoteAet_ + " (" + std::string(modalityName) + ")"); |
0 | 447 } |
448 | |
449 // 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
|
450 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
|
451 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
|
452 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
|
453 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
|
454 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
|
455 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
|
456 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
|
457 |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
458 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
|
459 { |
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
460 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
|
461 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
|
462 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
|
463 |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
464 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
|
465 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
|
466 } |
0 | 467 |
468 // Finally conduct transmission of data | |
469 T_DIMSE_C_StoreRSP rsp; | |
470 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
|
471 Check(DIMSE_storeUser(assoc_, presID, &request, |
0 | 472 NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL, |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
473 /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
474 &rsp, &statusDetail, NULL), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
475 connection.remoteAet_, "C-STORE"); |
0 | 476 |
477 if (statusDetail != NULL) | |
478 { | |
479 delete statusDetail; | |
480 } | |
481 } | |
482 | |
483 | |
1366 | 484 namespace |
485 { | |
486 struct FindPayload | |
487 { | |
488 DicomFindAnswers* answers; | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
489 const char* level; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
490 bool isWorklist; |
1366 | 491 }; |
492 } | |
493 | |
494 | |
0 | 495 static void FindCallback( |
496 /* in */ | |
497 void *callbackData, | |
498 T_DIMSE_C_FindRQ *request, /* original find request */ | |
499 int responseCount, | |
500 T_DIMSE_C_FindRSP *response, /* pending response received */ | |
501 DcmDataset *responseIdentifiers /* pending response identifiers */ | |
502 ) | |
503 { | |
1366 | 504 FindPayload& payload = *reinterpret_cast<FindPayload*>(callbackData); |
0 | 505 |
506 if (responseIdentifiers != NULL) | |
507 { | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
508 if (payload.isWorklist) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
509 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
510 ParsedDicomFile answer(*responseIdentifiers); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
511 payload.answers->Add(answer); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
512 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
513 else |
1366 | 514 { |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
515 DicomMap m; |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2352
diff
changeset
|
516 FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers); |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2352
diff
changeset
|
517 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
518 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
|
519 { |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
520 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
|
521 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
522 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
523 payload.answers->Add(m); |
1366 | 524 } |
0 | 525 } |
526 } | |
527 | |
1368 | 528 |
3370
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
529 static void NormalizeFindQuery(DicomMap& fixedQuery, |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
530 ResourceType level, |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
531 const DicomMap& fields) |
1368 | 532 { |
533 std::set<DicomTag> allowedTags; | |
534 | |
535 // WARNING: Do not add "break" or reorder items in this switch-case! | |
536 switch (level) | |
537 { | |
538 case ResourceType_Instance: | |
539 DicomTag::AddTagsForModule(allowedTags, DicomModule_Instance); | |
540 | |
541 case ResourceType_Series: | |
542 DicomTag::AddTagsForModule(allowedTags, DicomModule_Series); | |
543 | |
544 case ResourceType_Study: | |
545 DicomTag::AddTagsForModule(allowedTags, DicomModule_Study); | |
546 | |
547 case ResourceType_Patient: | |
548 DicomTag::AddTagsForModule(allowedTags, DicomModule_Patient); | |
549 break; | |
550 | |
551 default: | |
552 throw OrthancException(ErrorCode_InternalError); | |
553 } | |
554 | |
2005
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
555 switch (level) |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
556 { |
2005
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
557 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
|
558 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
|
559 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
|
560 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
|
561 break; |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
562 |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 break; |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
569 |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
570 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
|
571 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
|
572 break; |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
573 |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
574 default: |
9e021b2b348b
Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1998
diff
changeset
|
575 break; |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
576 } |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
577 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
578 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
|
579 |
1368 | 580 DicomArray query(fields); |
581 for (size_t i = 0; i < query.GetSize(); i++) | |
582 { | |
583 const DicomTag& tag = query.GetElement(i).GetTag(); | |
584 if (allowedTags.find(tag) == allowedTags.end()) | |
585 { | |
1707
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
586 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
|
587 } |
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
588 else |
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
589 { |
9a04ad916831
more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1684
diff
changeset
|
590 fixedQuery.SetValue(tag, query.GetElement(i).GetValue()); |
1368 | 591 } |
592 } | |
593 } | |
594 | |
595 | |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
596 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
|
597 ModalityManufacturer manufacturer) |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
598 { |
2335 | 599 // Fix outgoing C-Find requests issue for Syngo.Via and its |
600 // solution was reported by Emsy Chan by private mail on | |
601 // 2015-06-17. According to Robert van Ommen (2015-11-30), the | |
602 // same fix is required for Agfa Impax. This was generalized for | |
603 // generic manufacturer since it seems to affect PhilipsADW, | |
604 // GEWAServer as well: | |
605 // 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
|
606 |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
607 switch (manufacturer) |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
608 { |
2319
ae6245053bcf
made some manufacturer obsolete: MedInria (that was not used), Syngovia & AgfaImpax (replaced by GenericNoWildcardInDates) + added 'GenericNoWildcards'
amazy
parents:
2244
diff
changeset
|
609 case ModalityManufacturer_GenericNoWildcardInDates: |
2352
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2340
diff
changeset
|
610 case ModalityManufacturer_GenericNoUniversalWildcard: |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
611 { |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
612 std::auto_ptr<DicomMap> fix(fields.Clone()); |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
613 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
614 std::set<DicomTag> tags; |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
615 fix->GetTags(tags); |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
616 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
617 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
|
618 { |
2335 | 619 // Replace a "*" wildcard query by an empty query ("") for |
620 // "date" or "all" value representations depending on the | |
621 // type of manufacturer. | |
2352
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2340
diff
changeset
|
622 if (manufacturer == ModalityManufacturer_GenericNoUniversalWildcard || |
2335 | 623 (manufacturer == ModalityManufacturer_GenericNoWildcardInDates && |
624 FromDcmtkBridge::LookupValueRepresentation(*it) == ValueRepresentation_Date)) | |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
625 { |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
626 const DicomValue* value = fix->TestAndGetValue(*it); |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
627 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
628 if (value != NULL && |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1707
diff
changeset
|
629 !value->IsNull() && |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1707
diff
changeset
|
630 value->GetContent() == "*") |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
631 { |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
632 fix->SetValue(*it, "", false); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
633 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
634 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
635 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
636 |
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
|
637 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
|
638 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
639 |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
640 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
|
641 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
|
642 } |
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
643 } |
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 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
646 static void ExecuteFind(DicomFindAnswers& answers, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
647 T_ASC_Association* association, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
648 DcmDataset* dataset, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
649 const char* sopClass, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
650 bool isWorklist, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
651 const char* level, |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
652 uint32_t dimseTimeout, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
653 const std::string& remoteAet) |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
654 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
655 assert(isWorklist ^ (level != NULL)); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
656 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
657 FindPayload payload; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
658 payload.answers = &answers; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
659 payload.level = level; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
660 payload.isWorklist = isWorklist; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
661 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
662 // 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
|
663 int presID = ASC_findAcceptedPresentationContextID(association, sopClass); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
664 if (presID == 0) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
665 { |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
666 throw OrthancException(ErrorCode_DicomFindUnavailable, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
667 "Remote AET is " + remoteAet); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
668 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
669 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
670 T_DIMSE_C_FindRQ request; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
671 memset(&request, 0, sizeof(request)); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
672 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
|
673 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
|
674 request.Priority = DIMSE_PRIORITY_MEDIUM; |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
675 request.DataSetType = DIMSE_DATASET_PRESENT; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
676 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
677 T_DIMSE_C_FindRSP response; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
678 DcmDataset* statusDetail = NULL; |
3117 | 679 |
680 #if DCMTK_VERSION_NUMBER >= 364 | |
681 int responseCount; | |
682 #endif | |
683 | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
684 OFCondition cond = DIMSE_findUser(association, presID, &request, dataset, |
3117 | 685 #if DCMTK_VERSION_NUMBER >= 364 |
686 responseCount, | |
687 #endif | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
688 FindCallback, &payload, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
689 /*opt_blockMode*/ DIMSE_BLOCKING, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
690 /*opt_dimse_timeout*/ dimseTimeout, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
691 &response, &statusDetail); |
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 if (statusDetail) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
694 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
695 delete statusDetail; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
696 } |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
697 |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
698 Check(cond, remoteAet, "C-FIND"); |
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 |
0 | 702 void DicomUserConnection::Find(DicomFindAnswers& result, |
1368 | 703 ResourceType level, |
3370
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
704 const DicomMap& originalFields, |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
705 bool normalize) |
0 | 706 { |
707 CheckIsOpen(); | |
708 | |
3369 | 709 std::auto_ptr<ParsedDicomFile> query; |
710 | |
3370
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
711 if (normalize) |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
712 { |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
713 DicomMap fields; |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
714 NormalizeFindQuery(fields, level, originalFields); |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
715 query.reset(ConvertQueryFields(fields, manufacturer_)); |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
716 } |
872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3369
diff
changeset
|
717 else |
3369 | 718 { |
719 query.reset(new ParsedDicomFile(originalFields, | |
720 GetDefaultDicomEncoding(), | |
721 false /* be strict */)); | |
722 } | |
723 | |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
724 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); |
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
725 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
726 const char* clevel = NULL; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
727 const char* sopClass = NULL; |
1366 | 728 |
1368 | 729 switch (level) |
0 | 730 { |
1368 | 731 case ResourceType_Patient: |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
732 clevel = "PATIENT"; |
3369 | 733 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "PATIENT"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
734 sopClass = UID_FINDPatientRootQueryRetrieveInformationModel; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
735 break; |
0 | 736 |
1368 | 737 case ResourceType_Study: |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
738 clevel = "STUDY"; |
3369 | 739 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "STUDY"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
740 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
741 break; |
0 | 742 |
1368 | 743 case ResourceType_Series: |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
744 clevel = "SERIES"; |
3369 | 745 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "SERIES"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
746 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
747 break; |
0 | 748 |
1368 | 749 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
|
750 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
|
751 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "IMAGE"); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
752 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
1368 | 753 break; |
0 | 754 |
1368 | 755 default: |
756 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
757 } | |
758 | |
2888
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
759 |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
760 const char* universal; |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
761 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
|
762 { |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
763 universal = "*"; |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
764 } |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
765 else |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
766 { |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
767 universal = ""; |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
768 } |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
769 |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
770 |
1368 | 771 // Add the expected tags for this query level. |
772 // WARNING: Do not reorder or add "break" in this switch-case! | |
773 switch (level) | |
774 { | |
775 case ResourceType_Instance: | |
3369 | 776 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
|
777 { |
3369 | 778 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
|
779 } |
1368 | 780 |
781 case ResourceType_Series: | |
3369 | 782 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
|
783 { |
3369 | 784 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
|
785 } |
1368 | 786 |
787 case ResourceType_Study: | |
3369 | 788 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
|
789 { |
3369 | 790 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
|
791 } |
0 | 792 |
3369 | 793 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
|
794 { |
3369 | 795 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
|
796 } |
0 | 797 |
1368 | 798 case ResourceType_Patient: |
3369 | 799 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
|
800 { |
3369 | 801 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
|
802 } |
61a5667f37d9
New modality manufacturer: "GE" for GE Healthcare EA and AW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
803 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
804 break; |
0 | 805 |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
806 default: |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
807 throw OrthancException(ErrorCode_ParameterOutOfRange); |
0 | 808 } |
809 | |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
810 assert(clevel != NULL && sopClass != NULL); |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
811 ExecuteFind(result, pimpl_->assoc_, dataset, sopClass, false, clevel, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
812 pimpl_->dimseTimeout_, remoteAet_); |
0 | 813 } |
814 | |
815 | |
1366 | 816 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
|
817 ResourceType level, |
1366 | 818 const DicomMap& fields) |
0 | 819 { |
820 CheckIsOpen(); | |
821 | |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
822 std::auto_ptr<ParsedDicomFile> query(ConvertQueryFields(fields, manufacturer_)); |
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
823 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); |
1429
7366a0bdda6a
attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
824 |
0 | 825 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel; |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
826 switch (level) |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
827 { |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
828 case ResourceType_Patient: |
3369 | 829 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
|
830 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
831 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
832 case ResourceType_Study: |
3369 | 833 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
|
834 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
835 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
836 case ResourceType_Series: |
3369 | 837 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
|
838 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
839 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
840 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
|
841 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
|
842 break; |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
843 |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
844 default: |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
845 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
846 } |
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
847 |
0 | 848 // Figure out which of the accepted presentation contexts should be used |
849 int presID = ASC_findAcceptedPresentationContextID(pimpl_->assoc_, sopClass); | |
850 if (presID == 0) | |
851 { | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
852 throw OrthancException(ErrorCode_DicomMoveUnavailable, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
853 "Remote AET is " + remoteAet_); |
0 | 854 } |
855 | |
856 T_DIMSE_C_MoveRQ request; | |
857 memset(&request, 0, sizeof(request)); | |
858 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
|
859 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
|
860 request.Priority = DIMSE_PRIORITY_MEDIUM; |
0 | 861 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
|
862 strncpy(request.MoveDestination, targetAet.c_str(), DIC_AE_LEN); |
0 | 863 |
864 T_DIMSE_C_MoveRSP response; | |
865 DcmDataset* statusDetail = NULL; | |
866 DcmDataset* responseIdentifiers = NULL; | |
2202
9b373b7d6713
Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2161
diff
changeset
|
867 OFCondition cond = DIMSE_moveUser(pimpl_->assoc_, presID, &request, dataset, |
0 | 868 NULL, NULL, |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
869 /*opt_blockMode*/ DIMSE_BLOCKING, |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
870 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, |
0 | 871 pimpl_->net_, NULL, NULL, |
872 &response, &statusDetail, &responseIdentifiers); | |
873 | |
874 if (statusDetail) | |
875 { | |
876 delete statusDetail; | |
877 } | |
878 | |
879 if (responseIdentifiers) | |
880 { | |
881 delete responseIdentifiers; | |
882 } | |
883 | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
884 Check(cond, remoteAet_, "C-MOVE"); |
0 | 885 } |
886 | |
887 | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
888 void DicomUserConnection::ResetStorageSOPClasses() |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
889 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
890 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
891 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
892 storageSOPClasses_.clear(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
893 defaultStorageSOPClasses_.clear(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
894 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
895 // 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
|
896 // 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
|
897 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
898 std::set<std::string> uncommon; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
899 uncommon.insert(UID_BlendingSoftcopyPresentationStateStorage); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
900 uncommon.insert(UID_GrayscaleSoftcopyPresentationStateStorage); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
901 uncommon.insert(UID_ColorSoftcopyPresentationStateStorage); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
902 uncommon.insert(UID_PseudoColorSoftcopyPresentationStateStorage); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
903 uncommon.insert(UID_XAXRFGrayscaleSoftcopyPresentationStateStorage); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
904 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
905 // Add the storage syntaxes for C-STORE |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
906 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
|
907 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
908 if (uncommon.find(dcmShortSCUStorageSOPClassUIDs[i]) == uncommon.end()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
909 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
910 defaultStorageSOPClasses_.insert(dcmShortSCUStorageSOPClassUIDs[i]); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
911 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
912 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
913 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
914 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
915 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
916 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
917 |
2587
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
918 void DicomUserConnection::DefaultSetup() |
0 | 919 { |
2587
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
920 preferredTransferSyntax_ = DEFAULT_PREFERRED_TRANSFER_SYNTAX; |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
921 localAet_ = "STORESCU"; |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
922 remoteAet_ = "ANY-SCP"; |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
923 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
|
924 remotePort_ = 104; |
519
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
925 manufacturer_ = ModalityManufacturer_Generic; |
0 | 926 |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
927 SetTimeout(defaultTimeout_); |
0 | 928 pimpl_->net_ = NULL; |
929 pimpl_->params_ = NULL; | |
930 pimpl_->assoc_ = NULL; | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
931 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
932 // 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
|
933 reservedStorageSOPClasses_.push_back(UID_VerificationSOPClass); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
934 reservedStorageSOPClasses_.push_back(UID_FINDPatientRootQueryRetrieveInformationModel); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
935 reservedStorageSOPClasses_.push_back(UID_FINDStudyRootQueryRetrieveInformationModel); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
936 reservedStorageSOPClasses_.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
937 reservedStorageSOPClasses_.push_back(UID_FINDModalityWorklistInformationModel); |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
938 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
939 ResetStorageSOPClasses(); |
0 | 940 } |
2587
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
941 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
942 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
943 DicomUserConnection::DicomUserConnection() : |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
944 pimpl_(new PImpl) |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
945 { |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
946 DefaultSetup(); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
947 } |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
948 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
949 |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
950 DicomUserConnection::DicomUserConnection(const std::string& localAet, |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
951 const RemoteModalityParameters& remote) : |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
952 pimpl_(new PImpl) |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
953 { |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
954 DefaultSetup(); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
955 SetLocalApplicationEntityTitle(localAet); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
956 SetRemoteModality(remote); |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
957 } |
bf14b037731f
new constructor for DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2580
diff
changeset
|
958 |
0 | 959 |
960 DicomUserConnection::~DicomUserConnection() | |
961 { | |
962 Close(); | |
963 } | |
964 | |
772
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
965 |
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
|
966 void DicomUserConnection::SetRemoteModality(const RemoteModalityParameters& parameters) |
772
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
967 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
968 SetRemoteApplicationEntityTitle(parameters.GetApplicationEntityTitle()); |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
969 SetRemoteHost(parameters.GetHost()); |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2601
diff
changeset
|
970 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
|
971 SetRemoteManufacturer(parameters.GetManufacturer()); |
772
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
972 } |
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
973 |
31cc399c7762
RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
769
diff
changeset
|
974 |
0 | 975 void DicomUserConnection::SetLocalApplicationEntityTitle(const std::string& aet) |
976 { | |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
977 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
|
978 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
979 Close(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
980 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
|
981 } |
0 | 982 } |
983 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
984 void DicomUserConnection::SetRemoteApplicationEntityTitle(const std::string& aet) |
0 | 985 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
986 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
|
987 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
988 Close(); |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
989 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
|
990 } |
0 | 991 } |
992 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
993 void DicomUserConnection::SetRemoteManufacturer(ModalityManufacturer manufacturer) |
519
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
994 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
995 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
|
996 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
997 Close(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
998 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
|
999 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1000 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1001 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1002 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
|
1003 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1004 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
|
1005 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1006 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1007 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
|
1008 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1009 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
|
1010 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1011 Close(); |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1012 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
|
1013 } |
519
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1014 } |
1b2cdc855bd3
Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
1015 |
0 | 1016 |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1017 void DicomUserConnection::SetRemoteHost(const std::string& host) |
0 | 1018 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1019 if (remoteHost_ != host) |
0 | 1020 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1021 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
|
1022 { |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1023 throw OrthancException(ErrorCode_ParameterOutOfRange, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1024 "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
|
1025 } |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1026 |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1027 Close(); |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1028 remoteHost_ = host; |
0 | 1029 } |
1030 } | |
1031 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1032 void DicomUserConnection::SetRemotePort(uint16_t port) |
0 | 1033 { |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1034 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
|
1035 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1036 Close(); |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1037 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
|
1038 } |
0 | 1039 } |
1040 | |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1041 void DicomUserConnection::OpenInternal(Mode mode) |
0 | 1042 { |
662
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1043 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
|
1044 { |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1045 // 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
|
1046 return; |
70161eb45b5c
orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
657
diff
changeset
|
1047 } |
0 | 1048 |
769
3f946e5c3802
ReusableDicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
766
diff
changeset
|
1049 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
|
1050 << "\" 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
|
1051 << GetRemoteHost() << ":" << GetRemotePort() |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1052 << " (manufacturer: " << EnumerationToString(GetRemoteManufacturer()) << ")"; |
769
3f946e5c3802
ReusableDicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
766
diff
changeset
|
1053 |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1054 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
|
1055 Check(ASC_createAssociationParameters(&pimpl_->params_, /*opt_maxReceivePDULength*/ ASC_DEFAULTMAXPDU), remoteAet_, "connecting"); |
0 | 1056 |
1057 // 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
|
1058 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
|
1059 remoteAet_, "connecting"); |
0 | 1060 |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1061 // Set the network addresses of the local and remote entities |
0 | 1062 char localHost[HOST_NAME_MAX]; |
1063 gethostname(localHost, HOST_NAME_MAX - 1); | |
1064 | |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1065 char remoteHostAndPort[HOST_NAME_MAX]; |
2 | 1066 |
1067 #ifdef _MSC_VER | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1068 _snprintf |
2 | 1069 #else |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1070 snprintf |
2 | 1071 #endif |
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1186
diff
changeset
|
1072 (remoteHostAndPort, HOST_NAME_MAX - 1, "%s:%d", remoteHost_.c_str(), remotePort_); |
0 | 1073 |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1074 Check(ASC_setPresentationAddresses(pimpl_->params_, localHost, remoteHostAndPort), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1075 remoteAet_, "connecting"); |
0 | 1076 |
1077 // Set various options | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1078 Check(ASC_setTransportLayerType(pimpl_->params_, /*opt_secureConnection*/ false), |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1079 remoteAet_, "connecting"); |
0 | 1080 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1081 SetupPresentationContexts(mode, preferredTransferSyntax_); |
0 | 1082 |
1083 // Do the association | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1084 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
|
1085 remoteAet_, "connecting"); |
0 | 1086 |
1087 if (ASC_countAcceptedPresentationContexts(pimpl_->params_) == 0) | |
1088 { | |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1089 throw OrthancException(ErrorCode_NoPresentationContext, |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1090 "Unable to negotiate a presentation context with AET " + |
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1091 remoteAet_); |
0 | 1092 } |
1093 } | |
1094 | |
1095 void DicomUserConnection::Close() | |
1096 { | |
1097 if (pimpl_->assoc_ != NULL) | |
1098 { | |
1099 ASC_releaseAssociation(pimpl_->assoc_); | |
1100 ASC_destroyAssociation(&pimpl_->assoc_); | |
1101 pimpl_->assoc_ = NULL; | |
1102 pimpl_->params_ = NULL; | |
1103 } | |
1104 else | |
1105 { | |
1106 if (pimpl_->params_ != NULL) | |
1107 { | |
1108 ASC_destroyAssociationParameters(&pimpl_->params_); | |
1109 pimpl_->params_ = NULL; | |
1110 } | |
1111 } | |
1112 | |
1113 if (pimpl_->net_ != NULL) | |
1114 { | |
1115 ASC_dropNetwork(&pimpl_->net_); | |
1116 pimpl_->net_ = NULL; | |
1117 } | |
1118 } | |
1119 | |
1120 bool DicomUserConnection::IsOpen() const | |
1121 { | |
1122 return pimpl_->IsOpen(); | |
1123 } | |
1124 | |
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
|
1125 void DicomUserConnection::Store(const char* buffer, |
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
|
1126 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
|
1127 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
1128 uint16_t moveOriginatorID) |
0 | 1129 { |
1130 // Prepare an input stream for the memory buffer | |
1131 DcmInputBufferStream is; | |
1132 if (size > 0) | |
1133 is.setBuffer(buffer, size); | |
1134 is.setEos(); | |
1135 | |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
1136 pimpl_->Store(is, *this, moveOriginatorAET, moveOriginatorID); |
0 | 1137 } |
1138 | |
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
|
1139 void DicomUserConnection::Store(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
|
1140 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
1141 uint16_t moveOriginatorID) |
0 | 1142 { |
1143 if (buffer.size() > 0) | |
3402
cf31b5bacce3
removing unneeded casts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3370
diff
changeset
|
1144 Store(&buffer[0], buffer.size(), moveOriginatorAET, moveOriginatorID); |
0 | 1145 else |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
1146 Store(NULL, 0, moveOriginatorAET, moveOriginatorID); |
0 | 1147 } |
1148 | |
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
|
1149 void DicomUserConnection::StoreFile(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
|
1150 const std::string& moveOriginatorAET, |
1997
f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1929
diff
changeset
|
1151 uint16_t moveOriginatorID) |
0 | 1152 { |
1153 // Prepare an input stream for the file | |
1154 DcmInputFileStream is(path.c_str()); | |
2222
21713ce8717b
Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2202
diff
changeset
|
1155 pimpl_->Store(is, *this, moveOriginatorAET, moveOriginatorID); |
0 | 1156 } |
1157 | |
1158 bool DicomUserConnection::Echo() | |
1159 { | |
1160 CheckIsOpen(); | |
1161 DIC_US status; | |
1162 Check(DIMSE_echoUser(pimpl_->assoc_, pimpl_->assoc_->nextMsgID++, | |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1163 /*opt_blockMode*/ DIMSE_BLOCKING, |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1164 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, |
3215
4924972bce77
more verbose errors in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3208
diff
changeset
|
1165 &status, NULL), remoteAet_, "C-ECHO"); |
0 | 1166 return status == STATUS_Success; |
1167 } | |
1168 | |
1169 | |
1366 | 1170 static void TestAndCopyTag(DicomMap& result, |
1171 const DicomMap& source, | |
1172 const DicomTag& tag) | |
1173 { | |
1174 if (!source.HasTag(tag)) | |
1175 { | |
1176 throw OrthancException(ErrorCode_BadRequest); | |
1177 } | |
1178 else | |
1179 { | |
1180 result.SetValue(tag, source.GetValue(tag)); | |
1181 } | |
1182 } | |
1183 | |
1184 | |
1185 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
|
1186 ResourceType level, |
1366 | 1187 const DicomMap& findResult) |
0 | 1188 { |
1366 | 1189 DicomMap move; |
1190 switch (level) | |
1191 { | |
1192 case ResourceType_Patient: | |
1193 TestAndCopyTag(move, findResult, DICOM_TAG_PATIENT_ID); | |
1194 break; | |
1195 | |
1196 case ResourceType_Study: | |
1197 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID); | |
1198 break; | |
1199 | |
1200 case ResourceType_Series: | |
1201 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID); | |
1202 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID); | |
1203 break; | |
1204 | |
1205 case ResourceType_Instance: | |
1206 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID); | |
1207 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID); | |
1208 TestAndCopyTag(move, findResult, DICOM_TAG_SOP_INSTANCE_UID); | |
1209 break; | |
1210 | |
1211 default: | |
1212 throw OrthancException(ErrorCode_InternalError); | |
1213 } | |
1214 | |
1371
f528849ee9f7
DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1368
diff
changeset
|
1215 MoveInternal(targetAet, level, move); |
1366 | 1216 } |
1217 | |
1218 | |
1998
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1219 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
|
1220 const DicomMap& findResult) |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1221 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1222 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
|
1223 { |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1224 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
|
1225 } |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1226 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1227 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
|
1228 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
|
1229 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1230 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
|
1231 } |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1232 |
9b61701c35f2
New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1997
diff
changeset
|
1233 |
1366 | 1234 void DicomUserConnection::MovePatient(const std::string& targetAet, |
1235 const std::string& patientId) | |
1236 { | |
1237 DicomMap query; | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1238 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
|
1239 MoveInternal(targetAet, ResourceType_Patient, query); |
1366 | 1240 } |
1241 | |
1242 void DicomUserConnection::MoveStudy(const std::string& targetAet, | |
1243 const std::string& studyUid) | |
1244 { | |
1245 DicomMap query; | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1246 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
|
1247 MoveInternal(targetAet, ResourceType_Study, query); |
0 | 1248 } |
1249 | |
1250 void DicomUserConnection::MoveSeries(const std::string& targetAet, | |
1251 const std::string& studyUid, | |
1252 const std::string& seriesUid) | |
1253 { | |
1366 | 1254 DicomMap query; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1255 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1256 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
|
1257 MoveInternal(targetAet, ResourceType_Series, query); |
0 | 1258 } |
1259 | |
1260 void DicomUserConnection::MoveInstance(const std::string& targetAet, | |
1261 const std::string& studyUid, | |
1262 const std::string& seriesUid, | |
1263 const std::string& instanceUid) | |
1264 { | |
1366 | 1265 DicomMap query; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1266 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1267 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2006
diff
changeset
|
1268 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
|
1269 MoveInternal(targetAet, ResourceType_Instance, query); |
0 | 1270 } |
1271 | |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1272 |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1273 void DicomUserConnection::SetTimeout(uint32_t seconds) |
0 | 1274 { |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1275 if (seconds == 0) |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1276 { |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1277 DisableTimeout(); |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1278 } |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1279 else |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1280 { |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1281 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
|
1282 pimpl_->dimseTimeout_ = seconds; |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1283 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1284 } |
1186
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1285 } |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1286 |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1287 |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1288 void DicomUserConnection::DisableTimeout() |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1289 { |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1290 /** |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1291 * Global timeout (seconds) for connecting to remote hosts. |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1292 * 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
|
1293 */ |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1294 dcmConnectionTimeout.set(-1); |
b17b6bd59747
timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1017
diff
changeset
|
1295 pimpl_->dimseTimeout_ = 0; |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1296 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation |
0 | 1297 } |
1298 | |
763
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1299 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1300 void DicomUserConnection::CheckStorageSOPClassesInvariant() const |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1301 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1302 assert(storageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1303 defaultStorageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1304 reservedStorageSOPClasses_.size() <= MAXIMUM_STORAGE_SOP_CLASSES); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1305 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1306 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1307 void DicomUserConnection::AddStorageSOPClass(const char* sop) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1308 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1309 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1310 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1311 if (storageSOPClasses_.find(sop) != storageSOPClasses_.end()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1312 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1313 // 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
|
1314 // nothing. |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1315 return; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1316 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1317 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1318 if (defaultStorageSOPClasses_.find(sop) != defaultStorageSOPClasses_.end()) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1319 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1320 // 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
|
1321 // used by default. Just register it explicitly. |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1322 defaultStorageSOPClasses_.erase(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1323 storageSOPClasses_.insert(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1324 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1325 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1326 return; |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1327 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1328 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1329 // 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
|
1330 // 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
|
1331 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1332 Close(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1333 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1334 if (reservedStorageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1335 storageSOPClasses_.size() >= MAXIMUM_STORAGE_SOP_CLASSES) // (*) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1336 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1337 // 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
|
1338 ResetStorageSOPClasses(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1339 defaultStorageSOPClasses_.erase(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1340 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1341 else if (reservedStorageSOPClasses_.size() + storageSOPClasses_.size() + |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1342 defaultStorageSOPClasses_.size() >= MAXIMUM_STORAGE_SOP_CLASSES) |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1343 { |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1344 // Make room in the default storage syntaxes |
1303 | 1345 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
|
1346 defaultStorageSOPClasses_.erase(*defaultStorageSOPClasses_.rbegin()); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1347 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1348 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1349 // Explicitly register the new storage syntax |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1350 storageSOPClasses_.insert(sop); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1351 |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1352 CheckStorageSOPClassesInvariant(); |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1353 } |
b5e6d2823115
dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
1354 |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1355 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1356 void DicomUserConnection::FindWorklist(DicomFindAnswers& result, |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1357 ParsedDicomFile& query) |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1358 { |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1359 CheckIsOpen(); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1360 |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1361 DcmDataset* dataset = query.GetDcmtkObject().getDataset(); |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1362 const char* sopClass = UID_FINDModalityWorklistInformationModel; |
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1363 |
3208
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
1364 ExecuteFind(result, pimpl_->assoc_, dataset, sopClass, true, |
c4e1977e5ed7
improved logging in DicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3117
diff
changeset
|
1365 NULL, pimpl_->dimseTimeout_, remoteAet_); |
1805
f08978b1f45b
c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
1366 } |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1367 |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1368 |
2601 | 1369 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
|
1370 { |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1371 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
|
1372 << 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
|
1373 defaultTimeout_ = seconds; |
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2007
diff
changeset
|
1374 } |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1375 |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1376 |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1377 bool DicomUserConnection::IsSameAssociation(const std::string& localAet, |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1378 const RemoteModalityParameters& remote) const |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1379 { |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1380 return (localAet_ == localAet && |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1381 remoteAet_ == remote.GetApplicationEntityTitle() && |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1382 remoteHost_ == remote.GetHost() && |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2601
diff
changeset
|
1383 remotePort_ == remote.GetPortNumber() && |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1384 manufacturer_ == remote.GetManufacturer()); |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2587
diff
changeset
|
1385 } |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1386 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1387 |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1388 static void FillSopSequence(DcmDataset& dataset, |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1389 const DcmTagKey& tag, |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1390 const std::vector<std::string>& sopClassUids, |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1391 const std::vector<std::string>& sopInstanceUids, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1392 bool hasFailureReason, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1393 Uint16 failureReason) |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1394 { |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1395 for (size_t i = 0; i < sopClassUids.size(); i++) |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1396 { |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1397 std::auto_ptr<DcmItem> item(new DcmItem); |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1398 if (!item->putAndInsertString(DCM_ReferencedSOPClassUID, sopClassUids[i].c_str()).good() || |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1399 !item->putAndInsertString(DCM_ReferencedSOPInstanceUID, sopInstanceUids[i].c_str()).good() || |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1400 (hasFailureReason && |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1401 !item->putAndInsertUint16(DCM_FailureReason, failureReason).good()) || |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1402 !dataset.insertSequenceItem(tag, item.release()).good()) |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1403 { |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1404 throw OrthancException(ErrorCode_InternalError); |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1405 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1406 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1407 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1408 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1409 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1410 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1411 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1412 void DicomUserConnection::ReportStorageCommitment( |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1413 const std::string& transactionUid, |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1414 const std::vector<std::string>& successSopClassUids, |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1415 const std::vector<std::string>& successSopInstanceUids, |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1416 const std::vector<std::string>& failureSopClassUids, |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1417 const std::vector<std::string>& failureSopInstanceUids) |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1418 { |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1419 if (successSopClassUids.size() != successSopInstanceUids.size() || |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1420 failureSopClassUids.size() != failureSopInstanceUids.size()) |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1421 { |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1422 throw OrthancException(ErrorCode_ParameterOutOfRange); |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1423 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1424 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1425 if (IsOpen()) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1426 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1427 Close(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1428 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1429 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1430 try |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1431 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1432 OpenInternal(Mode_ReportStorageCommitment); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1433 |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1434 /** |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1435 * N-EVENT-REPORT |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1436 * 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
|
1437 * 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
|
1438 * |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1439 * Status code: |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1440 * 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
|
1441 **/ |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1442 |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1443 /** |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1444 * Send the "EVENT_REPORT_RQ" request |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1445 **/ |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1446 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1447 LOG(INFO) << "Reporting modality \"" << remoteAet_ |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1448 << "\" about storage commitment transaction: " << transactionUid |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1449 << " (" << successSopClassUids.size() << " successes, " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1450 << failureSopClassUids.size() << " failures)"; |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1451 const DIC_US messageId = pimpl_->assoc_->nextMsgID++; |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1452 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1453 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1454 T_DIMSE_Message message; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1455 memset(&message, 0, sizeof(message)); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1456 message.CommandField = DIMSE_N_EVENT_REPORT_RQ; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1457 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1458 T_DIMSE_N_EventReportRQ& content = message.msg.NEventReportRQ; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1459 content.MessageID = messageId; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1460 strncpy(content.AffectedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1461 strncpy(content.AffectedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1462 content.DataSetType = DIMSE_DATASET_PRESENT; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1463 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1464 DcmDataset dataset; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1465 if (!dataset.putAndInsertString(DCM_TransactionUID, transactionUid.c_str()).good()) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1466 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1467 throw OrthancException(ErrorCode_InternalError); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1468 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1469 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1470 FillSopSequence(dataset, DCM_ReferencedSOPSequence, successSopClassUids, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1471 successSopInstanceUids, false, 0); |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1472 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1473 // http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1474 if (failureSopClassUids.empty()) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1475 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1476 content.EventTypeID = 1; // "Storage Commitment Request Successful" |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1477 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1478 else |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1479 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1480 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
|
1481 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1482 // Failure reason |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1483 // http://dicom.nema.org/medical/dicom/2019a/output/chtml/part03/sect_C.14.html#sect_C.14.1.1 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1484 FillSopSequence(dataset, DCM_FailedSOPSequence, failureSopClassUids, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1485 failureSopInstanceUids, true, 0x0112 /* No such object instance == 274 */); |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1486 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1487 |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1488 int presID = ASC_findAcceptedPresentationContextID( |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1489 pimpl_->assoc_, UID_StorageCommitmentPushModelSOPClass); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1490 if (presID == 0) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1491 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1492 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1493 "Unable to send N-EVENT-REPORT request to AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1494 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1495 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1496 if (!DIMSE_sendMessageUsingMemoryData( |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1497 pimpl_->assoc_, presID, &message, NULL /* status detail */, |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1498 &dataset, NULL /* callback */, NULL /* callback context */, |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1499 NULL /* commandSet */).good()) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1500 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1501 throw OrthancException(ErrorCode_NetworkProtocol); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1502 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1503 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1504 |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1505 /** |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1506 * Read the "EVENT_REPORT_RSP" response |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1507 **/ |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1508 |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1509 { |
3607
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1510 T_ASC_PresentationContextID presID = 0; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1511 T_DIMSE_Message message; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1512 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1513 if (!DIMSE_receiveCommand(pimpl_->assoc_, DIMSE_NONBLOCKING, 1, &presID, |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1514 &message, NULL /* no statusDetail */).good() || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1515 message.CommandField != DIMSE_N_EVENT_REPORT_RSP) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1516 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1517 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1518 "Unable to read N-EVENT-REPORT response from AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1519 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1520 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1521 const T_DIMSE_N_EventReportRSP& content = message.msg.NEventReportRSP; |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1522 if (content.MessageIDBeingRespondedTo != messageId || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1523 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPCLASSUID) || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1524 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID) || |
3609
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1525 //(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
|
1526 std::string(content.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1527 std::string(content.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance || |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1528 content.DataSetType != DIMSE_DATASET_NULL) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1529 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1530 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1531 "Badly formatted N-EVENT-REPORT response from AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1532 } |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1533 |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1534 if (content.DimseStatus != 0 /* success */) |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1535 { |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1536 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1537 "The request cannot be handled by remote AET: " + remoteAet_); |
d0ecb355db33
DicomUserConnection::ReportStorageCommitment() complete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3606
diff
changeset
|
1538 } |
3606
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1539 } |
33ba63637d48
DicomUserConnection: sending N-EVENT-REPORT-RQ
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3605
diff
changeset
|
1540 |
3605
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1541 Close(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1542 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1543 catch (OrthancException&) |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1544 { |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1545 Close(); |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1546 throw; |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1547 } |
05872838ebf3
DicomUserConnection: Opening of a connection for N-EVENT-REPORT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3561
diff
changeset
|
1548 } |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1549 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1550 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1551 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1552 void DicomUserConnection::RequestStorageCommitment( |
3611
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1553 const std::string& transactionUid, |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1554 const std::vector<std::string>& sopClassUids, |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1555 const std::vector<std::string>& sopInstanceUids) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1556 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1557 if (sopClassUids.size() != sopInstanceUids.size()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1558 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1559 throw OrthancException(ErrorCode_ParameterOutOfRange); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1560 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1561 |
3611
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1562 if (transactionUid.size() < 5 || |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1563 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
|
1564 { |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1565 throw OrthancException(ErrorCode_ParameterOutOfRange); |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1566 } |
0ce9c1c6474f
test route in REST API for storage commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3610
diff
changeset
|
1567 |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1568 if (IsOpen()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1569 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1570 Close(); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1571 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1572 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1573 try |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1574 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1575 OpenInternal(Mode_RequestStorageCommitment); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1576 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1577 /** |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1578 * N-ACTION |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1579 * 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
|
1580 * 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
|
1581 * |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1582 * Status code: |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1583 * 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
|
1584 **/ |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1585 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1586 /** |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1587 * Send the "N_ACTION_RQ" request |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1588 **/ |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1589 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1590 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
|
1591 << "\" 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
|
1592 << " instances, with transaction UID: " << transactionUid; |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1593 const DIC_US messageId = pimpl_->assoc_->nextMsgID++; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1594 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1595 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1596 T_DIMSE_Message message; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1597 memset(&message, 0, sizeof(message)); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1598 message.CommandField = DIMSE_N_ACTION_RQ; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1599 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1600 T_DIMSE_N_ActionRQ& content = message.msg.NActionRQ; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1601 content.MessageID = messageId; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1602 strncpy(content.RequestedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1603 strncpy(content.RequestedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1604 content.ActionTypeID = 1; // "Request Storage Commitment" |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1605 content.DataSetType = DIMSE_DATASET_PRESENT; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1606 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1607 DcmDataset dataset; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1608 if (!dataset.putAndInsertString(DCM_TransactionUID, transactionUid.c_str()).good()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1609 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1610 throw OrthancException(ErrorCode_InternalError); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1611 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1612 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3611
diff
changeset
|
1613 FillSopSequence(dataset, DCM_ReferencedSOPSequence, sopClassUids, sopInstanceUids, false, 0); |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1614 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1615 int presID = ASC_findAcceptedPresentationContextID( |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1616 pimpl_->assoc_, UID_StorageCommitmentPushModelSOPClass); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1617 if (presID == 0) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1618 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1619 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
3609
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1620 "Unable to send N-ACTION request to AET: " + remoteAet_); |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1621 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1622 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1623 if (!DIMSE_sendMessageUsingMemoryData( |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1624 pimpl_->assoc_, presID, &message, NULL /* status detail */, |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1625 &dataset, NULL /* callback */, NULL /* callback context */, |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1626 NULL /* commandSet */).good()) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1627 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1628 throw OrthancException(ErrorCode_NetworkProtocol); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1629 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1630 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1631 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1632 /** |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1633 * Read the "N_ACTION_RSP" response |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1634 **/ |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1635 |
3609
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1636 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1637 T_ASC_PresentationContextID presID = 0; |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1638 T_DIMSE_Message message; |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1639 |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1640 if (!DIMSE_receiveCommand(pimpl_->assoc_, DIMSE_NONBLOCKING, 1, &presID, |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1641 &message, NULL /* no statusDetail */).good() || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1642 message.CommandField != DIMSE_N_ACTION_RSP) |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1643 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1644 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1645 "Unable to read N-ACTION response from AET: " + remoteAet_); |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1646 } |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1647 |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1648 const T_DIMSE_N_ActionRSP& content = message.msg.NActionRSP; |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1649 if (content.MessageIDBeingRespondedTo != messageId || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1650 !(content.opts & O_NACTION_AFFECTEDSOPCLASSUID) || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1651 !(content.opts & O_NACTION_AFFECTEDSOPINSTANCEUID) || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1652 //(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
|
1653 std::string(content.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1654 std::string(content.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance || |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1655 content.DataSetType != DIMSE_DATASET_NULL) |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1656 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1657 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1658 "Badly formatted N-ACTION response from AET: " + remoteAet_); |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1659 } |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1660 |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1661 if (content.DimseStatus != 0 /* success */) |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1662 { |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1663 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1664 "The request cannot be handled by remote AET: " + remoteAet_); |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1665 } |
f7ade98d8229
done RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3608
diff
changeset
|
1666 } |
3608
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1667 |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1668 Close(); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1669 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1670 catch (OrthancException&) |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1671 { |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1672 Close(); |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1673 throw; |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1674 } |
7ae553d9c366
created DicomUserConnection::RequestStorageCommitment()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3607
diff
changeset
|
1675 } |
0 | 1676 } |