annotate OrthancServer/Sources/OrthancGetRequestHandler.cpp @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents OrthancServer/OrthancGetRequestHandler.cpp@7f8b30416d50
children 05b8fd21089c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
1 /**
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
3970
4d1dcdf5c57e fix date in some files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3966
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
6 *
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
11 *
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
22 * in the program, then also delete it here.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
23 *
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
27 * General Public License for more details.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
28 *
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
31 **/
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
32
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
33 #include "PrecompiledHeadersServer.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
34 #include "OrthancGetRequestHandler.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
35
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
36 #include "../../Core/DicomParsing/FromDcmtkBridge.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
37 #include "../Core/DicomFormat/DicomArray.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
38 #include "../Core/Logging.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
39 #include "../Core/MetricsRegistry.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
40 #include "OrthancConfiguration.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
41 #include "ServerContext.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
42 #include "ServerJobs/DicomModalityStoreJob.h"
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
43
3963
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
44 #include <dcmtk/dcmdata/dcdeftag.h>
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
45 #include <dcmtk/dcmdata/dcfilefo.h>
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
46 #include <dcmtk/dcmdata/dcistrmb.h>
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
47 #include <dcmtk/dcmnet/assoc.h>
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
48 #include <dcmtk/dcmnet/dimse.h>
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
49 #include <dcmtk/dcmnet/diutil.h>
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
50 #include <dcmtk/ofstd/ofstring.h>
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
51
3962
d30eb4ae5bb6 trying a fix for msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3959
diff changeset
52 #include <sstream> // For std::stringstream
d30eb4ae5bb6 trying a fix for msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3959
diff changeset
53
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
54 namespace Orthanc
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
55 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
56 namespace
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
57 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
58 // Anonymous namespace to avoid clashes between compilation modules
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
59
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
60 static void GetSubOpProgressCallback(
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
61 void * /* callbackData == pointer to the "OrthancGetRequestHandler" object */,
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
62 T_DIMSE_StoreProgress *progress,
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
63 T_DIMSE_C_StoreRQ * /*req*/)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
64 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
65 // SBL - no logging to be done here.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
66 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
67 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
68
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
69 OrthancGetRequestHandler::Status
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
70 OrthancGetRequestHandler::DoNext(T_ASC_Association* assoc)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
71 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
72 if (position_ >= instances_.size())
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
73 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
74 return Status_Failure;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
75 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
76
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
77 const std::string& id = instances_[position_++];
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
78
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
79 std::string dicom;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
80 context_.ReadDicom(dicom, id);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
81
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
82 if (dicom.size() <= 0)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
83 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
84 return Status_Failure;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
85 }
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
86
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
87 std::unique_ptr<DcmFileFormat> parsed(
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
88 FromDcmtkBridge::LoadFromMemoryBuffer(dicom.c_str(), dicom.size()));
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
89
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
90 if (parsed.get() == NULL ||
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
91 parsed->getDataset() == NULL)
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
92 {
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
93 throw OrthancException(ErrorCode_InternalError);
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
94 }
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
95
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
96 DcmDataset& dataset = *parsed->getDataset();
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
97
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
98 OFString a, b;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
99 if (!dataset.findAndGetOFString(DCM_SOPClassUID, a).good() ||
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
100 !dataset.findAndGetOFString(DCM_SOPInstanceUID, b).good())
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
101 {
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
102 throw OrthancException(ErrorCode_NoSopClassOrInstance,
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
103 "Unable to determine the SOP class/instance for C-STORE with AET " +
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
104 originatorAet_);
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
105 }
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
106
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
107 std::string sopClassUid(a.c_str());
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
108 std::string sopInstanceUid(b.c_str());
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
109
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
110 OFCondition cond = PerformGetSubOp(assoc, sopClassUid, sopInstanceUid, parsed.release());
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
111
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
112 if (getCancelled_)
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
113 {
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
114 LOG(INFO) << "C-GET SCP: Received C-Cancel RQ";
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
115 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
116
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
117 if (cond.bad() || getCancelled_)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
118 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
119 return Status_Failure;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
120 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
121
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
122 return Status_Success;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
123 }
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
124
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
125
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
126 void OrthancGetRequestHandler::AddFailedUIDInstance(const std::string& sopInstance)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
127 {
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
128 if (failedUIDs_.empty())
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
129 {
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
130 failedUIDs_ = sopInstance;
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
131 }
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
132 else
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
133 {
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
134 failedUIDs_ += "\\" + sopInstance;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
135 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
136 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
137
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
138
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
139 static bool SelectPresentationContext(T_ASC_PresentationContextID& selectedPresentationId,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
140 DicomTransferSyntax& selectedSyntax,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
141 T_ASC_Association* assoc,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
142 const std::string& sopClassUid,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
143 DicomTransferSyntax sourceSyntax,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
144 bool allowTranscoding)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
145 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
146 typedef std::map<DicomTransferSyntax, T_ASC_PresentationContextID> Accepted;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
147
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
148 Accepted accepted;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
149
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
150 /**
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
151 * 1. Inspect and index all the accepted transfer syntaxes. This
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
152 * is similar to the code from "DicomAssociation::Open()".
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
153 **/
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
154
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
155 LST_HEAD **l = &assoc->params->DULparams.acceptedPresentationContext;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
156 if (*l != NULL)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
157 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
158 DUL_PRESENTATIONCONTEXT* pc = (DUL_PRESENTATIONCONTEXT*) LST_Head(l);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
159 LST_Position(l, (LST_NODE*)pc);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
160 while (pc)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
161 {
3966
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
162 DicomTransferSyntax transferSyntax;
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
163 if (pc->result == ASC_P_ACCEPTANCE &&
3966
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
164 LookupTransferSyntax(transferSyntax, pc->acceptedTransferSyntax))
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
165 {
3966
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
166 VLOG(0) << "C-GET SCP accepted: SOP class " << sopClassUid
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
167 << " with transfer syntax " << GetTransferSyntaxUid(transferSyntax);
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
168 if (std::string(pc->abstractSyntax) == sopClassUid)
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
169 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
170 accepted[transferSyntax] = pc->presentationContextID;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
171 }
3966
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
172 }
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
173 else
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
174 {
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
175 LOG(WARNING) << "C-GET: Unknown transfer syntax received: "
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
176 << pc->acceptedTransferSyntax;
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
177 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
178
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
179 pc = (DUL_PRESENTATIONCONTEXT*) LST_Next(l);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
180 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
181 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
182
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
183
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
184 /**
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
185 * 2. Select the preferred transfer syntaxes, which corresponds to
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
186 * the source transfer syntax, plus all the uncompressed transfer
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
187 * syntaxes if transcoding is enabled.
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
188 **/
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
189
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
190 std::list<DicomTransferSyntax> preferred;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
191 preferred.push_back(sourceSyntax);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
192
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
193 if (allowTranscoding)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
194 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
195 if (sourceSyntax != DicomTransferSyntax_LittleEndianImplicit)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
196 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
197 // Default Transfer Syntax for DICOM
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
198 preferred.push_back(DicomTransferSyntax_LittleEndianImplicit);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
199 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
200
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
201 if (sourceSyntax != DicomTransferSyntax_LittleEndianExplicit)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
202 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
203 preferred.push_back(DicomTransferSyntax_LittleEndianExplicit);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
204 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
205
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
206 if (sourceSyntax != DicomTransferSyntax_BigEndianExplicit)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
207 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
208 // Retired
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
209 preferred.push_back(DicomTransferSyntax_BigEndianExplicit);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
210 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
211 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
212
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
213
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
214 /**
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
215 * 3. Lookup whether one of the preferred transfer syntaxes was
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
216 * accepted.
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
217 **/
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
218
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
219 for (std::list<DicomTransferSyntax>::const_iterator
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
220 it = preferred.begin(); it != preferred.end(); ++it)
3966
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
221 {
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
222 Accepted::const_iterator found = accepted.find(*it);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
223 if (found != accepted.end())
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
224 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
225 selectedPresentationId = found->second;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
226 selectedSyntax = *it;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
227 return true;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
228 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
229 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
230
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
231 // No preferred syntax was accepted
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
232 return false;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
233 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
234
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
235
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
236 OFCondition OrthancGetRequestHandler::PerformGetSubOp(T_ASC_Association* assoc,
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
237 const std::string& sopClassUid,
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
238 const std::string& sopInstanceUid,
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
239 DcmFileFormat* dicomRaw)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
240 {
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
241 assert(dicomRaw != NULL);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
242 std::unique_ptr<DcmFileFormat> dicom(dicomRaw);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
243
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
244 DicomTransferSyntax sourceSyntax;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
245 if (!FromDcmtkBridge::LookupOrthancTransferSyntax(sourceSyntax, *dicom))
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
246 {
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
247 nFailed_++;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
248 AddFailedUIDInstance(sopInstanceUid);
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
249 LOG(ERROR) << "C-GET SCP: Unknown transfer syntax: ("
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
250 << dcmSOPClassUIDToModality(sopClassUid.c_str(), "OT") << ") " << sopClassUid;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
251 return DIMSE_NOVALIDPRESENTATIONCONTEXTID;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
252 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
253
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
254 bool allowTranscoding = (context_.IsTranscodeDicomProtocol() &&
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
255 remote_.IsTranscodingAllowed());
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
256
3972
7f8b30416d50 minor clarification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3970
diff changeset
257 T_ASC_PresentationContextID presId = 0; // Unnecessary initialization, makes code clearer
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
258 DicomTransferSyntax selectedSyntax;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
259 if (!SelectPresentationContext(presId, selectedSyntax, assoc, sopClassUid,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
260 sourceSyntax, allowTranscoding) ||
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
261 presId == 0)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
262 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
263 nFailed_++;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
264 AddFailedUIDInstance(sopInstanceUid);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
265 LOG(ERROR) << "C-GET SCP: storeSCU: No presentation context for: ("
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
266 << dcmSOPClassUIDToModality(sopClassUid.c_str(), "OT") << ") " << sopClassUid;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
267 return DIMSE_NOVALIDPRESENTATIONCONTEXTID;
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
268 }
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
269 else
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
270 {
3966
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
271 LOG(INFO) << "C-GET SCP selected transfer syntax " << GetTransferSyntaxUid(selectedSyntax)
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
272 << ", for source instance with SOP class " << sopClassUid
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
273 << " and transfer syntax " << GetTransferSyntaxUid(sourceSyntax);
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
274
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
275 // make sure that we can send images in this presentation context
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
276 T_ASC_PresentationContext pc;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
277 ASC_findAcceptedPresentationContext(assoc->params, presId, &pc);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
278 // the acceptedRole is the association requestor role
3966
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
279
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
280 if (pc.acceptedRole != ASC_SC_ROLE_DEFAULT && // "DEFAULT" is necessary for GinkgoCADx
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
281 pc.acceptedRole != ASC_SC_ROLE_SCP &&
fde1355a625a c-get compatibility with ginkgocadx
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3963
diff changeset
282 pc.acceptedRole != ASC_SC_ROLE_SCUSCP)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
283 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
284 // the role is not appropriate
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
285 nFailed_++;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
286 AddFailedUIDInstance(sopInstanceUid);
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
287 LOG(ERROR) << "C-GET SCP: storeSCU: [No presentation context with requestor SCP role for: ("
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
288 << dcmSOPClassUIDToModality(sopClassUid.c_str(), "OT") << ") " << sopClassUid;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
289 return DIMSE_NOVALIDPRESENTATIONCONTEXTID;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
290 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
291 }
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
292
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
293 const DIC_US msgId = assoc->nextMsgID++;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
294
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
295 T_DIMSE_C_StoreRQ req;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
296 memset(&req, 0, sizeof(req));
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
297 req.MessageID = msgId;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
298 strncpy(req.AffectedSOPClassUID, sopClassUid.c_str(), DIC_UI_LEN);
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
299 strncpy(req.AffectedSOPInstanceUID, sopInstanceUid.c_str(), DIC_UI_LEN);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
300 req.DataSetType = DIMSE_DATASET_PRESENT;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
301 req.Priority = DIMSE_PRIORITY_MEDIUM;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
302 req.opts = 0;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
303
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
304 T_DIMSE_C_StoreRSP rsp;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
305 memset(&rsp, 0, sizeof(rsp));
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
306
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
307 LOG(INFO) << "Store SCU RQ: MsgID " << msgId << ", ("
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
308 << dcmSOPClassUIDToModality(sopClassUid.c_str(), "OT") << ")";
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
309
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
310 T_DIMSE_DetectedCancelParameters cancelParameters;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
311 memset(&cancelParameters, 0, sizeof(cancelParameters));
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
312
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
313 std::unique_ptr<DcmDataset> stDetail;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
314
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
315 OFCondition cond;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
316
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
317 if (sourceSyntax == selectedSyntax)
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
318 {
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
319 // No transcoding is required
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
320 DcmDataset *stDetailTmp = NULL;
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
321 cond = DIMSE_storeUser(
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
322 assoc, presId, &req, NULL /* imageFileName */, dicom->getDataset(),
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
323 GetSubOpProgressCallback, this /* callbackData */,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
324 (timeout_ > 0 ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout_,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
325 &rsp, &stDetailTmp, &cancelParameters);
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
326 stDetail.reset(stDetailTmp);
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
327 }
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
328 else
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
329 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
330 // Transcoding to the selected uncompressed transfer syntax
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
331 IDicomTranscoder::DicomImage source, transcoded;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
332 source.AcquireParsed(dicom.release());
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
333
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
334 std::set<DicomTransferSyntax> ts;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
335 ts.insert(selectedSyntax);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
336
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
337 if (context_.Transcode(transcoded, source, ts, true))
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
338 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
339 // Transcoding has succeeded
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
340 DcmDataset *stDetailTmp = NULL;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
341 cond = DIMSE_storeUser(
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
342 assoc, presId, &req, NULL /* imageFileName */,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
343 transcoded.GetParsed().getDataset(),
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
344 GetSubOpProgressCallback, this /* callbackData */,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
345 (timeout_ > 0 ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout_,
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
346 &rsp, &stDetailTmp, &cancelParameters);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
347 stDetail.reset(stDetailTmp);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
348 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
349 else
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
350 {
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
351 // Cannot transcode
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
352 nFailed_++;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
353 AddFailedUIDInstance(sopInstanceUid);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
354 LOG(ERROR) << "C-GET SCP: Cannot transcode " << sopClassUid
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
355 << " from transfer syntax " << GetTransferSyntaxUid(sourceSyntax)
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
356 << " to " << GetTransferSyntaxUid(selectedSyntax);
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
357 return DIMSE_NOVALIDPRESENTATIONCONTEXTID;
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
358 }
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
359 }
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
360
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
361 if (cond.good())
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
362 {
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
363 if (cancelParameters.cancelEncountered)
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
364 {
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
365 if (origPresId_ == cancelParameters.presId &&
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
366 origMsgId_ == cancelParameters.req.MessageIDBeingRespondedTo)
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
367 {
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
368 getCancelled_ = OFTrue;
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
369 }
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
370 else
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
371 {
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
372 LOG(ERROR) << "C-GET SCP: Unexpected C-Cancel-RQ encountered: pid=" << (int)cancelParameters.presId
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
373 << ", mid=" << (int)cancelParameters.req.MessageIDBeingRespondedTo;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
374 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
375 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
376
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
377 if (rsp.DimseStatus == STATUS_Success)
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
378 {
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
379 // everything ok
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
380 nCompleted_++;
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
381 }
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
382 else if ((rsp.DimseStatus & 0xf000) == 0xb000)
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
383 {
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
384 // a warning status message
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
385 warningCount_++;
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
386 LOG(ERROR) << "C-GET SCP: Store Warning: Response Status: "
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
387 << DU_cstoreStatusString(rsp.DimseStatus);
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
388 }
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
389 else
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
390 {
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
391 nFailed_++;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
392 AddFailedUIDInstance(sopInstanceUid);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
393 // print a status message
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
394 LOG(ERROR) << "C-GET SCP: Store Failed: Response Status: "
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
395 << DU_cstoreStatusString(rsp.DimseStatus);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
396 }
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
397 }
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
398 else
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
399 {
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
400 nFailed_++;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
401 AddFailedUIDInstance(sopInstanceUid);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
402 OFString temp_str;
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
403 LOG(ERROR) << "C-GET SCP: storeSCU: Store Request Failed: " << DimseCondition::dump(temp_str, cond);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
404 }
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
405
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
406 if (stDetail.get() != NULL)
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
407 {
3963
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
408 // It is impossible to directly use the "<<" stream construct
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
409 // with "DcmObject::PrintHelper" using MSVC2008
3962
d30eb4ae5bb6 trying a fix for msvc2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3959
diff changeset
410 std::stringstream s;
3963
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
411 DcmObject::PrintHelper obj(*stDetail);
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
412 obj.dcmobj_.print(s);
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
413
3b0c555f16a3 fix msvc2008
s.jodogne@gmail.com
parents: 3962
diff changeset
414 LOG(INFO) << " Status Detail: " << s.str();
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
415 }
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
416
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
417 return cond;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
418 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
419
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
420 bool OrthancGetRequestHandler::LookupIdentifiers(std::list<std::string>& publicIds,
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
421 ResourceType level,
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
422 const DicomMap& input) const
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
423 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
424 DicomTag tag(0, 0); // Dummy initialization
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
425
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
426 switch (level)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
427 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
428 case ResourceType_Patient:
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
429 tag = DICOM_TAG_PATIENT_ID;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
430 break;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
431
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
432 case ResourceType_Study:
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
433 tag = (input.HasTag(DICOM_TAG_ACCESSION_NUMBER) ?
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
434 DICOM_TAG_ACCESSION_NUMBER : DICOM_TAG_STUDY_INSTANCE_UID);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
435 break;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
436
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
437 case ResourceType_Series:
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
438 tag = DICOM_TAG_SERIES_INSTANCE_UID;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
439 break;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
440
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
441 case ResourceType_Instance:
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
442 tag = DICOM_TAG_SOP_INSTANCE_UID;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
443 break;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
444
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
445 default:
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
446 throw OrthancException(ErrorCode_ParameterOutOfRange);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
447 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
448
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
449 if (!input.HasTag(tag))
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
450 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
451 return false;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
452 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
453
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
454 const DicomValue& value = input.GetValue(tag);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
455 if (value.IsNull() ||
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
456 value.IsBinary())
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
457 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
458 return false;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
459 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
460 else
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
461 {
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
462 std::vector<std::string> tokens;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
463 Toolbox::TokenizeString(tokens, value.GetContent(), '\\');
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
464
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
465 for (size_t i = 0; i < tokens.size(); i++)
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
466 {
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
467 std::vector<std::string> tmp;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
468 context_.GetIndex().LookupIdentifierExact(tmp, level, tag, tokens[i]);
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
469
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
470 if (tmp.empty())
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
471 {
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
472 LOG(ERROR) << "C-GET: Cannot locate resource \"" << tokens[i]
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
473 << "\" at the " << EnumerationToString(level) << " level";
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
474 return false;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
475 }
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
476 else
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
477 {
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
478 for (size_t i = 0; i < tmp.size(); i++)
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
479 {
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
480 publicIds.push_back(tmp[i]);
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
481 }
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
482 }
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
483 }
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
484
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
485 return true;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
486 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
487 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
488
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
489
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
490 OrthancGetRequestHandler::OrthancGetRequestHandler(ServerContext& context) :
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
491 context_(context)
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
492 {
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
493 position_ = 0;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
494 nRemaining_ = 0;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
495 nCompleted_ = 0;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
496 warningCount_ = 0;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
497 nFailed_ = 0;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
498 timeout_ = 0;
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
499 }
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
500
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
501
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
502 bool OrthancGetRequestHandler::Handle(const DicomMap& input,
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
503 const std::string& originatorIp,
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
504 const std::string& originatorAet,
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
505 const std::string& calledAet,
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
506 uint32_t timeout)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
507 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
508 MetricsRegistry::Timer timer(context_.GetMetricsRegistry(), "orthanc_get_scp_duration_ms");
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
509
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3955
diff changeset
510 LOG(WARNING) << "C-GET-SCU request received from AET \"" << originatorAet << "\"";
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
511
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
512 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
513 DicomArray query(input);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
514 for (size_t i = 0; i < query.GetSize(); i++)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
515 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
516 if (!query.GetElement(i).GetValue().IsNull())
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
517 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
518 LOG(INFO) << " " << query.GetElement(i).GetTag()
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
519 << " " << FromDcmtkBridge::GetTagName(query.GetElement(i))
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
520 << " = " << query.GetElement(i).GetValue().GetContent();
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
521 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
522 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
523 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
524
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
525 /**
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
526 * Retrieve the query level.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
527 **/
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
528
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
529 const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
530
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
531 assert(levelTmp != NULL);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
532 ResourceType level = StringToResourceType(levelTmp->GetContent().c_str());
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
533
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
534
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
535 /**
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
536 * Lookup for the resource to be sent.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
537 **/
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
538
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
539 std::list<std::string> publicIds;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
540
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
541 if (!LookupIdentifiers(publicIds, level, input))
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
542 {
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
543 LOG(ERROR) << "Cannot determine what resources are requested by C-GET";
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
544 return false;
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
545 }
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
546
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
547 localAet_ = context_.GetDefaultLocalApplicationEntityTitle();
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
548 position_ = 0;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
549 originatorAet_ = originatorAet;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
550
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
551 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
552 OrthancConfiguration::ReaderLock lock;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
553 remote_ = lock.GetConfiguration().GetModalityUsingAet(originatorAet);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
554 }
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
555
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
556 for (std::list<std::string>::const_iterator
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
557 resource = publicIds.begin(); resource != publicIds.end(); ++resource)
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
558 {
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
559 LOG(INFO) << "C-GET: Sending resource " << *resource
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
560 << " to modality \"" << originatorAet << "\"";
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
561
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
562 std::list<std::string> tmp;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
563 context_.GetIndex().GetChildInstances(tmp, *resource);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
564
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
565 instances_.reserve(tmp.size());
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
566 for (std::list<std::string>::iterator it = tmp.begin(); it != tmp.end(); ++it)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
567 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
568 instances_.push_back(*it);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
569 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
570 }
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
571
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3859
diff changeset
572 failedUIDs_.clear();
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
573 getCancelled_ = OFFalse;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
574
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
575 nRemaining_ = GetSubOperationCount();
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
576 nCompleted_ = 0;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
577 nFailed_ = 0;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
578 warningCount_ = 0;
3955
66879215cbf3 C-GET: add timeout, fix uninitalized priority, support multiple resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3954
diff changeset
579 timeout_ = timeout;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
580
3954
67b457283499 coding style
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
581 return true;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
582 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
diff changeset
583 };