0
|
1 /**
|
|
2 * Transfers accelerator plugin for Orthanc
|
19
|
3 * Copyright (C) 2018-2020 Osimis S.A., Belgium
|
0
|
4 *
|
|
5 * This program is free software: you can redistribute it and/or
|
|
6 * modify it under the terms of the GNU Affero General Public License
|
|
7 * as published by the Free Software Foundation, either version 3 of
|
|
8 * the License, or (at your option) any later version.
|
|
9 *
|
|
10 * This program is distributed in the hope that it will be useful, but
|
|
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 * Affero General Public License for more details.
|
|
14 *
|
|
15 * You should have received a copy of the GNU Affero General Public License
|
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 **/
|
|
18
|
|
19
|
|
20 #pragma once
|
|
21
|
|
22 #include "OrthancInstancesCache.h"
|
|
23
|
|
24
|
|
25 namespace OrthancPlugins
|
|
26 {
|
|
27 class TransferScheduler : public boost::noncopyable
|
|
28 {
|
|
29 private:
|
|
30 void AddResource(OrthancInstancesCache& cache,
|
|
31 Orthanc::ResourceType level,
|
|
32 const std::string& id);
|
|
33
|
|
34 void ComputeBucketsInternal(std::vector<TransferBucket>& target,
|
|
35 size_t groupThreshold,
|
|
36 size_t separateThreshold,
|
|
37 const std::string& baseUrl, /* only needed in pull mode */
|
|
38 BucketCompression compression /* only needed in pull mode */) const;
|
|
39
|
|
40 typedef std::map<std::string, DicomInstanceInfo> Instances;
|
|
41
|
|
42 Instances instances_;
|
|
43
|
|
44
|
|
45 public:
|
|
46 void AddPatient(OrthancInstancesCache& cache,
|
|
47 const std::string& patient)
|
|
48 {
|
|
49 AddResource(cache, Orthanc::ResourceType_Patient, patient);
|
|
50 }
|
|
51
|
|
52 void AddStudy(OrthancInstancesCache& cache,
|
|
53 const std::string& study)
|
|
54 {
|
|
55 AddResource(cache, Orthanc::ResourceType_Study, study);
|
|
56 }
|
|
57
|
|
58 void AddSeries(OrthancInstancesCache& cache,
|
|
59 const std::string& series)
|
|
60 {
|
|
61 AddResource(cache, Orthanc::ResourceType_Series, series);
|
|
62 }
|
|
63
|
|
64 void AddInstance(OrthancInstancesCache& cache,
|
|
65 const std::string& instanceId);
|
|
66
|
|
67 void AddInstance(const DicomInstanceInfo& info);
|
|
68
|
|
69 void ParseListOfResources(OrthancInstancesCache& cache,
|
|
70 const Json::Value& resources);
|
|
71
|
|
72 void ListInstances(std::vector<DicomInstanceInfo>& target) const;
|
|
73
|
|
74 size_t GetInstancesCount() const
|
|
75 {
|
|
76 return instances_.size();
|
|
77 }
|
|
78
|
|
79 size_t GetTotalSize() const;
|
|
80
|
|
81 void ComputePullBuckets(std::vector<TransferBucket>& target,
|
|
82 size_t groupThreshold,
|
|
83 size_t separateThreshold,
|
|
84 const std::string& baseUrl,
|
|
85 BucketCompression compression) const;
|
|
86
|
|
87 void FormatPushTransaction(Json::Value& target,
|
|
88 std::vector<TransferBucket>& buckets,
|
|
89 size_t groupThreshold,
|
|
90 size_t separateThreshold,
|
|
91 BucketCompression compression) const;
|
|
92 };
|
|
93 }
|