annotate Framework/Deprecated/Loaders/LoaderCache.cpp @ 1225:16738485e457 broker

deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 08 Dec 2019 11:45:09 +0100
parents Framework/Loaders/LoaderCache.cpp@477203923f26
children 05d05cba0f4f
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
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
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
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
28 #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
29 #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
30 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
31 //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
32
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
34 #if ORTHANC_ENABLE_WASM == 1
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
35 # include <unistd.h>
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
36 # include "../../Oracle/WebAssemblyOracle.h"
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
37 #else
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
38 # include "../../Oracle/ThreadedOracle.h"
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
39 #endif
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
40
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 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
42 #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
43 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
44 //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
45
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
46 #include "../../Volumes/DicomVolumeImage.h"
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
47 #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
48
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
49 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
50 #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
51 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
52 //BGO_ENABLE_DICOMSTRUCTURESETLOADER2
929
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 #include <Core/OrthancException.h>
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 #include <Core/Toolbox.h>
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
57 namespace Deprecated
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59 #if ORTHANC_ENABLE_WASM == 1
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
60 LoaderCache::LoaderCache(OrthancStone::WebAssemblyOracle& oracle)
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 : oracle_(oracle)
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
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 #else
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
66 LoaderCache::LoaderCache(OrthancStone::ThreadedOracle& oracle,
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
67 OrthancStone::Deprecated::LockingEmitter& lockingEmitter)
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
68 : oracle_(oracle)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 , lockingEmitter_(lockingEmitter)
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 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 #endif
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
74 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader>
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 LoaderCache::GetSeriesVolumeProgressiveLoader(std::string seriesUuid)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 try
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 {
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
79
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 // normalize keys a little
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 seriesUuid = Orthanc::Toolbox::StripSpaces(seriesUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 Orthanc::Toolbox::ToLowerCase(seriesUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 // find in cache
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 if (seriesVolumeProgressiveLoaders_.find(seriesUuid) == seriesVolumeProgressiveLoaders_.end())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 {
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
87 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : CACHEMISS --> need to load seriesUUid = " << seriesUuid;
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
88 #if ORTHANC_ENABLE_WASM == 1
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
89 // LOG(TRACE) << "Performing request for series " << seriesUuid << " sbrk(0) = " << sbrk(0);
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
90 #else
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
91 // LOG(TRACE) << "Performing request for series " << seriesUuid;
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
92 #endif
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
93 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
94 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> loader;
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
95 // LOG(TRACE) << "volumeImage = " << volumeImage.get();
929
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 #if ORTHANC_ENABLE_WASM == 1
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
98 loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, oracle_));
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
99 #else
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
100 OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
101 loader.reset(new OrthancSeriesVolumeProgressiveLoader(volumeImage, oracle_, lock.GetOracleObservable()));
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
102 #endif
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
103 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : loader = " << loader.get();
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 loader->LoadSeries(seriesUuid);
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
105 // LOG(TRACE) << "LoaderCache::GetSeriesVolumeProgressiveLoader : loader->LoadSeries successful";
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 seriesVolumeProgressiveLoaders_[seriesUuid] = loader;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 }
933
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
109 else
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
110 {
f75f6cb69c1b Commented-out traces for debug
Benjamin Golinvaux <bgo@osimis.io>
parents: 930
diff changeset
111 // 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
112 }
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 return seriesVolumeProgressiveLoaders_[seriesUuid];
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 (const Orthanc::OrthancException& e)
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 if (e.HasDetails())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
119 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
120 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121 else
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
123 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
125 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
126 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
127 catch (const std::exception& e)
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 LOG(ERROR) << "std::exception in LoaderCache: " << e.what();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
130 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
131 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132 catch (...)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134 LOG(ERROR) << "Unknown exception in LoaderCache";
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
135 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 }
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
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
139 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
140 {
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
141 // 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
142 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
143 {
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
144 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
145 }
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
146 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
147
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
148 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
149 }
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
150
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
151 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
152 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153 try
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 // normalize keys a little
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 instanceUuid = Orthanc::Toolbox::StripSpaces(instanceUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157 Orthanc::Toolbox::ToLowerCase(instanceUuid);
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 // find in cache
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
160 if (dicomVolumeImageMPRSlicers_.find(instanceUuid) == dicomVolumeImageMPRSlicers_.end())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
161 {
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
162 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
163 boost::shared_ptr<OrthancMultiframeVolumeLoader> loader;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164
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 #if ORTHANC_ENABLE_WASM == 1
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
167 loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, oracle_));
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 #else
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
169 OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 loader.reset(new OrthancMultiframeVolumeLoader(volumeImage, oracle_, lock.GetOracleObservable()));
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171 #endif
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 loader->LoadInstance(instanceUuid);
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
174 multiframeVolumeLoaders_[instanceUuid] = loader;
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
175 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
176 dicomVolumeImageMPRSlicers_[instanceUuid] = mprSlicer;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
177 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
178 return dicomVolumeImageMPRSlicers_[instanceUuid];
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 catch (const Orthanc::OrthancException& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
181 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
182 if (e.HasDetails())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
183 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
184 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
185 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
186 else
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 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
189 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
190 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
191 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
192 catch (const std::exception& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
193 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
194 LOG(ERROR) << "std::exception in LoaderCache: " << e.what();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
195 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
196 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
197 catch (...)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
198 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
199 LOG(ERROR) << "Unknown exception in LoaderCache";
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
200 throw;
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 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
203
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
204 #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
205
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
206 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
207 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
208 // 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
209 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
210 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
211 GetDicomStructureSetLoader2(instanceUuid);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
212 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
213 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
214
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
215 return dicomStructureSetSlicers2_[instanceUuid];
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
216 }
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
217 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
218 //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
219
1019
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 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
223 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
224 */
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
225 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
226 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
227 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
228 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
229 return "";
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
230 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
231 else
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
232 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
233 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
234 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
235 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
236 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
237 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
238 {
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
239 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
240 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
241 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
242 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
243 }
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
244
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
245 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
246 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
247 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
248 const std::vector<std::string>& initiallyVisibleStructures)
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
249 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
250 try
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
251 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
252 // 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
253 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
254 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
255
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
256 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
257 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
258
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
259 std::string entryKey = inInstanceUuid + "_" + initiallyVisibleStructuresKey;
929
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 // 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
262 if (dicomStructureSetLoaders_.find(entryKey) == dicomStructureSetLoaders_.end())
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
263 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
264 boost::shared_ptr<DicomStructureSetLoader> loader;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
265
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 #if ORTHANC_ENABLE_WASM == 1
930
bf03cb879eb4 Fixed LoaderCache
Benjamin Golinvaux <bgo@osimis.io>
parents: 929
diff changeset
268 loader.reset(new DicomStructureSetLoader(oracle_, oracle_));
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
269 #else
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
270 OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
271 loader.reset(new DicomStructureSetLoader(oracle_, lock.GetOracleObservable()));
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
272 #endif
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
273 loader->LoadInstance(inInstanceUuid, initiallyVisibleStructures);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
274 }
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
275 dicomStructureSetLoaders_[entryKey] = loader;
929
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 return dicomStructureSetLoaders_[entryKey];
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
278 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
279 catch (const Orthanc::OrthancException& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
280 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
281 if (e.HasDetails())
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
282 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
283 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
284 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
285 else
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
286 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
287 LOG(ERROR) << "OrthancException in LoaderCache: " << e.What();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
288 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
289 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
290 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
291 catch (const std::exception& e)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
292 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
293 LOG(ERROR) << "std::exception in LoaderCache: " << e.what();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
294 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
295 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
296 catch (...)
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
297 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
298 LOG(ERROR) << "Unknown exception in LoaderCache";
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
299 throw;
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
300 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
301 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
302
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
303 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
304
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
305 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
306 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
307 try
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 // 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
310 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
311 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
312
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
313 // find in cache
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
314 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
315 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
316 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
317 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
318 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
319 dicomStructureSetSlicers2_[instanceUuid] = rtSlicer;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
320 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
321 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
322 #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
323 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
324 #else
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
325 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
326 // 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
327 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
328 #endif
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
329 loader->LoadInstance(instanceUuid);
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 dicomStructureSetLoaders2_[instanceUuid] = loader;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
332 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
333 return dicomStructureSetLoaders2_[instanceUuid];
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
334 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
335 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
336 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
337 if (e.HasDetails())
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
338 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
339 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
340 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
341 else
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
342 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
343 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
344 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
345 throw;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
346 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
347 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
348 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
349 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
350 throw;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
351 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
352 catch (...)
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
353 {
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
354 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
355 throw;
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
356 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
357 }
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
358
1019
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
359 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
360 // 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
361
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
362
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
363 void LoaderCache::ClearCache()
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
364 {
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
365 #if ORTHANC_ENABLE_WASM != 1
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1108
diff changeset
366 OrthancStone::Deprecated::LockingEmitter::WriterLock lock(lockingEmitter_);
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
367 #endif
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
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 //#ifndef NDEBUG
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 // 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
371 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
372 //#endif
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
373 seriesVolumeProgressiveLoaders_.clear();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
374 multiframeVolumeLoaders_.clear();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
375 dicomVolumeImageMPRSlicers_.clear();
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
376 dicomStructureSetLoaders_.clear();
1001
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
377
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 // order is important!
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
380 dicomStructureSetLoaders2_.clear();
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
381 dicomStructureSetSlicers2_.clear();
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
382 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
383 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
384 // BGO_ENABLE_DICOMSTRUCTURESETLOADER2
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
385 }
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
386
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
387 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
388 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
389 {
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
390 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
391 size_t i = 0;
963
d358593820b8 removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 961
diff changeset
392 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
393 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
394 {
963
d358593820b8 removal of C++11 iterator
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 961
diff changeset
395 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
396 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
397 }
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
398 }
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
399
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
400 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
401 {
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
402 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
403 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
404 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
405 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
406 #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
407 DebugDisplayObjRefCountsInMap("dicomStructureSetLoaders2_", dicomStructureSetLoaders2_);
e704a53c9d0a LoaderCache : support for the second set of structure set handling classes
Benjamin Golinvaux <bgo@osimis.io>
parents: 963
diff changeset
408 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
409 #endif
29f5f2031310 Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents: 1001
diff changeset
410 //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
411 }
929
408bcc6c1505 Added Loader cache. Not activated yet.
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
412 }