annotate OrthancServer/ServerIndex.h @ 2531:b7ed112ce56e

DownloadOrthancFramework.cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Apr 2018 16:24:33 +0200
parents 878b59270859
children 389d050a2e66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1898
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1286
diff changeset
4 * Department, University Hospital of Liege, Belgium
2447
878b59270859 upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
11 *
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
12 * In addition, as a special exception, the copyright holders of this
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
13 * program give permission to link the code of its release with the
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
16 * the linked executables. You must obey the GNU General Public License
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
20 * you do not wish to do so, delete this exception statement from your
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
21 * version. If you delete this exception statement from all source files
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
22 * in the program, then also delete it here.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include <boost/thread.hpp>
220
bb8c260c0092 fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
37 #include <boost/noncopyable.hpp>
511
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
38 #include "../Core/Cache/LeastRecentlyUsedIndex.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include "../Core/SQLite/Connection.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include "../Core/DicomFormat/DicomMap.h"
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 136
diff changeset
41 #include "../Core/DicomFormat/DicomInstanceHasher.h"
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 181
diff changeset
42 #include "ServerEnumerations.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
44 #include "IDatabaseWrapper.h"
186
f68c039b0571 preparing refactoring of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
45
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
46 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
48 class LookupResource;
226
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
49 class ServerContext;
1822
9ed9458aa44f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1757
diff changeset
50 class DicomInstanceToStore;
2209
e3fd5bc429a2 URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2188
diff changeset
51 class ParsedDicomFile;
226
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
52
220
bb8c260c0092 fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
53 class ServerIndex : public boost::noncopyable
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
55 public:
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
56 typedef std::list<FileInfo> Attachments;
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
57 typedef std::map< std::pair<ResourceType, MetadataType>, std::string> MetadataMap;
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
58
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 private:
1432
0ac74fa21db8 rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
60 class Listener;
278
771f12042be9 more efficient determination of storage size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 272
diff changeset
61 class Transaction;
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
62 class UnstableResourcePayload;
278
771f12042be9 more efficient determination of storage size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 272
diff changeset
63
511
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
64 bool done_;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 boost::mutex mutex_;
206
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
66 boost::thread flushThread_;
511
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
67 boost::thread unstableResourcesMonitorThread_;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
1432
0ac74fa21db8 rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
69 std::auto_ptr<Listener> listener_;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
70 IDatabaseWrapper& db_;
511
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
71 LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload> unstableResources_;
180
626777d01dc4 use of hashes to index dicom objects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
72
278
771f12042be9 more efficient determination of storage size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 272
diff changeset
73 uint64_t currentStorageSize_;
269
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
74 uint64_t maximumStorageSize_;
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
75 unsigned int maximumPatients_;
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
76
511
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
77 static void FlushThread(ServerIndex* that);
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
78
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
79 static void UnstableResourcesMonitorThread(ServerIndex* that);
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
80
202
1650557bd81a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
81 void MainDicomTagsToJson(Json::Value& result,
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
82 int64_t resourceId,
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
83 ResourceType resourceType);
198
663cc6c46d0a before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 197
diff changeset
84
585
b2357f1f026f fix types
jodogne
parents: 521
diff changeset
85 SeriesStatus GetSeriesStatus(int64_t id);
199
dfa2899d9960 refactoring cont
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 198
diff changeset
86
268
4bc02e2254ec preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
87 bool IsRecyclingNeeded(uint64_t instanceSize);
4bc02e2254ec preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
88
4bc02e2254ec preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
89 void Recycle(uint64_t instanceSize,
4bc02e2254ec preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
90 const std::string& newPatientId);
4bc02e2254ec preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
91
269
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
92 void StandaloneRecycling();
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
93
511
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
94 void MarkAsUnstable(int64_t id,
1177
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
95 Orthanc::ResourceType type,
5b2d8c280ac2 Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1162
diff changeset
96 const std::string& publicId);
511
3b735fdf320b monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
97
646
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
98 void GetStatisticsInternal(/* out */ uint64_t& compressedSize,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
99 /* out */ uint64_t& uncompressedSize,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
100 /* out */ unsigned int& countStudies,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
101 /* out */ unsigned int& countSeries,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
102 /* out */ unsigned int& countInstances,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
103 /* in */ int64_t id,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
104 /* in */ ResourceType type);
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
105
1238
6c07108ff1e2 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1237
diff changeset
106 bool GetMetadataAsInteger(int64_t& result,
1237
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
107 int64_t id,
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
108 MetadataType type);
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
109
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
110 void LogChange(int64_t internalId,
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
111 ChangeType changeType,
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
112 ResourceType resourceType,
1297
501432928727 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
113 const std::string& publicId);
1237
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
114
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
115 uint64_t IncrementGlobalSequenceInternal(GlobalProperty property);
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
116
1299
4ce47e8ed0d2 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1297
diff changeset
117 int64_t CreateResource(const std::string& publicId,
4ce47e8ed0d2 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1297
diff changeset
118 ResourceType type);
4ce47e8ed0d2 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1297
diff changeset
119
2188
7cfc2e0383b3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
120 void SetInstanceMetadata(std::map<MetadataType, std::string>& instanceMetadata,
7cfc2e0383b3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
121 int64_t instance,
7cfc2e0383b3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
122 MetadataType metadata,
7cfc2e0383b3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
123 const std::string& value);
7cfc2e0383b3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
124
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 public:
226
8a26a8e85edf refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
126 ServerIndex(ServerContext& context,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
127 IDatabaseWrapper& database);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
206
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
129 ~ServerIndex();
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
130
1453
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
131 void Stop();
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
132
269
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
133 uint64_t GetMaximumStorageSize() const
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
134 {
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
135 return maximumStorageSize_;
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
136 }
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
137
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
138 uint64_t GetMaximumPatientCount() const
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
139 {
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
140 return maximumPatients_;
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
141 }
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
142
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
143 // "size == 0" means no limit on the storage size
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
144 void SetMaximumStorageSize(uint64_t size);
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
145
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
146 // "count == 0" means no limit on the number of patients
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
147 void SetMaximumPatientCount(unsigned int count);
f6fdf5abe751 recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
148
1006
649d47854314 proper handling of metadata in Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1004
diff changeset
149 StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata,
1822
9ed9458aa44f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1757
diff changeset
150 DicomInstanceToStore& instance,
9ed9458aa44f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1757
diff changeset
151 const Attachments& attachments);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
238
e4148b0ab1d0 statistics URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 237
diff changeset
153 void ComputeStatistics(Json::Value& target);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
212
f276b175dcaf delete resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 206
diff changeset
155 bool LookupResource(Json::Value& result,
f276b175dcaf delete resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 206
diff changeset
156 const std::string& publicId,
f276b175dcaf delete resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 206
diff changeset
157 ResourceType expectedType);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
232
5368bbe813cf refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 231
diff changeset
159 bool LookupAttachment(FileInfo& attachment,
5368bbe813cf refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 231
diff changeset
160 const std::string& instanceUuid,
233
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 232
diff changeset
161 FileContentType contentType);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162
1354
3dd494f201a1 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1352
diff changeset
163 void GetAllUuids(std::list<std::string>& target,
190
b6cef9d45cc3 getallpublicids
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 187
diff changeset
164 ResourceType resourceType);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
1509
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1453
diff changeset
166 void GetAllUuids(std::list<std::string>& target,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1453
diff changeset
167 ResourceType resourceType,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1453
diff changeset
168 size_t since,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1453
diff changeset
169 size_t limit);
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1453
diff changeset
170
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1139
diff changeset
171 bool DeleteResource(Json::Value& target /* out */,
212
f276b175dcaf delete resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 206
diff changeset
172 const std::string& uuid,
f276b175dcaf delete resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 206
diff changeset
173 ResourceType expectedType);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
175 void GetChanges(Json::Value& target,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 int64_t since,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 unsigned int maxResults);
231
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
178
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
179 void GetLastChange(Json::Value& target);
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
180
231
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
181 void LogExportedResource(const std::string& publicId,
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
182 const std::string& remoteModality);
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
183
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
184 void GetExportedResources(Json::Value& target,
231
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
185 int64_t since,
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
186 unsigned int maxResults);
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
187
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
188 void GetLastExportedResource(Json::Value& target);
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
189
272
337c506461d2 protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 269
diff changeset
190 bool IsProtectedPatient(const std::string& publicId);
337c506461d2 protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 269
diff changeset
191
337c506461d2 protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 269
diff changeset
192 void SetProtectedPatient(const std::string& publicId,
337c506461d2 protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 269
diff changeset
193 bool isProtected);
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 278
diff changeset
194
714
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 702
diff changeset
195 void GetChildren(std::list<std::string>& result,
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 702
diff changeset
196 const std::string& publicId);
6a1dbba0cca7 new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 702
diff changeset
197
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 278
diff changeset
198 void GetChildInstances(std::list<std::string>& result,
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 278
diff changeset
199 const std::string& publicId);
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 278
diff changeset
200
306
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
201 void SetMetadata(const std::string& publicId,
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
202 MetadataType type,
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
203 const std::string& value);
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
204
438
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
205 void DeleteMetadata(const std::string& publicId,
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
206 MetadataType type);
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
207
306
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
208 bool LookupMetadata(std::string& target,
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
209 const std::string& publicId,
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
210 MetadataType type);
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
211
739
696dbb4fd390 api uniformization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
212 void ListAvailableMetadata(std::list<MetadataType>& target,
436
d51186bf7602 read access to metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
213 const std::string& publicId);
d51186bf7602 read access to metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
214
1002
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
215 bool GetMetadata(Json::Value& target,
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
216 const std::string& publicId);
b067017a8a5b anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
217
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
218 void ListAvailableAttachments(std::list<FileContentType>& target,
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
219 const std::string& publicId,
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
220 ResourceType expectedType);
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
221
306
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
222 bool LookupParent(std::string& target,
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
223 const std::string& publicId);
310
6ab6cdeedf4e global sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 306
diff changeset
224
6ab6cdeedf4e global sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 306
diff changeset
225 uint64_t IncrementGlobalSequence(GlobalProperty sequence);
315
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 310
diff changeset
226
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 310
diff changeset
227 void LogChange(ChangeType changeType,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 310
diff changeset
228 const std::string& publicId);
413
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
229
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
230 void DeleteChanges();
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
231
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
232 void DeleteExportedResources();
440
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
233
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
234 void GetStatistics(Json::Value& target,
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
235 const std::string& publicId);
521
2c739f76d0bb lookup tag values
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 511
diff changeset
236
646
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
237 void GetStatistics(/* out */ uint64_t& compressedSize,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
238 /* out */ uint64_t& uncompressedSize,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
239 /* out */ unsigned int& countStudies,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
240 /* out */ unsigned int& countSeries,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
241 /* out */ unsigned int& countInstances,
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
242 const std::string& publicId);
fb49bf72ac2d fix issue 7
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 615
diff changeset
243
1728
4941494b5dd8 rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1727
diff changeset
244 void LookupIdentifierExact(std::list<std::string>& result,
4941494b5dd8 rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1727
diff changeset
245 ResourceType level,
4941494b5dd8 rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1727
diff changeset
246 const DicomTag& tag,
4941494b5dd8 rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1727
diff changeset
247 const std::string& value);
615
ec0b7a51d7bd speed up find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
248
699
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
249 StoreStatus AddAttachment(const FileInfo& attachment,
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
250 const std::string& publicId);
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
251
702
7592a48e97e4 delete custom attachment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
252 void DeleteAttachment(const std::string& publicId,
7592a48e97e4 delete custom attachment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
253 FileContentType type);
1218
efece308018e report database version in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1177
diff changeset
254
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1247
diff changeset
255 void SetGlobalProperty(GlobalProperty property,
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1247
diff changeset
256 const std::string& value);
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1247
diff changeset
257
1218
efece308018e report database version in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1177
diff changeset
258 std::string GetGlobalProperty(GlobalProperty property,
efece308018e report database version in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1177
diff changeset
259 const std::string& defaultValue);
1352
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1299
diff changeset
260
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1299
diff changeset
261 bool GetMainDicomTags(DicomMap& result,
382439943749 ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1299
diff changeset
262 const std::string& publicId,
1677
a903d57d9f0c adaptation of search with patient tags at study level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
263 ResourceType expectedType,
a903d57d9f0c adaptation of search with patient tags at study level
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
264 ResourceType levelOfInterest);
1555
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
265
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
266 bool LookupResourceType(ResourceType& type,
d6a93e12b1c1 Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
267 const std::string& publicId);
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
268
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1555
diff changeset
269 unsigned int GetDatabaseVersion();
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
270
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
271 void FindCandidates(std::vector<std::string>& resources,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
272 std::vector<std::string>& instances,
1757
98abb8d7f905 ServerContext::Apply lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1753
diff changeset
273 const ::Orthanc::LookupResource& lookup);
1898
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1822
diff changeset
274
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1822
diff changeset
275 bool LookupParent(std::string& target,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1822
diff changeset
276 const std::string& publicId,
e018037d4d0e Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1822
diff changeset
277 ResourceType parentType);
2209
e3fd5bc429a2 URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2188
diff changeset
278
e3fd5bc429a2 URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2188
diff changeset
279 void ReconstructInstance(ParsedDicomFile& dicom);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 }