Mercurial > hg > orthanc-stone
annotate Applications/Resources/Graveyard/LoaderCache.h @ 1928:c73e696967b0 StoneWebViewer-2.3
StoneWebViewer-2.3
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Mar 2022 09:08:51 +0100 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 * |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Affero General Public License |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
16 * Affero General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
17 * |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Affero General Public License |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
20 **/ |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 #pragma once |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
24 #include "../Volumes/DicomVolumeImageMPRSlicer.h" |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
25 #include "OrthancSeriesVolumeProgressiveLoader.h" |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
26 #include "OrthancMultiframeVolumeLoader.h" |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
27 #include "DicomStructureSetLoader.h" |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
28 |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
29 #include <boost/shared_ptr.hpp> |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
31 #include <map> |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 #include <string> |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
33 #include <vector> |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 namespace OrthancStone |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 { |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
37 class ILoadersContext; |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
38 } |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 |
1337
b1396be5aa27
Moved the fixed loaders back from the dead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
40 namespace OrthancStone |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
41 { |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 class LoaderCache |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 public: |
1413
cde379b9d1d2
LoaderCache is now extensible + factored the uuid normalizing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
45 |
cde379b9d1d2
LoaderCache is now extensible + factored the uuid normalizing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
46 virtual ~LoaderCache() {} |
cde379b9d1d2
LoaderCache is now extensible + factored the uuid normalizing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
47 |
1415
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
48 /** |
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
49 By default, the CT loader in loader cache will only download the highest quality slices. |
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
50 If you pass true for useCtProgressiveQuality, jpeg (50/100 quality), then jpeg (90/100 quality) |
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
51 then eventually uncompressed 16-bit images will be loaded. |
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
52 */ |
1571 | 53 LoaderCache(OrthancStone::ILoadersContext& loadersContext, |
54 bool useCtProgressiveQuality); | |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 GetSeriesVolumeProgressiveLoader (std::string seriesUuid); |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
58 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
59 boost::shared_ptr<OrthancStone::DicomVolumeImageMPRSlicer> |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 GetMultiframeDicomVolumeImageMPRSlicer(std::string instanceUuid); |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
61 |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
62 boost::shared_ptr<OrthancMultiframeVolumeLoader> |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
63 GetMultiframeVolumeLoader(std::string instanceUuid); |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
64 |
1438
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
65 /** |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
66 The DicomStructureSetLoader instances are stored in a map and indexed |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
67 by a key built from instanceUuid and uniqueKey. |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
68 |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
69 If instanceUuid and uniqueKey correspond to an already existing loader, it is returned. |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
70 |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
71 Please note that initiallyVisibleStructures is only used if the call results in the creation |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
72 of a new loader. In that case, the value is passed to the constructor. |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
73 */ |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 boost::shared_ptr<DicomStructureSetLoader> |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
75 GetDicomStructureSetLoader( |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
76 std::string instanceUuid, |
1438
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
77 const std::vector<std::string>& initiallyVisibleStructures, |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
78 const std::string& uniqueKey = ""); |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
79 |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
80 std::string BuildDicomStructureSetLoaderKey( |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
81 const std::string& instanceUuid, |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
82 const std::string& uniqueKey = ""); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 void ClearCache(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 |
1413
cde379b9d1d2
LoaderCache is now extensible + factored the uuid normalizing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
86 protected: |
930 | 87 |
961
92e32e263ae9
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
88 void DebugDisplayObjRefCounts(); |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
89 |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
90 OrthancStone::ILoadersContext& loadersContext_; |
1415
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
91 bool useCtProgressiveQuality_; |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
92 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
93 std::map<std::string, boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> > |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
94 seriesVolumeProgressiveLoaders_; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
95 std::map<std::string, boost::shared_ptr<OrthancMultiframeVolumeLoader> > |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
96 multiframeVolumeLoaders_; |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
97 std::map<std::string, boost::shared_ptr<OrthancStone::DicomVolumeImageMPRSlicer> > |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 dicomVolumeImageMPRSlicers_; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
99 std::map<std::string, boost::shared_ptr<DicomStructureSetLoader> > |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 dicomStructureSetLoaders_; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
101 }; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 |