annotate Core/DicomNetworking/DicomControlUserConnection.cpp @ 3874:2effa961f67f transcoding

forcing use of DicomAssociationParameters if creating an SCU
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Apr 2020 15:00:20 +0200
parents 09798f2b985f
children ea1d32861cfc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "../PrecompiledHeaders.h"
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "DicomControlUserConnection.h"
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
3828
3d1bb2193832 fix build on os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3826
diff changeset
37 #include "../Compatibility.h"
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
38 #include "../DicomParsing/FromDcmtkBridge.h"
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include "../Logging.h"
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include "../OrthancException.h"
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
41 #include "DicomAssociation.h"
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 #include <dcmtk/dcmdata/dcdeftag.h>
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 #include <dcmtk/dcmnet/diutil.h>
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace Orthanc
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 static void TestAndCopyTag(DicomMap& result,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 const DicomMap& source,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 const DicomTag& tag)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 if (!source.HasTag(tag))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 throw OrthancException(ErrorCode_BadRequest);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 else
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 result.SetValue(tag, source.GetValue(tag));
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 namespace
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 struct FindPayload
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 DicomFindAnswers* answers;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 const char* level;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 bool isWorklist;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 };
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 static void FindCallback(
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 /* in */
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 void *callbackData,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 T_DIMSE_C_FindRQ *request, /* original find request */
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 int responseCount,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 T_DIMSE_C_FindRSP *response, /* pending response received */
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 DcmDataset *responseIdentifiers /* pending response identifiers */
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 )
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 FindPayload& payload = *reinterpret_cast<FindPayload*>(callbackData);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 if (responseIdentifiers != NULL)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 if (payload.isWorklist)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 ParsedDicomFile answer(*responseIdentifiers);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 payload.answers->Add(answer);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 else
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 DicomMap m;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 if (!m.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 m.SetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL, payload.level, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 payload.answers->Add(m);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 static void NormalizeFindQuery(DicomMap& fixedQuery,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 ResourceType level,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 const DicomMap& fields)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 std::set<DicomTag> allowedTags;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 // WARNING: Do not add "break" or reorder items in this switch-case!
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 switch (level)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 case ResourceType_Instance:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 DicomTag::AddTagsForModule(allowedTags, DicomModule_Instance);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 case ResourceType_Series:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 DicomTag::AddTagsForModule(allowedTags, DicomModule_Series);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 case ResourceType_Study:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 DicomTag::AddTagsForModule(allowedTags, DicomModule_Study);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 case ResourceType_Patient:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 DicomTag::AddTagsForModule(allowedTags, DicomModule_Patient);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 default:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 throw OrthancException(ErrorCode_InternalError);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 switch (level)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 case ResourceType_Patient:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 case ResourceType_Study:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 allowedTags.insert(DICOM_TAG_MODALITIES_IN_STUDY);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 allowedTags.insert(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 allowedTags.insert(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 allowedTags.insert(DICOM_TAG_SOP_CLASSES_IN_STUDY);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 case ResourceType_Series:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 allowedTags.insert(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 default:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 allowedTags.insert(DICOM_TAG_SPECIFIC_CHARACTER_SET);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 DicomArray query(fields);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 for (size_t i = 0; i < query.GetSize(); i++)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 const DicomTag& tag = query.GetElement(i).GetTag();
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 if (allowedTags.find(tag) == allowedTags.end())
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 LOG(WARNING) << "Tag not allowed for this C-Find level, will be ignored: " << tag;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 else
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 fixedQuery.SetValue(tag, query.GetElement(i).GetValue());
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 static ParsedDicomFile* ConvertQueryFields(const DicomMap& fields,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 ModalityManufacturer manufacturer)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 // Fix outgoing C-Find requests issue for Syngo.Via and its
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 // solution was reported by Emsy Chan by private mail on
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 // 2015-06-17. According to Robert van Ommen (2015-11-30), the
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 // same fix is required for Agfa Impax. This was generalized for
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 // generic manufacturer since it seems to affect PhilipsADW,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 // GEWAServer as well:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 // https://bitbucket.org/sjodogne/orthanc/issues/31/
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 switch (manufacturer)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 case ModalityManufacturer_GenericNoWildcardInDates:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 case ModalityManufacturer_GenericNoUniversalWildcard:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 std::unique_ptr<DicomMap> fix(fields.Clone());
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 std::set<DicomTag> tags;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 fix->GetTags(tags);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 // Replace a "*" wildcard query by an empty query ("") for
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 // "date" or "all" value representations depending on the
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 // type of manufacturer.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 if (manufacturer == ModalityManufacturer_GenericNoUniversalWildcard ||
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 (manufacturer == ModalityManufacturer_GenericNoWildcardInDates &&
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 FromDcmtkBridge::LookupValueRepresentation(*it) == ValueRepresentation_Date))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 const DicomValue* value = fix->TestAndGetValue(*it);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 if (value != NULL &&
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 !value->IsNull() &&
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 value->GetContent() == "*")
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 fix->SetValue(*it, "", false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 return new ParsedDicomFile(*fix, GetDefaultDicomEncoding(), false /* be strict */);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 default:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 return new ParsedDicomFile(fields, GetDefaultDicomEncoding(), false /* be strict */);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 void DicomControlUserConnection::SetupPresentationContexts()
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 {
3843
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
229 assert(association_.get() != NULL);
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
230 association_->ProposeGenericPresentationContext(UID_VerificationSOPClass);
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
231 association_->ProposeGenericPresentationContext(UID_FINDPatientRootQueryRetrieveInformationModel);
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
232 association_->ProposeGenericPresentationContext(UID_FINDStudyRootQueryRetrieveInformationModel);
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
233 association_->ProposeGenericPresentationContext(UID_MOVEStudyRootQueryRetrieveInformationModel);
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
234 association_->ProposeGenericPresentationContext(UID_FINDModalityWorklistInformationModel);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 void DicomControlUserConnection::FindInternal(DicomFindAnswers& answers,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 DcmDataset* dataset,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 const char* sopClass,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 bool isWorklist,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 const char* level)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 assert(isWorklist ^ (level != NULL));
3843
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
245 assert(association_.get() != NULL);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
247 association_->Open(parameters_);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 FindPayload payload;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 payload.answers = &answers;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 payload.level = level;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 payload.isWorklist = isWorklist;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 // Figure out which of the accepted presentation contexts should be used
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 int presID = ASC_findAcceptedPresentationContextID(
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
256 &association_->GetDcmtkAssociation(), sopClass);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 if (presID == 0)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 throw OrthancException(ErrorCode_DicomFindUnavailable,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 "Remote AET is " + parameters_.GetRemoteApplicationEntityTitle());
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 T_DIMSE_C_FindRQ request;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 memset(&request, 0, sizeof(request));
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
265 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++;
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 request.Priority = DIMSE_PRIORITY_MEDIUM;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 request.DataSetType = DIMSE_DATASET_PRESENT;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 T_DIMSE_C_FindRSP response;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 DcmDataset* statusDetail = NULL;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 #if DCMTK_VERSION_NUMBER >= 364
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 int responseCount;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 #endif
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 OFCondition cond = DIMSE_findUser(
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
278 &association_->GetDcmtkAssociation(), presID, &request, dataset,
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 #if DCMTK_VERSION_NUMBER >= 364
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 responseCount,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 #endif
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 FindCallback, &payload,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 /*opt_blockMode*/ (parameters_.HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 /*opt_dimse_timeout*/ parameters_.GetTimeout(),
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 &response, &statusDetail);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 if (statusDetail)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 delete statusDetail;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 DicomAssociation::CheckCondition(cond, parameters_, "C-FIND");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 /**
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 * New in Orthanc 1.6.0: Deal with failures during C-FIND.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#table_C.4-1
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 **/
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 if (response.DimseStatus != 0x0000 && // Success
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 response.DimseStatus != 0xFF00 && // Pending - Matches are continuing
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 response.DimseStatus != 0xFF01) // Pending - Matches are continuing
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 char buf[16];
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 sprintf(buf, "%04X", response.DimseStatus);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 if (response.DimseStatus == STATUS_FIND_Failed_UnableToProcess)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 throw OrthancException(ErrorCode_NetworkProtocol,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 HttpStatus_422_UnprocessableEntity,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 "C-FIND SCU to AET \"" +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 parameters_.GetRemoteApplicationEntityTitle() +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 "\" has failed with DIMSE status 0x" + buf +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 " (unable to process - invalid query ?)");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 else
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 throw OrthancException(ErrorCode_NetworkProtocol, "C-FIND SCU to AET \"" +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 parameters_.GetRemoteApplicationEntityTitle() +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 "\" has failed with DIMSE status 0x" + buf);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 void DicomControlUserConnection::MoveInternal(const std::string& targetAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 ResourceType level,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 const DicomMap& fields)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 {
3843
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
330 assert(association_.get() != NULL);
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
331 association_->Open(parameters_);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 std::unique_ptr<ParsedDicomFile> query(
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 ConvertQueryFields(fields, parameters_.GetRemoteManufacturer()));
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 DcmDataset* dataset = query->GetDcmtkObject().getDataset();
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 switch (level)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 case ResourceType_Patient:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "PATIENT");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 case ResourceType_Study:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "STUDY");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 case ResourceType_Series:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "SERIES");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 case ResourceType_Instance:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "IMAGE");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 default:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 throw OrthancException(ErrorCode_ParameterOutOfRange);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 // Figure out which of the accepted presentation contexts should be used
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
361 int presID = ASC_findAcceptedPresentationContextID(&association_->GetDcmtkAssociation(), sopClass);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 if (presID == 0)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 throw OrthancException(ErrorCode_DicomMoveUnavailable,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 "Remote AET is " + parameters_.GetRemoteApplicationEntityTitle());
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 T_DIMSE_C_MoveRQ request;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 memset(&request, 0, sizeof(request));
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
370 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++;
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 request.Priority = DIMSE_PRIORITY_MEDIUM;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 request.DataSetType = DIMSE_DATASET_PRESENT;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 strncpy(request.MoveDestination, targetAet.c_str(), DIC_AE_LEN);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 T_DIMSE_C_MoveRSP response;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 DcmDataset* statusDetail = NULL;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 DcmDataset* responseIdentifiers = NULL;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 OFCondition cond = DIMSE_moveUser(
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
380 &association_->GetDcmtkAssociation(), presID, &request, dataset, NULL, NULL,
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 /*opt_blockMode*/ (parameters_.HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 /*opt_dimse_timeout*/ parameters_.GetTimeout(),
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
383 &association_->GetDcmtkNetwork(), NULL, NULL,
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 &response, &statusDetail, &responseIdentifiers);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 if (statusDetail)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 delete statusDetail;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 if (responseIdentifiers)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 delete responseIdentifiers;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 DicomAssociation::CheckCondition(cond, parameters_, "C-MOVE");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 /**
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 * New in Orthanc 1.6.0: Deal with failures during C-MOVE.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.2.html#table_C.4-2
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 **/
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 if (response.DimseStatus != 0x0000 && // Success
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 response.DimseStatus != 0xFF00) // Pending - Sub-operations are continuing
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 char buf[16];
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 sprintf(buf, "%04X", response.DimseStatus);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 if (response.DimseStatus == STATUS_MOVE_Failed_UnableToProcess)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 throw OrthancException(ErrorCode_NetworkProtocol,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 HttpStatus_422_UnprocessableEntity,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 "C-MOVE SCU to AET \"" +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 parameters_.GetRemoteApplicationEntityTitle() +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 "\" has failed with DIMSE status 0x" + buf +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 " (unable to process - resource not found ?)");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 else
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 throw OrthancException(ErrorCode_NetworkProtocol, "C-MOVE SCU to AET \"" +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 parameters_.GetRemoteApplicationEntityTitle() +
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 "\" has failed with DIMSE status 0x" + buf);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 DicomControlUserConnection::DicomControlUserConnection(const DicomAssociationParameters& params) :
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
430 parameters_(params),
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
431 association_(new DicomAssociation)
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 SetupPresentationContexts();
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436
3843
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
437 void DicomControlUserConnection::Close()
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
438 {
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
439 assert(association_.get() != NULL);
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
440 association_->Close();
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
441 }
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
442
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
443
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 bool DicomControlUserConnection::Echo()
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 {
3843
138d0dde41b5 end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3830
diff changeset
446 assert(association_.get() != NULL);
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
447 association_->Open(parameters_);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 DIC_US status;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 DicomAssociation::CheckCondition(
3826
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
451 DIMSE_echoUser(&association_->GetDcmtkAssociation(),
e82bd07c384e putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
452 association_->GetDcmtkAssociation().nextMsgID++,
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 /*opt_blockMode*/ (parameters_.HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 /*opt_dimse_timeout*/ parameters_.GetTimeout(),
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 &status, NULL),
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 parameters_, "C-ECHO");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 return status == STATUS_Success;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 void DicomControlUserConnection::Find(DicomFindAnswers& result,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 ResourceType level,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 const DicomMap& originalFields,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 bool normalize)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 std::unique_ptr<ParsedDicomFile> query;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 if (normalize)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 DicomMap fields;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 NormalizeFindQuery(fields, level, originalFields);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 query.reset(ConvertQueryFields(fields, parameters_.GetRemoteManufacturer()));
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 else
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 query.reset(new ParsedDicomFile(originalFields,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 GetDefaultDicomEncoding(),
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 false /* be strict */));
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 DcmDataset* dataset = query->GetDcmtkObject().getDataset();
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 const char* clevel = NULL;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 const char* sopClass = NULL;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 switch (level)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 case ResourceType_Patient:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 clevel = "PATIENT";
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "PATIENT");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 sopClass = UID_FINDPatientRootQueryRetrieveInformationModel;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 case ResourceType_Study:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 clevel = "STUDY";
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "STUDY");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501 case ResourceType_Series:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 clevel = "SERIES";
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "SERIES");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 case ResourceType_Instance:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 clevel = "IMAGE";
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, "IMAGE");
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 default:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 throw OrthancException(ErrorCode_ParameterOutOfRange);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 const char* universal;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 if (parameters_.GetRemoteManufacturer() == ModalityManufacturer_GE)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 universal = "*";
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 else
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 universal = "";
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 // Add the expected tags for this query level.
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 // WARNING: Do not reorder or add "break" in this switch-case!
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 switch (level)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 case ResourceType_Instance:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 if (!dataset->tagExists(DCM_SOPInstanceUID))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 DU_putStringDOElement(dataset, DCM_SOPInstanceUID, universal);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 case ResourceType_Series:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 if (!dataset->tagExists(DCM_SeriesInstanceUID))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 DU_putStringDOElement(dataset, DCM_SeriesInstanceUID, universal);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 case ResourceType_Study:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 if (!dataset->tagExists(DCM_AccessionNumber))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 DU_putStringDOElement(dataset, DCM_AccessionNumber, universal);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 if (!dataset->tagExists(DCM_StudyInstanceUID))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 DU_putStringDOElement(dataset, DCM_StudyInstanceUID, universal);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 case ResourceType_Patient:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 if (!dataset->tagExists(DCM_PatientID))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 DU_putStringDOElement(dataset, DCM_PatientID, universal);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 default:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 throw OrthancException(ErrorCode_ParameterOutOfRange);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 assert(clevel != NULL && sopClass != NULL);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 FindInternal(result, dataset, sopClass, false, clevel);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 void DicomControlUserConnection::Move(const std::string& targetAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 ResourceType level,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 const DicomMap& findResult)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577 DicomMap move;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 switch (level)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 case ResourceType_Patient:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 TestAndCopyTag(move, findResult, DICOM_TAG_PATIENT_ID);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 case ResourceType_Study:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 case ResourceType_Series:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 case ResourceType_Instance:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 TestAndCopyTag(move, findResult, DICOM_TAG_SOP_INSTANCE_UID);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 break;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 default:
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600 throw OrthancException(ErrorCode_InternalError);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 MoveInternal(targetAet, level, move);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 void DicomControlUserConnection::Move(const std::string& targetAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 const DicomMap& findResult)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 if (!findResult.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 throw OrthancException(ErrorCode_InternalError);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 const std::string tmp = findResult.GetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL).GetContent();
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 ResourceType level = StringToResourceType(tmp.c_str());
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 Move(targetAet, level, findResult);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 void DicomControlUserConnection::MovePatient(const std::string& targetAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 const std::string& patientId)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 DicomMap query;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 query.SetValue(DICOM_TAG_PATIENT_ID, patientId, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 MoveInternal(targetAet, ResourceType_Patient, query);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 void DicomControlUserConnection::MoveStudy(const std::string& targetAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 const std::string& studyUid)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 DicomMap query;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 MoveInternal(targetAet, ResourceType_Study, query);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 void DicomControlUserConnection::MoveSeries(const std::string& targetAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 const std::string& studyUid,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 const std::string& seriesUid)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 DicomMap query;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 MoveInternal(targetAet, ResourceType_Series, query);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 void DicomControlUserConnection::MoveInstance(const std::string& targetAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 const std::string& studyUid,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 const std::string& seriesUid,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 const std::string& instanceUid)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 DicomMap query;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid, false);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 MoveInternal(targetAet, ResourceType_Instance, query);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662
3870
09798f2b985f added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents: 3843
diff changeset
663 void DicomControlUserConnection::SetTimeout(uint32_t seconds)
09798f2b985f added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents: 3843
diff changeset
664 {
09798f2b985f added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents: 3843
diff changeset
665 parameters_.SetTimeout(seconds);
09798f2b985f added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents: 3843
diff changeset
666 }
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 void DicomControlUserConnection::FindWorklist(DicomFindAnswers& result,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 ParsedDicomFile& query)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 DcmDataset* dataset = query.GetDcmtkObject().getDataset();
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 const char* sopClass = UID_FINDModalityWorklistInformationModel;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 FindInternal(result, dataset, sopClass, true, NULL);
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 }