Mercurial > hg > orthanc-stone
annotate Applications/Resources/Graveyard/LoaderCache.cpp @ 2114:c23eef785569
update year to 2024
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 Jan 2024 16:44:04 +0100 |
parents | 07964689cb0b |
children | 16c01cc201e7 |
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 |
2114
c23eef785569
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2077
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
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 |
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. |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
17 * |
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 #include "LoaderCache.h" |
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 "../StoneException.h" |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 #include "OrthancSeriesVolumeProgressiveLoader.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 #include "OrthancMultiframeVolumeLoader.h" |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
27 #include "DicomStructureSetLoader.h" |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
28 #include "../Toolbox/GenericToolbox.h" |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
29 |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
30 #include "../Loaders/ILoadersContext.h" |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
31 |
930 | 32 #if ORTHANC_ENABLE_WASM == 1 |
33 # include <unistd.h> | |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
34 # include "../Oracle/WebAssemblyOracle.h" |
930 | 35 #else |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
36 # include "../Oracle/ThreadedOracle.h" |
930 | 37 #endif |
38 | |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
39 #include "../Volumes/DicomVolumeImage.h" |
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
40 #include "../Volumes/DicomVolumeImageMPRSlicer.h" |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
41 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1439
diff
changeset
|
42 #include <OrthancException.h> |
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1439
diff
changeset
|
43 #include <Toolbox.h> |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 |
1337
b1396be5aa27
Moved the fixed loaders back from the dead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1327
diff
changeset
|
45 namespace OrthancStone |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
46 { |
1415
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
47 LoaderCache::LoaderCache(OrthancStone::ILoadersContext& loadersContext, bool useCtProgressiveQuality) |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
48 : loadersContext_(loadersContext) |
1415
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
49 , useCtProgressiveQuality_(useCtProgressiveQuality) |
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
50 |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1108
diff
changeset
|
55 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
56 LoaderCache::GetSeriesVolumeProgressiveLoader(std::string seriesUuid) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
57 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 try |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
59 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 // normalize keys a little |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
61 GenericToolbox::NormalizeUuid(seriesUuid); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
62 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
63 // find in cache |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 if (seriesVolumeProgressiveLoaders_.find(seriesUuid) == seriesVolumeProgressiveLoaders_.end()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 { |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
66 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
67 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1108
diff
changeset
|
68 boost::shared_ptr<OrthancStone::DicomVolumeImage> volumeImage(new OrthancStone::DicomVolumeImage); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> loader; |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
70 |
1327
4f8db2d202c8
OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents:
1314
diff
changeset
|
71 // true means "use progressive quality" |
4f8db2d202c8
OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents:
1314
diff
changeset
|
72 // false means "load high quality slices only" |
1415
998697c5ec74
Added useProgressiveQuality flag to LoaderCache ctor
Benjamin Golinvaux <bgo@osimis.io>
parents:
1413
diff
changeset
|
73 loader = OrthancSeriesVolumeProgressiveLoader::Create(loadersContext_, volumeImage, useCtProgressiveQuality_); |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
74 loader->LoadSeries(seriesUuid); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 seriesVolumeProgressiveLoaders_[seriesUuid] = loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 } |
933
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
77 else |
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
78 { |
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
79 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : returning cached loader for seriesUUid = " << seriesUuid; |
f75f6cb69c1b
Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents:
930
diff
changeset
|
80 } |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
81 return seriesVolumeProgressiveLoaders_[seriesUuid]; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 catch (const Orthanc::OrthancException& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
85 if (e.HasDetails()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
87 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What() << " Details: " << e.GetDetails(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
88 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
90 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
91 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What(); |
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 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
94 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
95 catch (const std::exception& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
96 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
97 LOG(ERROR) << "std::exception in LoaderCache: " << e.what(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
98 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
99 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
100 catch (...) |
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 LOG(ERROR) << "Unknown exception in LoaderCache"; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
104 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
106 |
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:
933
diff
changeset
|
107 boost::shared_ptr<OrthancMultiframeVolumeLoader> LoaderCache::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:
933
diff
changeset
|
108 { |
1413
cde379b9d1d2
LoaderCache is now extensible + factored the uuid normalizing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
109 // normalize keys a little |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
110 GenericToolbox::NormalizeUuid(instanceUuid); |
1413
cde379b9d1d2
LoaderCache is now extensible + factored the uuid normalizing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
111 |
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:
933
diff
changeset
|
112 // if the loader is not available, let's trigger its creation |
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:
933
diff
changeset
|
113 if(multiframeVolumeLoaders_.find(instanceUuid) == multiframeVolumeLoaders_.end()) |
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:
933
diff
changeset
|
114 { |
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:
933
diff
changeset
|
115 GetMultiframeDicomVolumeImageMPRSlicer(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:
933
diff
changeset
|
116 } |
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:
933
diff
changeset
|
117 ORTHANC_ASSERT(multiframeVolumeLoaders_.find(instanceUuid) != multiframeVolumeLoaders_.end()); |
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:
933
diff
changeset
|
118 |
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:
933
diff
changeset
|
119 return multiframeVolumeLoaders_[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:
933
diff
changeset
|
120 } |
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:
933
diff
changeset
|
121 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1108
diff
changeset
|
122 boost::shared_ptr<OrthancStone::DicomVolumeImageMPRSlicer> LoaderCache::GetMultiframeDicomVolumeImageMPRSlicer(std::string instanceUuid) |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
123 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
124 try |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
125 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
126 // normalize keys a little |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
127 GenericToolbox::NormalizeUuid(instanceUuid); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
128 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
129 // find in cache |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
130 if (dicomVolumeImageMPRSlicers_.find(instanceUuid) == dicomVolumeImageMPRSlicers_.end()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 { |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
132 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1108
diff
changeset
|
133 boost::shared_ptr<OrthancStone::DicomVolumeImage> volumeImage(new OrthancStone::DicomVolumeImage); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 boost::shared_ptr<OrthancMultiframeVolumeLoader> loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
135 { |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
136 loader = OrthancMultiframeVolumeLoader::Create(loadersContext_, volumeImage); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
137 loader->LoadInstance(instanceUuid); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
139 multiframeVolumeLoaders_[instanceUuid] = loader; |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1108
diff
changeset
|
140 boost::shared_ptr<OrthancStone::DicomVolumeImageMPRSlicer> mprSlicer(new OrthancStone::DicomVolumeImageMPRSlicer(volumeImage)); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 dicomVolumeImageMPRSlicers_[instanceUuid] = mprSlicer; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 return dicomVolumeImageMPRSlicers_[instanceUuid]; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
144 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 catch (const Orthanc::OrthancException& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
146 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 if (e.HasDetails()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
148 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What() << " Details: " << e.GetDetails(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
150 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
151 else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
152 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
153 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
154 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
155 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
156 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
157 catch (const std::exception& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
158 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
159 LOG(ERROR) << "std::exception in LoaderCache: " << e.what(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
160 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
161 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
162 catch (...) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
163 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
164 LOG(ERROR) << "Unknown exception in LoaderCache"; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
165 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
166 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
167 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
168 |
1438
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
169 std::string LoaderCache::BuildDicomStructureSetLoaderKey( |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
170 const std::string& instanceUuid, |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
171 const std::string& uniqueKey) |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
172 { |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
173 return instanceUuid + "_" + uniqueKey; |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
174 } |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
175 |
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
176 boost::shared_ptr<DicomStructureSetLoader> LoaderCache::GetDicomStructureSetLoader( |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
177 std::string inInstanceUuid, |
1438
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
178 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
|
179 const std::string& uniqueKey) |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
180 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
181 try |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
182 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
183 // normalize keys a little |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
184 GenericToolbox::NormalizeUuid(inInstanceUuid); |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
185 |
1438
96044a18b98d
DicomStructureSetLoader instances are now indexed by their instanceid AND
Benjamin Golinvaux <bgo@osimis.io>
parents:
1415
diff
changeset
|
186 std::string entryKey = BuildDicomStructureSetLoaderKey(inInstanceUuid, uniqueKey); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
187 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
188 // find in cache |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
189 if (dicomStructureSetLoaders_.find(entryKey) == dicomStructureSetLoaders_.end()) |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
190 { |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
191 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
192 |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
193 boost::shared_ptr<DicomStructureSetLoader> loader; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
194 { |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
195 loader = DicomStructureSetLoader::Create(loadersContext_); |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
196 loader->LoadInstance(inInstanceUuid, initiallyVisibleStructures); |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
197 } |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
198 dicomStructureSetLoaders_[entryKey] = loader; |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
199 } |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1001
diff
changeset
|
200 return dicomStructureSetLoaders_[entryKey]; |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
201 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
202 catch (const Orthanc::OrthancException& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
203 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
204 if (e.HasDetails()) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
205 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
206 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What() << " Details: " << e.GetDetails(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
207 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
208 else |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
209 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
210 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
211 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
212 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
213 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
214 catch (const std::exception& e) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
215 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
216 LOG(ERROR) << "std::exception in LoaderCache: " << e.what(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
217 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
218 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
219 catch (...) |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
220 { |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
221 LOG(ERROR) << "Unknown exception in LoaderCache"; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
222 throw; |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
223 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
224 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
225 |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
226 void LoaderCache::ClearCache() |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
227 { |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
228 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock()); |
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
|
229 |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
230 #ifndef NDEBUG |
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
|
231 // ISO way of checking for debug builds |
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
|
232 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
|
233 #endif |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
234 seriesVolumeProgressiveLoaders_.clear(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
235 multiframeVolumeLoaders_.clear(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
236 dicomVolumeImageMPRSlicers_.clear(); |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
237 dicomStructureSetLoaders_.clear(); |
1001
e704a53c9d0a
LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents:
963
diff
changeset
|
238 |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
239 } |
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
240 |
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
|
241 template<typename T> void DebugDisplayObjRefCountsInMap( |
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
|
242 const std::string& name, const std::map<std::string, boost::shared_ptr<T> >& myMap) |
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
|
243 { |
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
|
244 LOG(TRACE) << "Map \"" << name << "\" ref counts:"; |
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
|
245 size_t i = 0; |
963
d358593820b8
removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
961
diff
changeset
|
246 for (typename std::map<std::string, boost::shared_ptr<T> >::const_iterator |
d358593820b8
removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
961
diff
changeset
|
247 it = myMap.begin(); it != myMap.end(); ++it) |
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
|
248 { |
963
d358593820b8
removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
961
diff
changeset
|
249 LOG(TRACE) << " element #" << i << ": ref count = " << it->second.use_count(); |
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
|
250 i++; |
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
|
251 } |
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
|
252 } |
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
|
253 |
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
|
254 void LoaderCache::DebugDisplayObjRefCounts() |
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
|
255 { |
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
|
256 DebugDisplayObjRefCountsInMap("seriesVolumeProgressiveLoaders_", seriesVolumeProgressiveLoaders_); |
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
|
257 DebugDisplayObjRefCountsInMap("multiframeVolumeLoaders_", multiframeVolumeLoaders_); |
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
|
258 DebugDisplayObjRefCountsInMap("dicomVolumeImageMPRSlicers_", dicomVolumeImageMPRSlicers_); |
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
|
259 DebugDisplayObjRefCountsInMap("dicomStructureSetLoaders_", dicomStructureSetLoaders_); |
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
|
260 } |
929
408bcc6c1505
Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
261 } |