Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | f7adfb22e20e |
children |
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 |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5432
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 * the License, or (at your option) any later version. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * 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
|
15 * 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
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * Lesser General Public License for more details. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 * <http://www.gnu.org/licenses/>. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 **/ |
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 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "../PrecompiledHeaders.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "DicomControlUserConnection.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
3828 | 28 #include "../Compatibility.h" |
3985
cb801e5b4411
clarifying embedded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
29 #include "../DicomFormat/DicomArray.h" |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
30 #include "../DicomParsing/FromDcmtkBridge.h" |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 #include "../Logging.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 #include "../OrthancException.h" |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
33 #include "DicomAssociation.h" |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include <dcmtk/dcmdata/dcdeftag.h> |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include <dcmtk/dcmnet/diutil.h> |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 namespace Orthanc |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 static void TestAndCopyTag(DicomMap& result, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 const DicomMap& source, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 const DicomTag& tag) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 if (!source.HasTag(tag)) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 { |
4996 | 46 throw OrthancException(ErrorCode_BadRequest, "Missing tag " + tag.Format()); |
3825
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 else |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 result.SetValue(tag, source.GetValue(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 } |
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 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 namespace |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 struct FindPayload |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 DicomFindAnswers* answers; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 const char* level; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 bool isWorklist; |
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 } |
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 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 static void FindCallback( |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 /* in */ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 void *callbackData, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 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
|
70 int responseCount, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 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
|
72 DcmDataset *responseIdentifiers /* pending response identifiers */ |
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 { |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
75 if (response != NULL) |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
76 { |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
77 OFString str; |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
78 CLOG(TRACE, DICOM) << "Received Find Response " << responseCount << ":" << std::endl |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
79 << DIMSE_dumpMessage(str, *response, DIMSE_INCOMING); |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
80 } |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
81 |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
82 if (responseIdentifiers != NULL) |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
83 { |
4288 | 84 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008 |
85 responseIdentifiers->print(s); | |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
86 CLOG(TRACE, DICOM) << "Response Identifiers " << responseCount << ":" << std::endl << s.str(); |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
87 } |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
88 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 if (responseIdentifiers != NULL) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 { |
4199 | 91 FindPayload& payload = *reinterpret_cast<FindPayload*>(callbackData); |
92 | |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 if (payload.isWorklist) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 { |
4273
0034f855c023
tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
95 const ParsedDicomFile answer(*responseIdentifiers); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 payload.answers->Add(answer); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 else |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 DicomMap m; |
4137
6774605d4341
keep only one signature for FromDcmtkBridge::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4136
diff
changeset
|
101 std::set<DicomTag> ignoreTagLength; |
6774605d4341
keep only one signature for FromDcmtkBridge::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4136
diff
changeset
|
102 FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers, 0 /* don't truncate tags */, ignoreTagLength); |
3825
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 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
|
105 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 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
|
107 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 payload.answers->Add(m); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 } |
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 } |
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 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 static void NormalizeFindQuery(DicomMap& fixedQuery, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 ResourceType level, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 const DicomMap& fields) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 std::set<DicomTag> allowedTags; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 // 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
|
122 switch (level) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 case ResourceType_Instance: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 DicomTag::AddTagsForModule(allowedTags, DicomModule_Instance); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 case ResourceType_Series: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 DicomTag::AddTagsForModule(allowedTags, DicomModule_Series); |
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 case ResourceType_Study: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 DicomTag::AddTagsForModule(allowedTags, DicomModule_Study); |
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 case ResourceType_Patient: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 DicomTag::AddTagsForModule(allowedTags, DicomModule_Patient); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 default: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 throw OrthancException(ErrorCode_InternalError); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 switch (level) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 case ResourceType_Patient: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 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
|
145 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
|
146 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
|
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_Study: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 allowedTags.insert(DICOM_TAG_MODALITIES_IN_STUDY); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 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
|
152 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
|
153 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
|
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 case ResourceType_Series: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 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
|
158 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 default: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 allowedTags.insert(DICOM_TAG_SPECIFIC_CHARACTER_SET); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 DicomArray query(fields); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 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
|
168 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 const DicomTag& tag = query.GetElement(i).GetTag(); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 if (allowedTags.find(tag) == allowedTags.end()) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 { |
4313
91554aecff9a
removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4288
diff
changeset
|
172 CLOG(WARNING, DICOM) << "Tag not allowed for this C-Find level, will be ignored: (" |
91554aecff9a
removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4288
diff
changeset
|
173 << tag.Format() << ")"; |
3825
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 else |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 fixedQuery.SetValue(tag, query.GetElement(i).GetValue()); |
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 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 static ParsedDicomFile* ConvertQueryFields(const DicomMap& fields, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 ModalityManufacturer manufacturer) |
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 // 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
|
188 // 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
|
189 // 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
|
190 // 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
|
191 // 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
|
192 // GEWAServer as well: |
5432
59e3b6f8c5be
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
193 // https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=31 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 switch (manufacturer) |
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 case ModalityManufacturer_GenericNoWildcardInDates: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 case ModalityManufacturer_GenericNoUniversalWildcard: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 std::unique_ptr<DicomMap> fix(fields.Clone()); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 std::set<DicomTag> tags; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 fix->GetTags(tags); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 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
|
206 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 // 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
|
208 // "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
|
209 // type of manufacturer. |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 if (manufacturer == ModalityManufacturer_GenericNoUniversalWildcard || |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 (manufacturer == ModalityManufacturer_GenericNoWildcardInDates && |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 FromDcmtkBridge::LookupValueRepresentation(*it) == ValueRepresentation_Date)) |
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 const DicomValue* value = fix->TestAndGetValue(*it); |
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 if (value != NULL && |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 !value->IsNull() && |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 value->GetContent() == "*") |
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 fix->SetValue(*it, "", false); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 } |
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 |
4007
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3985
diff
changeset
|
225 return new ParsedDicomFile(*fix, GetDefaultDicomEncoding(), |
4035
cc6ed76bba27
added contextual privateCreators dico to ParsedDicomFile -> this allows you not to have to define a DefaultPrivateCreator. This was tested only in the scope of C-Find requests but should not have impact on other parts since it is not used out of C-Find right now
Alain Mazy <alain@mazy.be>
parents:
4007
diff
changeset
|
226 false /* be strict */); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 default: |
4007
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3985
diff
changeset
|
230 return new ParsedDicomFile(fields, GetDefaultDicomEncoding(), |
4035
cc6ed76bba27
added contextual privateCreators dico to ParsedDicomFile -> this allows you not to have to define a DefaultPrivateCreator. This was tested only in the scope of C-Find requests but should not have impact on other parts since it is not used out of C-Find right now
Alain Mazy <alain@mazy.be>
parents:
4007
diff
changeset
|
231 false /* be strict */); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 |
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 |
5853
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
237 void DicomControlUserConnection::SetupPresentationContexts() // TODO-GET, setup only the presentation contexts that are enabled for that modality |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 { |
3843
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
239 assert(association_.get() != NULL); |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
240 association_->ProposeGenericPresentationContext(UID_VerificationSOPClass); |
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
241 association_->ProposeGenericPresentationContext(UID_FINDPatientRootQueryRetrieveInformationModel); |
5012
6fbff89fd5a4
Added missing MOVEPatientRootQueryRetrieveInformationModel in DicomControlUserConnection::SetupPresentationContexts()
Alain Mazy <am@osimis.io>
parents:
4996
diff
changeset
|
242 association_->ProposeGenericPresentationContext(UID_MOVEPatientRootQueryRetrieveInformationModel); |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
243 association_->ProposeGenericPresentationContext(UID_FINDStudyRootQueryRetrieveInformationModel); |
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
244 association_->ProposeGenericPresentationContext(UID_MOVEStudyRootQueryRetrieveInformationModel); |
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
245 association_->ProposeGenericPresentationContext(UID_FINDModalityWorklistInformationModel); |
5853
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
246 association_->ProposeGenericPresentationContext(UID_GETStudyRootQueryRetrieveInformationModel); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
247 association_->ProposeGenericPresentationContext(UID_GETPatientRootQueryRetrieveInformationModel); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
248 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
249 // for C-GET SCU, in order to receive the C-Store message TODO-GET: we need to refine this list based on what we know we are going to retrieve |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
250 association_->ProposeGenericPresentationContext(UID_ComputedRadiographyImageStorage); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
251 association_->ProposeGenericPresentationContext(UID_MRImageStorage); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 } |
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 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 void DicomControlUserConnection::FindInternal(DicomFindAnswers& answers, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 DcmDataset* dataset, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 const char* sopClass, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 bool isWorklist, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 const char* level) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 { |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
261 assert(dataset != NULL); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 assert(isWorklist ^ (level != NULL)); |
3843
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
263 assert(association_.get() != NULL); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
265 association_->Open(parameters_); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 FindPayload payload; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 payload.answers = &answers; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 payload.level = level; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 payload.isWorklist = isWorklist; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 // 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
|
273 int presID = ASC_findAcceptedPresentationContextID( |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
274 &association_->GetDcmtkAssociation(), sopClass); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 if (presID == 0) |
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 throw OrthancException(ErrorCode_DicomFindUnavailable, |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
278 "Remote AET is " + parameters_.GetRemoteModality().GetApplicationEntityTitle()); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 T_DIMSE_C_FindRQ request; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 memset(&request, 0, sizeof(request)); |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
283 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++; |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 request.Priority = DIMSE_PRIORITY_MEDIUM; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 request.DataSetType = DIMSE_DATASET_PRESENT; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 T_DIMSE_C_FindRSP response; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 DcmDataset* statusDetail = NULL; |
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 #if DCMTK_VERSION_NUMBER >= 364 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 int responseCount; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 #endif |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
295 { |
4288 | 296 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008 |
297 dataset->print(s); | |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
298 |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
299 OFString str; |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
300 CLOG(TRACE, DICOM) << "Sending Find Request:" << std::endl |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
301 << DIMSE_dumpMessage(str, request, DIMSE_OUTGOING, NULL, presID) << std::endl |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
302 << s.str(); |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
303 } |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
304 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 OFCondition cond = DIMSE_findUser( |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
306 &association_->GetDcmtkAssociation(), presID, &request, dataset, |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 #if DCMTK_VERSION_NUMBER >= 364 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 responseCount, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 #endif |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 FindCallback, &payload, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 /*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
|
312 /*opt_dimse_timeout*/ parameters_.GetTimeout(), |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 &response, &statusDetail); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 if (statusDetail) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 delete statusDetail; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 DicomAssociation::CheckCondition(cond, parameters_, "C-FIND"); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
322 { |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
323 OFString str; |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
324 CLOG(TRACE, DICOM) << "Received Final Find Response:" << std::endl |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
325 << DIMSE_dumpMessage(str, response, DIMSE_INCOMING); |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
326 } |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
327 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 * 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
|
331 * 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
|
332 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 if (response.DimseStatus != 0x0000 && // Success |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 response.DimseStatus != 0xFF00 && // Pending - Matches are continuing |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 response.DimseStatus != 0xFF01) // Pending - Matches are continuing |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 char buf[16]; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 sprintf(buf, "%04X", response.DimseStatus); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 if (response.DimseStatus == STATUS_FIND_Failed_UnableToProcess) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 throw OrthancException(ErrorCode_NetworkProtocol, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 HttpStatus_422_UnprocessableEntity, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 "C-FIND SCU to AET \"" + |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
346 parameters_.GetRemoteModality().GetApplicationEntityTitle() + |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 "\" has failed with DIMSE status 0x" + buf + |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 " (unable to process - invalid query ?)"); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 else |
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 throw OrthancException(ErrorCode_NetworkProtocol, "C-FIND SCU to AET \"" + |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
353 parameters_.GetRemoteModality().GetApplicationEntityTitle() + |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 "\" has failed with DIMSE status 0x" + buf); |
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 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 } |
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 void DicomControlUserConnection::MoveInternal(const std::string& targetAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 ResourceType level, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 const DicomMap& fields) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 { |
3843
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
364 assert(association_.get() != NULL); |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
365 association_->Open(parameters_); |
3825
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 std::unique_ptr<ParsedDicomFile> query( |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
368 ConvertQueryFields(fields, parameters_.GetRemoteModality().GetManufacturer())); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel; |
5025
afa427f65444
Added an Asynchronous mode to /modalities/../move
Alain Mazy <am@osimis.io>
parents:
5012
diff
changeset
|
372 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, ResourceTypeToDicomQueryRetrieveLevel(level)); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 // 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
|
375 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
|
376 if (presID == 0) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 throw OrthancException(ErrorCode_DicomMoveUnavailable, |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
379 "Remote AET is " + parameters_.GetRemoteModality().GetApplicationEntityTitle()); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 T_DIMSE_C_MoveRQ request; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 memset(&request, 0, sizeof(request)); |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
384 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++; |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 request.Priority = DIMSE_PRIORITY_MEDIUM; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 request.DataSetType = DIMSE_DATASET_PRESENT; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 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
|
389 |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
390 { |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
391 OFString str; |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
392 CLOG(TRACE, DICOM) << "Sending Move Request:" << std::endl |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
393 << DIMSE_dumpMessage(str, request, DIMSE_OUTGOING, NULL, presID); |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
394 } |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
395 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 T_DIMSE_C_MoveRSP response; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 DcmDataset* statusDetail = NULL; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 DcmDataset* responseIdentifiers = NULL; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 OFCondition cond = DIMSE_moveUser( |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
400 &association_->GetDcmtkAssociation(), presID, &request, dataset, /*moveCallback*/ NULL, NULL, |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 /*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
|
402 /*opt_dimse_timeout*/ parameters_.GetTimeout(), |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
403 &association_->GetDcmtkNetwork(), /*subOpCallback*/ NULL, NULL, |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 &response, &statusDetail, &responseIdentifiers); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
406 if (statusDetail) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 delete statusDetail; |
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 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 if (responseIdentifiers) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 delete responseIdentifiers; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 DicomAssociation::CheckCondition(cond, parameters_, "C-MOVE"); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
418 { |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
419 OFString str; |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
420 CLOG(TRACE, DICOM) << "Received Final Move Response:" << std::endl |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
421 << DIMSE_dumpMessage(str, response, DIMSE_INCOMING); |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
422 } |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 |
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 * 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
|
426 * 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
|
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 if (response.DimseStatus != 0x0000 && // Success |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 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
|
431 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 char buf[16]; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 sprintf(buf, "%04X", response.DimseStatus); |
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 if (response.DimseStatus == STATUS_MOVE_Failed_UnableToProcess) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 throw OrthancException(ErrorCode_NetworkProtocol, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 HttpStatus_422_UnprocessableEntity, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 "C-MOVE SCU to AET \"" + |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
440 parameters_.GetRemoteModality().GetApplicationEntityTitle() + |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 "\" has failed with DIMSE status 0x" + buf + |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 " (unable to process - resource not found ?)"); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 else |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 throw OrthancException(ErrorCode_NetworkProtocol, "C-MOVE SCU to AET \"" + |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
447 parameters_.GetRemoteModality().GetApplicationEntityTitle() + |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
448 "\" has failed with DIMSE status 0x" + buf); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
449 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 |
5853
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
454 void DicomControlUserConnection::Get(const DicomMap& findResult, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
455 CGetInstanceReceivedCallback instanceReceivedCallback, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
456 void* callbackContext) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
457 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
458 assert(association_.get() != NULL); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
459 association_->Open(parameters_); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
460 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
461 // TODO-GET: if findResults is the result of a C-Find, we can use the SopClassUIDs for the negotiation |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
462 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
463 std::unique_ptr<ParsedDicomFile> query( |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
464 ConvertQueryFields(findResult, parameters_.GetRemoteModality().GetManufacturer())); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
465 DcmDataset* queryDataset = query->GetDcmtkObject().getDataset(); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
466 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
467 std::string remoteAet; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
468 std::string remoteIp; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
469 std::string calledAet; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
470 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
471 association_->GetAssociationParameters(remoteAet, remoteIp, calledAet); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
472 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
473 const char* sopClass = NULL; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
474 const std::string tmp = findResult.GetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL).GetContent(); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
475 ResourceType level = StringToResourceType(tmp.c_str()); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
476 switch (level) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
477 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
478 case ResourceType_Patient: |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
479 sopClass = UID_GETPatientRootQueryRetrieveInformationModel; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
480 // DU_putStringDOElement(queryDataset, DCM_QueryRetrieveLevel, ResourceTypeToDicomQueryRetrieveLevel(ResourceType_Patient)); // TODO-GET |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
481 break; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
482 case ResourceType_Study: |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
483 sopClass = UID_GETStudyRootQueryRetrieveInformationModel; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
484 // DU_putStringDOElement(queryDataset, DCM_QueryRetrieveLevel, ResourceTypeToDicomQueryRetrieveLevel(ResourceType_Study)); // TODO-GET |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
485 break; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
486 default: |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
487 throw OrthancException(ErrorCode_InternalError); // TODO-GET: implement series + instances |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
488 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
489 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
490 // Figure out which of the accepted presentation contexts should be used |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
491 int cgetPresID = ASC_findAcceptedPresentationContextID(&association_->GetDcmtkAssociation(), sopClass); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
492 if (cgetPresID == 0) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
493 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
494 throw OrthancException(ErrorCode_DicomGetUnavailable, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
495 "Remote AET is " + parameters_.GetRemoteModality().GetApplicationEntityTitle()); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
496 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
497 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
498 T_DIMSE_Message msgGetRequest; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
499 memset((char*)&msgGetRequest, 0, sizeof(msgGetRequest)); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
500 msgGetRequest.CommandField = DIMSE_C_GET_RQ; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
501 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
502 T_DIMSE_C_GetRQ* request = &(msgGetRequest.msg.CGetRQ); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
503 request->MessageID = association_->GetDcmtkAssociation().nextMsgID++; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
504 strncpy(request->AffectedSOPClassUID, sopClass, DIC_UI_LEN); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
505 request->Priority = DIMSE_PRIORITY_MEDIUM; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
506 request->DataSetType = DIMSE_DATASET_PRESENT; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
507 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
508 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
509 OFString str; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
510 CLOG(TRACE, DICOM) << "Sending Get Request:" << std::endl |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
511 << DIMSE_dumpMessage(str, *request, DIMSE_OUTGOING, NULL, cgetPresID); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
512 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
513 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
514 OFCondition cond = DIMSE_sendMessageUsingMemoryData( |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
515 &(association_->GetDcmtkAssociation()), cgetPresID, &msgGetRequest, NULL /* statusDetail */, queryDataset, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
516 NULL /* progress callback TODO-GET */, NULL /* callback context */, NULL /* commandSet */); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
517 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
518 if (cond.bad()) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
519 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
520 OFString tempStr; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
521 CLOG(TRACE, DICOM) << "Failed sending C-GET request: " << DimseCondition::dump(tempStr, cond); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
522 // return cond; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
523 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
524 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
525 // equivalent to handleCGETSession in DCMTK |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
526 bool continueSession = true; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
527 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
528 // As long we want to continue (usually, as long as we receive more objects, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
529 // i.e. the final C-GET response has not arrived yet) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
530 while (continueSession) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
531 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
532 T_DIMSE_Message rsp; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
533 // Make sure everything is zeroed (especially options) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
534 memset((char*)&rsp, 0, sizeof(rsp)); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
535 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
536 // DcmDataset* statusDetail = NULL; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
537 T_ASC_PresentationContextID cmdPresId = 0; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
538 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
539 OFCondition result = DIMSE_receiveCommand(&(association_->GetDcmtkAssociation()), |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
540 (parameters_.HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
541 parameters_.GetTimeout(), |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
542 &cmdPresId, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
543 &rsp, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
544 NULL /* statusDetail */, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
545 NULL /* not interested in the command set */); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
546 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
547 if (result.bad()) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
548 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
549 OFString tempStr; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
550 CLOG(TRACE, DICOM) << "Failed receiving DIMSE command: " << DimseCondition::dump(tempStr, result); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
551 // delete statusDetail; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
552 break; // TODO: return value |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
553 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
554 // Handle C-GET Response |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
555 if (rsp.CommandField == DIMSE_C_GET_RSP) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
556 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
557 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
558 OFString tempStr; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
559 CLOG(TRACE, DICOM) << "Received C-GET Response: " << std::endl |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
560 << DIMSE_dumpMessage(tempStr, rsp, DIMSE_INCOMING, NULL, cmdPresId); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
561 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
562 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
563 // TODO-GET: for progress handler |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
564 // OFunique_ptr<RetrieveResponse> getRSP(new RetrieveResponse()); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
565 // getRSP->m_affectedSOPClassUID = rsp.msg.CGetRSP.AffectedSOPClassUID; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
566 // getRSP->m_messageIDRespondedTo = rsp.msg.CGetRSP.MessageIDBeingRespondedTo; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
567 // getRSP->m_status = rsp.msg.CGetRSP.DimseStatus; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
568 // getRSP->m_numberOfRemainingSubops = rsp.msg.CGetRSP.NumberOfRemainingSubOperations; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
569 // getRSP->m_numberOfCompletedSubops = rsp.msg.CGetRSP.NumberOfCompletedSubOperations; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
570 // getRSP->m_numberOfFailedSubops = rsp.msg.CGetRSP.NumberOfFailedSubOperations; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
571 // getRSP->m_numberOfWarningSubops = rsp.msg.CGetRSP.NumberOfWarningSubOperations; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
572 // getRSP->m_statusDetail = statusDetail; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
573 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
574 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
575 // Handle C-STORE Request |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
576 else if (rsp.CommandField == DIMSE_C_STORE_RQ) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
577 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
578 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
579 OFString tempStr; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
580 CLOG(TRACE, DICOM) << "Received C-STORE Request: " << std::endl |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
581 << DIMSE_dumpMessage(tempStr, rsp, DIMSE_INCOMING, NULL, cmdPresId); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
582 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
583 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
584 T_DIMSE_C_StoreRQ* storeRequest = &(rsp.msg.CStoreRQ); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
585 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
586 // Check if dataset is announced correctly |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
587 if (rsp.msg.CStoreRQ.DataSetType == DIMSE_DATASET_NULL) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
588 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
589 CLOG(WARNING, DICOM) << "C-GET SCU handler: Incoming C-STORE with no dataset"; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
590 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
591 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
592 Uint16 desiredCStoreReturnStatus = 0; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
593 DcmDataset* dataObject = NULL; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
594 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
595 // Receive dataset |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
596 result = DIMSE_receiveDataSetInMemory(&(association_->GetDcmtkAssociation()), |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
597 (parameters_.HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
598 parameters_.GetTimeout(), |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
599 &cmdPresId, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
600 &dataObject, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
601 NULL /*callback*/, NULL /*callbackData*/); // TODO-GET |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
602 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
603 if (result.bad()) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
604 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
605 desiredCStoreReturnStatus = STATUS_STORE_Error_CannotUnderstand; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
606 // TODO-GET: return ? |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
607 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
608 else |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
609 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
610 // callback the OrthancServer with the received data |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
611 if (instanceReceivedCallback != NULL) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
612 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
613 desiredCStoreReturnStatus = instanceReceivedCallback(callbackContext, *dataObject, remoteAet, remoteIp, calledAet); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
614 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
615 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
616 // send the Store response |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
617 T_DIMSE_Message storeResponse; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
618 memset((char*)&storeResponse, 0, sizeof(storeResponse)); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
619 storeResponse.CommandField = DIMSE_C_STORE_RSP; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
620 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
621 T_DIMSE_C_StoreRSP& storeRsp = storeResponse.msg.CStoreRSP; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
622 storeRsp.MessageIDBeingRespondedTo = storeRequest->MessageID; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
623 storeRsp.DimseStatus = desiredCStoreReturnStatus; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
624 storeRsp.DataSetType = DIMSE_DATASET_NULL; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
625 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
626 OFStandard::strlcpy( |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
627 storeRsp.AffectedSOPClassUID, storeRequest->AffectedSOPClassUID, sizeof(storeRsp.AffectedSOPClassUID)); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
628 OFStandard::strlcpy( |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
629 storeRsp.AffectedSOPInstanceUID, storeRequest->AffectedSOPInstanceUID, sizeof(storeRsp.AffectedSOPInstanceUID)); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
630 storeRsp.opts = O_STORE_AFFECTEDSOPCLASSUID | O_STORE_AFFECTEDSOPINSTANCEUID; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
631 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
632 result = DIMSE_sendMessageUsingMemoryData(&(association_->GetDcmtkAssociation()), |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
633 cmdPresId, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
634 &storeResponse, NULL /* statusDetail */, NULL /* dataObject */, |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
635 NULL /* progress callback TODO-GET */, NULL /* callback context */, NULL /* commandSet */); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
636 if (result.bad()) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
637 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
638 continueSession = false; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
639 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
640 else |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
641 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
642 OFString tempStr; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
643 CLOG(TRACE, DICOM) << "Sent C-STORE Response: " << std::endl |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
644 << DIMSE_dumpMessage(tempStr, storeResponse, DIMSE_OUTGOING, NULL, cmdPresId); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
645 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
646 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
647 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
648 // Handle other DIMSE command (error since other command than GET/STORE not expected) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
649 else |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
650 { |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
651 CLOG(WARNING, DICOM) << "Expected C-GET response or C-STORE request but received DIMSE command 0x" |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
652 << std::hex << std::setfill('0') << std::setw(4) |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
653 << static_cast<unsigned int>(rsp.CommandField); |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
654 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
655 result = DIMSE_BADCOMMANDTYPE; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
656 continueSession = false; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
657 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
658 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
659 // delete statusDetail; // should be NULL if not existing or added to response list |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
660 // statusDetail = NULL; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
661 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
662 /* All responses received or break signal occurred */ |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
663 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
664 // return result; |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
665 } |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
666 |
4d932683049d
very first implementation of C-Get SCU
Alain Mazy <am@orthanc.team>
parents:
5640
diff
changeset
|
667 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
668 DicomControlUserConnection::DicomControlUserConnection(const DicomAssociationParameters& params) : |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
669 parameters_(params), |
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
670 association_(new DicomAssociation) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
671 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 SetupPresentationContexts(); |
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 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
675 |
3843
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
676 void DicomControlUserConnection::Close() |
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
677 { |
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
678 assert(association_.get() != NULL); |
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
679 association_->Close(); |
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
680 } |
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
681 |
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
682 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
683 bool DicomControlUserConnection::Echo() |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
684 { |
3843
138d0dde41b5
end of replacements of DicomUserConnection by DicomControlUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3830
diff
changeset
|
685 assert(association_.get() != NULL); |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
686 association_->Open(parameters_); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
687 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
688 DIC_US status; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
689 DicomAssociation::CheckCondition( |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
690 DIMSE_echoUser(&association_->GetDcmtkAssociation(), |
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
691 association_->GetDcmtkAssociation().nextMsgID++, |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
692 /*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
|
693 /*opt_dimse_timeout*/ parameters_.GetTimeout(), |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
694 &status, NULL), |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
695 parameters_, "C-ECHO"); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 return status == STATUS_Success; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
698 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
699 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
700 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 void DicomControlUserConnection::Find(DicomFindAnswers& result, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 ResourceType level, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
703 const DicomMap& originalFields, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
704 bool normalize) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
706 std::unique_ptr<ParsedDicomFile> query; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
707 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 if (normalize) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
710 DicomMap fields; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
711 NormalizeFindQuery(fields, level, originalFields); |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
712 query.reset(ConvertQueryFields(fields, parameters_.GetRemoteModality().GetManufacturer())); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
713 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 else |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
715 { |
4007
884b55ce01f6
Private tags returned by C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3985
diff
changeset
|
716 query.reset(new ParsedDicomFile(originalFields, GetDefaultDicomEncoding(), |
4035
cc6ed76bba27
added contextual privateCreators dico to ParsedDicomFile -> this allows you not to have to define a DefaultPrivateCreator. This was tested only in the scope of C-Find requests but should not have impact on other parts since it is not used out of C-Find right now
Alain Mazy <alain@mazy.be>
parents:
4007
diff
changeset
|
717 false /* be strict */)); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
718 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
719 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
720 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4273
diff
changeset
|
721 assert(dataset != NULL); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
722 |
5025
afa427f65444
Added an Asynchronous mode to /modalities/../move
Alain Mazy <am@osimis.io>
parents:
5012
diff
changeset
|
723 const char* clevel = ResourceTypeToDicomQueryRetrieveLevel(level); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
724 const char* sopClass = NULL; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
725 |
5025
afa427f65444
Added an Asynchronous mode to /modalities/../move
Alain Mazy <am@osimis.io>
parents:
5012
diff
changeset
|
726 DU_putStringDOElement(dataset, DCM_QueryRetrieveLevel, clevel); |
afa427f65444
Added an Asynchronous mode to /modalities/../move
Alain Mazy <am@osimis.io>
parents:
5012
diff
changeset
|
727 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
728 switch (level) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
729 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
730 case ResourceType_Patient: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
731 sopClass = UID_FINDPatientRootQueryRetrieveInformationModel; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
732 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
733 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 case ResourceType_Study: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
735 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
737 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
738 case ResourceType_Series: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
739 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
740 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
741 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
742 case ResourceType_Instance: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
744 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
745 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
746 default: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
747 throw OrthancException(ErrorCode_ParameterOutOfRange); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
748 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
749 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
750 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
751 const char* universal; |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
752 if (parameters_.GetRemoteModality().GetManufacturer() == ModalityManufacturer_GE) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
753 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
754 universal = "*"; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
755 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
756 else |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
757 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
758 universal = ""; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
759 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
760 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
761 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
762 // 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
|
763 // 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
|
764 switch (level) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
765 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
766 case ResourceType_Instance: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
767 if (!dataset->tagExists(DCM_SOPInstanceUID)) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
768 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
769 DU_putStringDOElement(dataset, DCM_SOPInstanceUID, universal); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
770 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
771 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
772 case ResourceType_Series: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
773 if (!dataset->tagExists(DCM_SeriesInstanceUID)) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
774 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
775 DU_putStringDOElement(dataset, DCM_SeriesInstanceUID, universal); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
776 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
777 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
778 case ResourceType_Study: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
779 if (!dataset->tagExists(DCM_AccessionNumber)) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
780 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
781 DU_putStringDOElement(dataset, DCM_AccessionNumber, universal); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
782 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
783 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
784 if (!dataset->tagExists(DCM_StudyInstanceUID)) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
785 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
786 DU_putStringDOElement(dataset, DCM_StudyInstanceUID, universal); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
787 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
788 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
789 case ResourceType_Patient: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
790 if (!dataset->tagExists(DCM_PatientID)) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
791 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
792 DU_putStringDOElement(dataset, DCM_PatientID, universal); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
793 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
794 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
795 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
796 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
797 default: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
798 throw OrthancException(ErrorCode_ParameterOutOfRange); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
799 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
800 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
801 assert(clevel != NULL && sopClass != NULL); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
802 FindInternal(result, dataset, sopClass, false, clevel); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
803 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
804 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
805 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
806 void DicomControlUserConnection::Move(const std::string& targetAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
807 ResourceType level, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
808 const DicomMap& findResult) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
809 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
810 DicomMap move; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
811 switch (level) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
812 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
813 case ResourceType_Patient: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
814 TestAndCopyTag(move, findResult, DICOM_TAG_PATIENT_ID); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
815 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
816 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
817 case ResourceType_Study: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
818 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
|
819 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
820 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
821 case ResourceType_Series: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
822 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
|
823 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
|
824 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
825 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
826 case ResourceType_Instance: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
827 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
|
828 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
|
829 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
|
830 break; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
831 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
832 default: |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
833 throw OrthancException(ErrorCode_InternalError); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
834 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
835 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
836 MoveInternal(targetAet, level, move); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
837 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
838 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
839 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
840 void DicomControlUserConnection::Move(const std::string& targetAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
841 const DicomMap& findResult) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
842 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
843 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
|
844 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
845 throw OrthancException(ErrorCode_InternalError); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
846 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
847 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
848 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
|
849 ResourceType level = StringToResourceType(tmp.c_str()); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
850 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
851 Move(targetAet, level, findResult); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
852 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
853 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
854 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
855 void DicomControlUserConnection::MovePatient(const std::string& targetAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
856 const std::string& patientId) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
857 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
858 DicomMap query; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
859 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
|
860 MoveInternal(targetAet, ResourceType_Patient, query); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
861 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
862 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
863 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
864 void DicomControlUserConnection::MoveStudy(const std::string& targetAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
865 const std::string& studyUid) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
866 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
867 DicomMap query; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
868 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
|
869 MoveInternal(targetAet, ResourceType_Study, query); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
870 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
871 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
872 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
873 void DicomControlUserConnection::MoveSeries(const std::string& targetAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
874 const std::string& studyUid, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
875 const std::string& seriesUid) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
876 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
877 DicomMap query; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
878 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
|
879 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
|
880 MoveInternal(targetAet, ResourceType_Series, query); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
881 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
882 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
883 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
884 void DicomControlUserConnection::MoveInstance(const std::string& targetAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
885 const std::string& studyUid, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
886 const std::string& seriesUid, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
887 const std::string& instanceUid) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
888 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
889 DicomMap query; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
890 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
|
891 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
|
892 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
|
893 MoveInternal(targetAet, ResourceType_Instance, query); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
894 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
895 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
896 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
897 void DicomControlUserConnection::FindWorklist(DicomFindAnswers& result, |
4203
4d42408da117
improving const-correctness in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
898 ParsedDicomFile& query) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
899 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
900 DcmDataset* dataset = query.GetDcmtkObject().getDataset(); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
901 const char* sopClass = UID_FINDModalityWorklistInformationModel; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
902 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
903 FindInternal(result, dataset, sopClass, true, NULL); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
904 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
905 } |