Mercurial > hg > orthanc
comparison OrthancFramework/Sources/DicomNetworking/DicomStoreUserConnection.h @ 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 | Core/DicomNetworking/DicomStoreUserConnection.h@8f7ad4989fec |
children | e00f3d089991 |
comparison
equal
deleted
inserted
replaced
4043:6c6239aec462 | 4044:d25f4c0fa160 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
36 #if !defined(ORTHANC_ENABLE_DCMTK_TRANSCODING) | |
37 # error Macro ORTHANC_ENABLE_DCMTK_TRANSCODING must be defined to use this file | |
38 #endif | |
39 | |
40 #include "DicomAssociationParameters.h" | |
41 | |
42 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 | |
43 # include "../DicomParsing/IDicomTranscoder.h" | |
44 #endif | |
45 | |
46 #include <boost/shared_ptr.hpp> | |
47 #include <boost/noncopyable.hpp> | |
48 #include <set> | |
49 #include <stdint.h> // For uint8_t | |
50 | |
51 | |
52 class DcmFileFormat; | |
53 | |
54 namespace Orthanc | |
55 { | |
56 /** | |
57 | |
58 Orthanc < 1.7.0: | |
59 | |
60 Input | Output | |
61 -------------+--------------------------------------------- | |
62 Compressed | Same transfer syntax | |
63 Uncompressed | Same transfer syntax, or other uncompressed | |
64 | |
65 Orthanc >= 1.7.0: | |
66 | |
67 Input | Output | |
68 -------------+--------------------------------------------- | |
69 Compressed | Same transfer syntax, or uncompressed | |
70 Uncompressed | Same transfer syntax, or other uncompressed | |
71 | |
72 **/ | |
73 | |
74 class DicomAssociation; // Forward declaration for PImpl design pattern | |
75 | |
76 class DicomStoreUserConnection : public boost::noncopyable | |
77 { | |
78 private: | |
79 typedef std::map<std::string, std::set<DicomTransferSyntax> > RegisteredClasses; | |
80 | |
81 // "ProposedOriginalClasses" keeps track of the storage classes | |
82 // that were proposed with a single transfer syntax | |
83 typedef std::set< std::pair<std::string, DicomTransferSyntax> > ProposedOriginalClasses; | |
84 | |
85 DicomAssociationParameters parameters_; | |
86 boost::shared_ptr<DicomAssociation> association_; // "shared_ptr" is for PImpl | |
87 RegisteredClasses registeredClasses_; | |
88 ProposedOriginalClasses proposedOriginalClasses_; | |
89 bool proposeCommonClasses_; | |
90 bool proposeUncompressedSyntaxes_; | |
91 bool proposeRetiredBigEndian_; | |
92 | |
93 // Return "false" if there is not enough room remaining in the association | |
94 bool ProposeStorageClass(const std::string& sopClassUid, | |
95 const std::set<DicomTransferSyntax>& syntaxes); | |
96 | |
97 bool LookupPresentationContext(uint8_t& presentationContextId, | |
98 const std::string& sopClassUid, | |
99 DicomTransferSyntax transferSyntax); | |
100 | |
101 bool NegotiatePresentationContext(uint8_t& presentationContextId, | |
102 const std::string& sopClassUid, | |
103 DicomTransferSyntax transferSyntax); | |
104 | |
105 void LookupTranscoding(std::set<DicomTransferSyntax>& acceptedSyntaxes, | |
106 const std::string& sopClassUid, | |
107 DicomTransferSyntax sourceSyntax); | |
108 | |
109 public: | |
110 DicomStoreUserConnection(const DicomAssociationParameters& params); | |
111 | |
112 const DicomAssociationParameters& GetParameters() const | |
113 { | |
114 return parameters_; | |
115 } | |
116 | |
117 void SetCommonClassesProposed(bool proposed) | |
118 { | |
119 proposeCommonClasses_ = proposed; | |
120 } | |
121 | |
122 bool IsCommonClassesProposed() const | |
123 { | |
124 return proposeCommonClasses_; | |
125 } | |
126 | |
127 void SetUncompressedSyntaxesProposed(bool proposed) | |
128 { | |
129 proposeUncompressedSyntaxes_ = proposed; | |
130 } | |
131 | |
132 bool IsUncompressedSyntaxesProposed() const | |
133 { | |
134 return proposeUncompressedSyntaxes_; | |
135 } | |
136 | |
137 void SetRetiredBigEndianProposed(bool propose) | |
138 { | |
139 proposeRetiredBigEndian_ = propose; | |
140 } | |
141 | |
142 bool IsRetiredBigEndianProposed() const | |
143 { | |
144 return proposeRetiredBigEndian_; | |
145 } | |
146 | |
147 void RegisterStorageClass(const std::string& sopClassUid, | |
148 DicomTransferSyntax syntax); | |
149 | |
150 void Store(std::string& sopClassUid, | |
151 std::string& sopInstanceUid, | |
152 DcmFileFormat& dicom, | |
153 bool hasMoveOriginator, | |
154 const std::string& moveOriginatorAET, | |
155 uint16_t moveOriginatorID); | |
156 | |
157 void Store(std::string& sopClassUid, | |
158 std::string& sopInstanceUid, | |
159 const void* buffer, | |
160 size_t size, | |
161 bool hasMoveOriginator, | |
162 const std::string& moveOriginatorAET, | |
163 uint16_t moveOriginatorID); | |
164 | |
165 void LookupParameters(std::string& sopClassUid, | |
166 std::string& sopInstanceUid, | |
167 DicomTransferSyntax& transferSyntax, | |
168 DcmFileFormat& dicom); | |
169 | |
170 void Transcode(std::string& sopClassUid /* out */, | |
171 std::string& sopInstanceUid /* out */, | |
172 IDicomTranscoder& transcoder, | |
173 const void* buffer, | |
174 size_t size, | |
175 bool hasMoveOriginator, | |
176 const std::string& moveOriginatorAET, | |
177 uint16_t moveOriginatorID); | |
178 }; | |
179 } |