annotate OrthancStone/Sources/Loaders/BasicFetchingStrategy.h @ 2177:4d21befb1501 default tip

clarify DICOMweb version check
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Oct 2024 19:27:56 +0200
parents 16c01cc201e7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
2124
16c01cc201e7 updated copyright, as Osimis is not active on Orthanc anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2114
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
2114
c23eef785569 update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2077
diff changeset
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
16 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
17 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
20 * <http://www.gnu.org/licenses/>.
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "IFetchingItemsSorter.h"
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "IFetchingStrategy.h"
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1298
diff changeset
29 #include <Compatibility.h>
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
30
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <memory>
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 namespace OrthancStone
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 class BasicFetchingStrategy : public IFetchingStrategy
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 private:
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 class ContentItem
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 private:
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 unsigned int item_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 unsigned int quality_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 public:
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 ContentItem(unsigned int item,
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 unsigned int quality) :
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 item_(item),
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 quality_(quality)
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 unsigned int GetItem() const
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 return item_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 unsigned int GetQuality() const
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 return quality_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 };
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
63 std::unique_ptr<IFetchingItemsSorter> sorter_;
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 std::vector<unsigned int> nextQuality_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 unsigned int maxQuality_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 std::vector<ContentItem> content_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 size_t position_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 unsigned int blockSize_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 void Schedule(unsigned int item,
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 unsigned int quality);
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 public:
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 BasicFetchingStrategy(IFetchingItemsSorter* sorter, // Takes ownership
1755
1a775f4ee672 added ability to specify initial slice in
bgo@SHARKNADO.localdomain
parents: 1739
diff changeset
75 unsigned int maxQuality,
1a775f4ee672 added ability to specify initial slice in
bgo@SHARKNADO.localdomain
parents: 1739
diff changeset
76 unsigned int initialItem = 0);
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
78 virtual unsigned int GetItemsCount() const ORTHANC_OVERRIDE
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 return sorter_->GetItemsCount();
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 }
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
83 virtual unsigned int GetMaxQuality() const ORTHANC_OVERRIDE
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 return maxQuality_;
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 // WARNING - This parameters is only considered during the next
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 // call to SetCurrent().
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 void SetBlockSize(unsigned int size);
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 virtual bool GetNext(unsigned int& item,
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
93 unsigned int& quality) ORTHANC_OVERRIDE;
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
95 virtual void SetCurrent(unsigned int item) ORTHANC_OVERRIDE;
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
97 virtual void RecycleFurthest(unsigned int& item) ORTHANC_OVERRIDE;
708
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 };
51976977d2d3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 }