annotate Framework/Loaders/LoaderCache.cpp @ 1337:b1396be5aa27 broker

Moved the fixed loaders back from the dead
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 03 Apr 2020 16:13:06 +0200
parents Framework/Deprecated/Loaders/LoaderCache.cpp@4f8db2d202c8
children 556b4bc19118
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1271
0ca50d275b9a upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1226
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 *
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 * 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
8 * 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
9 * 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
10 * the License, or (at your option) any later version.
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 *
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 * 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
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 * 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
15 * Affero General Public License for more details.
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 *
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17 * 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
18 * 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
19 **/
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 #include "LoaderCache.h"
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
23 #include "../../StoneException.h"
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 #include "OrthancSeriesVolumeProgressiveLoader.h"
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 #include "OrthancMultiframeVolumeLoader.h"
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 #include "DicomStructureSetLoader.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
27
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
28 #include "../../Loaders/ILoadersContext.h"
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
29
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
30
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
31 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
32 #include "DicomStructureSetLoader2.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
33 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
34 //BGO_ENABLE_DICOMSTRUCTURESETLOADER2
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
35
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
37 #if ORTHANC_ENABLE_WASM == 1
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
38 # include <unistd.h>
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
39 # include "../../Oracle/WebAssemblyOracle.h"
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
40 #else
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
41 # include "../../Oracle/ThreadedOracle.h"
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
42 #endif
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
43
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
44 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
45 #include "../../Toolbox/DicomStructureSet2.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
46 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
47 //BGO_ENABLE_DICOMSTRUCTURESETLOADER2
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
48
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
49 #include "../../Volumes/DicomVolumeImage.h"
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
50 #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
51
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
52 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
53 #include "../../Volumes/DicomStructureSetSlicer2.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
54 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
55 //BGO_ENABLE_DICOMSTRUCTURESETLOADER2
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 #include <Core/OrthancException.h>
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 #include <Core/Toolbox.h>
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59
1337
b1396be5aa27 Moved the fixed loaders back from the dead
Benjamin Golinvaux <bgo@osimis.io>
parents: 1327
diff changeset
60 namespace OrthancStone
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 {
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
62 LoaderCache::LoaderCache(OrthancStone::ILoadersContext& loadersContext)
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
63 : loadersContext_(loadersContext)
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
66 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
68 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader>
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 LoaderCache::GetSeriesVolumeProgressiveLoader(std::string seriesUuid)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 try
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 {
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
73
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 // normalize keys a little
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 seriesUuid = Orthanc::Toolbox::StripSpaces(seriesUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 Orthanc::Toolbox::ToLowerCase(seriesUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 // find in cache
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 if (seriesVolumeProgressiveLoaders_.find(seriesUuid) == seriesVolumeProgressiveLoaders_.end())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 {
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
81 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
82
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
83 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
84 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
85
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1314
diff changeset
86 // true means "use progressive quality"
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1314
diff changeset
87 // false means "load high quality slices only"
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1314
diff changeset
88 loader = OrthancSeriesVolumeProgressiveLoader::Create(loadersContext_, volumeImage, false);
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 loader->LoadSeries(seriesUuid);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 seriesVolumeProgressiveLoaders_[seriesUuid] = loader;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 }
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
92 else
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
93 {
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
94 // 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
95 }
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96 return seriesVolumeProgressiveLoaders_[seriesUuid];
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98 catch (const Orthanc::OrthancException& e)
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 if (e.HasDetails())
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) << "OrthancException in LoaderCache: " << e.What() << " Details: " << e.GetDetails();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 else
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 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
109 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
110 catch (const std::exception& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
112 LOG(ERROR) << "std::exception in LoaderCache: " << e.what();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
115 catch (...)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
116 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
117 LOG(ERROR) << "Unknown exception in LoaderCache";
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
119 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
120 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121
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
122 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
123 {
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
124 // 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
125 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
126 {
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
127 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
128 }
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
129 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
130
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
131 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
132 }
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
133
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
134 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
135 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 try
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138 // normalize keys a little
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
139 instanceUuid = Orthanc::Toolbox::StripSpaces(instanceUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140 Orthanc::Toolbox::ToLowerCase(instanceUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
141
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
142 // find in cache
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
143 if (dicomVolumeImageMPRSlicers_.find(instanceUuid) == dicomVolumeImageMPRSlicers_.end())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
144 {
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
145 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
146 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
147 boost::shared_ptr<OrthancMultiframeVolumeLoader> loader;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
148 {
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
149 loader = OrthancMultiframeVolumeLoader::Create(loadersContext_, volumeImage);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150 loader->LoadInstance(instanceUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152 multiframeVolumeLoaders_[instanceUuid] = loader;
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
153 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
154 dicomVolumeImageMPRSlicers_[instanceUuid] = mprSlicer;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
155 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 return dicomVolumeImageMPRSlicers_[instanceUuid];
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 catch (const Orthanc::OrthancException& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
160 if (e.HasDetails())
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 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
163 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164 else
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What();
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 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 catch (const std::exception& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 LOG(ERROR) << "std::exception in LoaderCache: " << e.what();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
174 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
175 catch (...)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
176 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
177 LOG(ERROR) << "Unknown exception in LoaderCache";
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
178 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
179 }
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
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
182 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
183
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
184 boost::shared_ptr<DicomStructureSetSlicer2> LoaderCache::GetDicomStructureSetSlicer2(std::string instanceUuid)
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
185 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
186 // if the loader is not available, let's trigger its creation
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
187 if (dicomStructureSetSlicers2_.find(instanceUuid) == dicomStructureSetSlicers2_.end())
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
188 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
189 GetDicomStructureSetLoader2(instanceUuid);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
190 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
191 ORTHANC_ASSERT(dicomStructureSetSlicers2_.find(instanceUuid) != dicomStructureSetSlicers2_.end());
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
192
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
193 return dicomStructureSetSlicers2_[instanceUuid];
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
194 }
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
195 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
196 //BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
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
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
199 /**
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
200 This method allows to convert a list of string into a string by
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
201 sorting the strings then joining them
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
202 */
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
203 static std::string SortAndJoin(const std::vector<std::string>& stringList)
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
204 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
205 if (stringList.size() == 0)
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
206 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
207 return "";
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
208 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
209 else
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
210 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
211 std::vector<std::string> sortedStringList = stringList;
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
212 std::sort(sortedStringList.begin(), sortedStringList.end());
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
213 std::stringstream s;
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
214 s << sortedStringList[0];
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
215 for (size_t i = 1; i < sortedStringList.size(); ++i)
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
216 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
217 s << "-" << sortedStringList[i];
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
218 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
219 return s.str();
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
220 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
221 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
222
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
223 boost::shared_ptr<DicomStructureSetLoader>
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
224 LoaderCache::GetDicomStructureSetLoader(
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
225 std::string inInstanceUuid,
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
226 const std::vector<std::string>& initiallyVisibleStructures)
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
227 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
228 try
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
229 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
230 // normalize keys a little
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
231 inInstanceUuid = Orthanc::Toolbox::StripSpaces(inInstanceUuid);
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
232 Orthanc::Toolbox::ToLowerCase(inInstanceUuid);
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
233
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
234 std::string initiallyVisibleStructuresKey =
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
235 SortAndJoin(initiallyVisibleStructures);
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
236
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
237 std::string entryKey = inInstanceUuid + "_" + initiallyVisibleStructuresKey;
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
238
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
239 // 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
240 if (dicomStructureSetLoaders_.find(entryKey) == dicomStructureSetLoaders_.end())
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
241 {
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
242 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
243
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
244 boost::shared_ptr<DicomStructureSetLoader> loader;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
245 {
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
246 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
247 loader->LoadInstance(inInstanceUuid, initiallyVisibleStructures);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
248 }
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
249 dicomStructureSetLoaders_[entryKey] = loader;
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
250 }
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
251 return dicomStructureSetLoaders_[entryKey];
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
252 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
253 catch (const Orthanc::OrthancException& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
254 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
255 if (e.HasDetails())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
256 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
257 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
258 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
259 else
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
260 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
261 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
262 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
263 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
264 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
265 catch (const std::exception& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
266 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
267 LOG(ERROR) << "std::exception in LoaderCache: " << e.what();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
268 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
269 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
270 catch (...)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
271 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
272 LOG(ERROR) << "Unknown exception in LoaderCache";
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
273 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
274 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
275 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
276
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
277 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
278
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
279 boost::shared_ptr<DicomStructureSetLoader2> LoaderCache::GetDicomStructureSetLoader2(std::string instanceUuid)
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
280 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
281 try
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
282 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
283 // normalize keys a little
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
284 instanceUuid = Orthanc::Toolbox::StripSpaces(instanceUuid);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
285 Orthanc::Toolbox::ToLowerCase(instanceUuid);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
286
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
287 // find in cache
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
288 if (dicomStructureSetLoaders2_.find(instanceUuid) == dicomStructureSetLoaders2_.end())
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
289 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
290 boost::shared_ptr<DicomStructureSetLoader2> loader;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
291 boost::shared_ptr<DicomStructureSet2> structureSet(new DicomStructureSet2());
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
292 boost::shared_ptr<DicomStructureSetSlicer2> rtSlicer(new DicomStructureSetSlicer2(structureSet));
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
293 dicomStructureSetSlicers2_[instanceUuid] = rtSlicer;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
294 dicomStructureSets2_[instanceUuid] = structureSet; // to prevent it from being deleted
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
295 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
296 #if ORTHANC_ENABLE_WASM == 1
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
297 loader.reset(new DicomStructureSetLoader2(*(structureSet.get()), oracle_, oracle_));
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
298 #else
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
299 LockingEmitter::WriterLock lock(lockingEmitter_);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
300 // TODO: clarify lifetimes... this is DANGEROUS!
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
301 loader.reset(new DicomStructureSetLoader2(*(structureSet.get()), oracle_, lock.GetOracleObservable()));
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
302 #endif
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
303 loader->LoadInstance(instanceUuid);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
304 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
305 dicomStructureSetLoaders2_[instanceUuid] = loader;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
306 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
307 return dicomStructureSetLoaders2_[instanceUuid];
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
308 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
309 catch (const Orthanc::OrthancException& e)
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
310 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
311 if (e.HasDetails())
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
312 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
313 LOG(ERROR) << "OrthancException in GetDicomStructureSetLoader2: " << e.What() << " Details: " << e.GetDetails();
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
314 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
315 else
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
316 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
317 LOG(ERROR) << "OrthancException in GetDicomStructureSetLoader2: " << e.What();
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
318 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
319 throw;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
320 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
321 catch (const std::exception& e)
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
322 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
323 LOG(ERROR) << "std::exception in GetDicomStructureSetLoader2: " << e.what();
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
324 throw;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
325 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
326 catch (...)
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
327 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
328 LOG(ERROR) << "Unknown exception in GetDicomStructureSetLoader2";
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
329 throw;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
330 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
331 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
332
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
333 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
334 // BGO_ENABLE_DICOMSTRUCTURESETLOADER2
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
335
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
336
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
337 void LoaderCache::ClearCache()
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
338 {
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
339 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
340
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1279
diff changeset
341 #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
342 // 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
343 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
344 #endif
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
345 seriesVolumeProgressiveLoaders_.clear();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
346 multiframeVolumeLoaders_.clear();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
347 dicomVolumeImageMPRSlicers_.clear();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
348 dicomStructureSetLoaders_.clear();
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
349
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
350 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
351 // order is important!
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
352 dicomStructureSetLoaders2_.clear();
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
353 dicomStructureSetSlicers2_.clear();
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
354 dicomStructureSets2_.clear();
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
355 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
356 // BGO_ENABLE_DICOMSTRUCTURESETLOADER2
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
357 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
358
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
359 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
360 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
361 {
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
362 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
363 size_t i = 0;
963
d358593820b8 removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 961
diff changeset
364 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
365 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
366 {
963
d358593820b8 removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 961
diff changeset
367 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
368 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
369 }
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
370 }
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
371
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
372 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
373 {
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
374 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
375 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
376 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
377 DebugDisplayObjRefCountsInMap("dicomStructureSetLoaders_", dicomStructureSetLoaders_);
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
378 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
379 DebugDisplayObjRefCountsInMap("dicomStructureSetLoaders2_", dicomStructureSetLoaders2_);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
380 DebugDisplayObjRefCountsInMap("dicomStructureSetSlicers2_", dicomStructureSetSlicers2_);
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
381 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
382 //BGO_ENABLE_DICOMSTRUCTURESETLOADER2
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
383 }
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
384 }