annotate OrthancServer/ServerContext.h @ 1004:a226e0959d8b lua-scripting

DicomInstanceToStore
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jul 2014 14:06:05 +0200
parents 1d35281d967c
children 84b6d7bca6db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
689
2d0a347e8cfc switch to 2014
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 407
diff changeset
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #pragma once
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
285
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
35 #include "../Core/Cache/MemoryCache.h"
234
7c1faef915a4 cleaning room
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
36 #include "../Core/FileStorage/CompressedFileStorageAccessor.h"
7c1faef915a4 cleaning room
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
37 #include "../Core/FileStorage/FileStorage.h"
226
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
38 #include "../Core/RestApi/RestApiOutput.h"
388
466c992a9a42 testing filters inside orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 376
diff changeset
39 #include "../Core/Lua/LuaContext.h"
285
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
40 #include "ServerIndex.h"
790
331eaf9d9d69 ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 778
diff changeset
41 #include "ParsedDicomFile.h"
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
42 #include "DicomProtocol/ReusableDicomUserConnection.h"
783
c9cdd53a6b31 main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
43 #include "Scheduler/ServerScheduler.h"
1004
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
44 #include "DicomInstanceToStore.h"
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 namespace Orthanc
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
227
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
48 /**
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
49 * This class is responsible for maintaining the storage area on the
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
50 * filesystem (including compression), as well as the index of the
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
51 * DICOM store. It implements the required locking mechanisms.
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
52 **/
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 class ServerContext
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 private:
285
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
56 class DicomCacheProvider : public ICachePageProvider
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
57 {
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
58 private:
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
59 ServerContext& context_;
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
60
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
61 public:
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
62 DicomCacheProvider(ServerContext& context) : context_(context)
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
63 {
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
64 }
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
65
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
66 virtual IDynamicObject* Provide(const std::string& id);
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
67 };
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
68
998
4136fab6a639 callback on stored instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
69 bool ApplyReceivedInstanceFilter(const Json::Value& simplified,
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
70 const std::string& remoteAet);
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
71
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
72 void ApplyOnStoredInstance(const std::string& instanceId,
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
73 const Json::Value& simplifiedDicom,
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
74 const Json::Value& metadata);
998
4136fab6a639 callback on stored instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 996
diff changeset
75
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 FileStorage storage_;
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ServerIndex index_;
232
5368bbe813cf refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 227
diff changeset
78 CompressedFileStorageAccessor accessor_;
236
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
79 bool compressionEnabled_;
285
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
80
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
81 DicomCacheProvider provider_;
778
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
82 boost::mutex dicomCacheMutex_;
285
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
83 MemoryCache dicomCache_;
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
84 ReusableDicomUserConnection scu_;
783
c9cdd53a6b31 main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
85 ServerScheduler scheduler_;
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
87 boost::mutex luaMutex_;
388
466c992a9a42 testing filters inside orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 376
diff changeset
88 LuaContext lua_;
466c992a9a42 testing filters inside orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 376
diff changeset
89
1004
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
90 StoreStatus Store(std::string& resultPublicId,
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
91 const char* dicomBuffer,
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
92 size_t dicomSize,
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
93 const ServerIndex::MetadataMap& metadata = ServerIndex::MetadataMap());
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
94
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 public:
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
96 class DicomCacheLocker : public boost::noncopyable
778
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
97 {
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
98 private:
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
99 ServerContext& that_;
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
100 ParsedDicomFile *dicom_;
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
101
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
102 public:
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
103 DicomCacheLocker(ServerContext& that,
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
104 const std::string& instancePublicId);
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
105
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
106 ~DicomCacheLocker();
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
107
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
108 ParsedDicomFile& GetDicom()
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
109 {
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
110 return *dicom_;
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
111 }
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
112 };
aebf0071020e refactoring of the mutex for the dicom cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
113
996
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
114 class LuaContextLocker : public boost::noncopyable
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
115 {
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
116 private:
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
117 ServerContext& that_;
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
118
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
119 public:
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
120 LuaContextLocker(ServerContext& that) : that_(that)
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
121 {
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
122 that.luaMutex_.lock();
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
123 }
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
124
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
125 ~LuaContextLocker()
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
126 {
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
127 that_.luaMutex_.unlock();
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
128 }
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
129
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
130 LuaContext& GetLua()
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
131 {
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
132 return that_.lua_;
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
133 }
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
134 };
cf52f3bcb2b3 clarification of Lua classes wrt multithreading
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 946
diff changeset
135
1003
1d35281d967c DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1002
diff changeset
136
376
2cef9c2d4148 separate path for SQLite index, manual loading of external dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
137 ServerContext(const boost::filesystem::path& storagePath,
2cef9c2d4148 separate path for SQLite index, manual loading of external dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
138 const boost::filesystem::path& indexPath);
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 ServerIndex& GetIndex()
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 {
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 return index_;
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 }
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
236
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
145 void SetCompressionEnabled(bool enabled);
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
146
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
147 bool IsCompressionEnabled() const
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
148 {
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
149 return compressionEnabled_;
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
150 }
6d9be2b470b4 compression
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 234
diff changeset
151
227
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
152 void RemoveFile(const std::string& fileUuid);
226
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
153
699
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
154 bool AddAttachment(const std::string& resourceId,
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
155 FileContentType attachmentType,
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
156 const void* data,
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
157 size_t size);
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
158
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
159
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
160 // TODO SIMPLIFY THESE MANY "Store" methods!
1004
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
161 StoreStatus Store(std::string& resultPublicId,
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
162 DicomInstanceToStore& dicom);
a226e0959d8b DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1003
diff changeset
163
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
164 StoreStatus Store(const char* dicomInstance,
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 size_t dicomSize,
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 const DicomMap& dicomSummary,
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 const Json::Value& dicomJson,
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
168 const std::string& remoteAet,
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
169 const ServerIndex::MetadataMap& metadata = ServerIndex::MetadataMap());
226
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
170
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
171 StoreStatus Store(std::string& resultPublicId,
791
381f90e2b69d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 790
diff changeset
172 ParsedDicomFile& dicomInstance,
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
173 const char* dicomBuffer,
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
174 size_t dicomSize,
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
175 const ServerIndex::MetadataMap& metadata = ServerIndex::MetadataMap());
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
176
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
177 StoreStatus Store(std::string& resultPublicId,
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
178 ParsedDicomFile& dicomInstance,
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
179 const ServerIndex::MetadataMap& metadata = ServerIndex::MetadataMap());
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
180
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
181 StoreStatus Store(std::string& resultPublicId,
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
182 const std::string& dicomContent,
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 998
diff changeset
183 const ServerIndex::MetadataMap& metadata = ServerIndex::MetadataMap());
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 285
diff changeset
184
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 695
diff changeset
185 void AnswerDicomFile(RestApiOutput& output,
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 695
diff changeset
186 const std::string& instancePublicId,
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 695
diff changeset
187 FileContentType content);
226
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
188
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
189 void ReadJson(Json::Value& result,
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
190 const std::string& instancePublicId);
227
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
191
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
192 // TODO CACHING MECHANISM AT THIS POINT
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
193 void ReadFile(std::string& result,
209ca3f6db62 dicom-scu from rest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
194 const std::string& instancePublicId,
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 695
diff changeset
195 FileContentType content,
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 695
diff changeset
196 bool uncompressIfNeeded = true);
285
4031f73fe0e4 access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 236
diff changeset
197
695
c59bc408fb10 parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
198 void SetStoreMD5ForAttachments(bool storeMD5);
c59bc408fb10 parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
199
c59bc408fb10 parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
200 bool IsStoreMD5ForAttachments() const
c59bc408fb10 parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
201 {
c59bc408fb10 parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
202 return accessor_.IsStoreMD5();
c59bc408fb10 parameter to disable the computation of the MD5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
203 }
771
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
204
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
205 ReusableDicomUserConnection& GetReusableDicomUserConnection()
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
206 {
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
207 return scu_;
537837f50fbb refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
208 }
783
c9cdd53a6b31 main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
209
c9cdd53a6b31 main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
210 ServerScheduler& GetScheduler()
c9cdd53a6b31 main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
211 {
c9cdd53a6b31 main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
212 return scheduler_;
c9cdd53a6b31 main scheduler added to the server context
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 771
diff changeset
213 }
224
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 };
4eb0c7ce86c9 refactoring for store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 }