Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp @ 1512:244ad1e4e76a
reorganization of folders
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 16:21:02 +0200 |
parents | Framework/Loaders/DicomStructureSetLoader.cpp@d8af188ab545 |
children | 85e117739eca |
rev | line source |
---|---|
815 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1271
0ca50d275b9a
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1225
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
815 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "DicomStructureSetLoader.h" | |
23 | |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
24 #include "../Scene2D/PolylineSceneLayer.h" |
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
25 #include "../StoneException.h" |
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
26 #include "../Toolbox/GeometryToolbox.h" |
815 | 27 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1416
diff
changeset
|
28 #include <Toolbox.h> |
1048
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1030
diff
changeset
|
29 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
30 #include <algorithm> |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
31 |
1337
b1396be5aa27
Moved the fixed loaders back from the dead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1314
diff
changeset
|
32 namespace OrthancStone |
815 | 33 { |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
34 |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
35 #if 0 |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
36 void DumpDicomMap(std::ostream& o, const Orthanc::DicomMap& dicomMap) |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
37 { |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
38 using namespace std; |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
39 //ios_base::fmtflags state = o.flags(); |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
40 //o.flags(ios::right | ios::hex); |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
41 //o << "(" << setfill('0') << setw(4) << tag.GetGroup() |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
42 // << "," << setw(4) << tag.GetElement() << ")"; |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
43 //o.flags(state); |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
44 Json::Value val; |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
45 dicomMap.Serialize(val); |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
46 o << val; |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
47 //return o; |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
48 } |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
49 #endif |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
50 |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
51 // implementation of IInstanceLookupHandler that uses Orthanc REST API calls to retrive the |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
52 // geometry of referenced instances |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
53 class DicomStructureSetLoader::RestInstanceLookupHandler : public DicomStructureSetLoader::IInstanceLookupHandler, |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
54 public LoaderStateMachine |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
55 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
56 public: |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
57 static boost::shared_ptr<RestInstanceLookupHandler > Create(DicomStructureSetLoader& loader) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
58 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
59 boost::shared_ptr<RestInstanceLookupHandler> obj(new RestInstanceLookupHandler(loader)); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
60 obj->LoaderStateMachine::PostConstructor(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
61 return obj; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
62 } |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
63 |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
64 protected: |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
65 RestInstanceLookupHandler(DicomStructureSetLoader& loader) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
66 : LoaderStateMachine(loader.loadersContext_) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
67 , loader_(loader) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
68 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
69 } |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
70 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
71 virtual void RetrieveReferencedSlices(const std::set<std::string>& nonEmptyInstances) ORTHANC_OVERRIDE; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
72 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
73 private: |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
74 // these subclasses hold the loading state |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
75 class AddReferencedInstance; // 2nd state |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
76 class LookupInstance; // 1st state |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
77 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
78 DicomStructureSetLoader& loader_; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
79 }; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
80 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
81 class DicomStructureSetLoader::RestInstanceLookupHandler::AddReferencedInstance : public LoaderStateMachine::State |
815 | 82 { |
83 private: | |
84 std::string instanceId_; | |
85 | |
86 public: | |
87 AddReferencedInstance(DicomStructureSetLoader& that, | |
88 const std::string& instanceId) : | |
89 State(that), | |
90 instanceId_(instanceId) | |
91 { | |
92 } | |
93 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
94 virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
815 | 95 { |
96 Json::Value tags; | |
97 message.ParseJsonBody(tags); | |
98 | |
99 Orthanc::DicomMap dicom; | |
100 dicom.FromDicomAsJson(tags); | |
101 | |
102 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); | |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
103 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
104 loader.AddReferencedSlice(dicom); |
815 | 105 } |
106 }; | |
107 | |
108 | |
109 // State that converts a "SOP Instance UID" to an Orthanc identifier | |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
110 class DicomStructureSetLoader::RestInstanceLookupHandler::LookupInstance : public LoaderStateMachine::State |
815 | 111 { |
112 private: | |
113 std::string sopInstanceUid_; | |
114 | |
115 public: | |
116 LookupInstance(DicomStructureSetLoader& that, | |
117 const std::string& sopInstanceUid) : | |
118 State(that), | |
119 sopInstanceUid_(sopInstanceUid) | |
120 { | |
121 } | |
122 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
123 virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
815 | 124 { |
125 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); | |
126 | |
127 Json::Value lookup; | |
128 message.ParseJsonBody(lookup); | |
129 | |
130 if (lookup.type() != Json::arrayValue || | |
131 lookup.size() != 1 || | |
132 !lookup[0].isMember("Type") || | |
133 !lookup[0].isMember("Path") || | |
134 lookup[0]["Type"].type() != Json::stringValue || | |
135 lookup[0]["ID"].type() != Json::stringValue || | |
136 lookup[0]["Type"].asString() != "Instance") | |
137 { | |
841
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
138 std::stringstream msg; |
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
139 msg << "Unknown resource! message.GetAnswer() = " << message.GetAnswer() << " message.GetAnswerHeaders() = "; |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
140 for (OrthancStone::OrthancRestApiCommand::HttpHeaders::const_iterator it = message.GetAnswerHeaders().begin(); |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
141 it != message.GetAnswerHeaders().end(); ++it) |
841
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
142 { |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
143 msg << "\nkey: \"" << it->first << "\" value: \"" << it->second << "\"\n"; |
841
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
144 } |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
145 const std::string msgStr = msg.str(); |
841
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
146 LOG(ERROR) << msgStr; |
815 | 147 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); |
148 } | |
149 | |
150 const std::string instanceId = lookup[0]["ID"].asString(); | |
151 | |
152 { | |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
153 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); |
815 | 154 command->SetHttpHeader("Accept-Encoding", "gzip"); |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
155 std::string uri = "/instances/" + instanceId + "/tags"; |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
156 command->SetUri(uri); |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1059
diff
changeset
|
157 command->AcquirePayload(new AddReferencedInstance(loader, instanceId)); |
815 | 158 Schedule(command.release()); |
159 } | |
160 } | |
161 }; | |
162 | |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
163 void DicomStructureSetLoader::RestInstanceLookupHandler::RetrieveReferencedSlices( |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
164 const std::set<std::string>& nonEmptyInstances) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
165 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
166 for (std::set<std::string>::const_iterator it = nonEmptyInstances.begin(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
167 it != nonEmptyInstances.end(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
168 ++it) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
169 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
170 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
171 command->SetUri("/tools/lookup"); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
172 command->SetMethod(Orthanc::HttpMethod_Post); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
173 command->SetBody(*it); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
174 command->AcquirePayload(new LookupInstance(loader_, *it)); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
175 Schedule(command.release()); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
176 } |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
177 } |
815 | 178 |
179 class DicomStructureSetLoader::LoadStructure : public LoaderStateMachine::State | |
180 { | |
181 public: | |
182 LoadStructure(DicomStructureSetLoader& that) : | |
183 State(that) | |
184 { | |
185 } | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
186 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
187 virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
815 | 188 { |
189 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); | |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
190 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
191 // Set the actual structure set content |
815 | 192 { |
1504 | 193 FullOrthancDataset dicom(message.GetAnswer()); |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
194 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
195 loader.content_.reset(new OrthancStone::DicomStructureSet(dicom)); |
815 | 196 } |
197 | |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
198 // initialize visibility flags |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
199 SetDefaultStructureVisibility(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
200 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
201 // retrieve the (non-empty) referenced instances (the CT slices containing the corresponding structures) |
981
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
202 // Some (admittedly invalid) Dicom files have empty values in the |
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
203 // 0008,1155 tag. We try our best to cope with this. |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
204 // this is why we use `nonEmptyInstances` and not `instances` |
815 | 205 std::set<std::string> instances; |
981
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
206 std::set<std::string> nonEmptyInstances; |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
207 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
208 // this traverses the polygon collection for all structures and retrieve the SOPInstanceUID of |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
209 // the referenced instances |
815 | 210 loader.content_->GetReferencedInstances(instances); |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
211 |
981
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
212 for (std::set<std::string>::const_iterator |
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
213 it = instances.begin(); it != instances.end(); ++it) |
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
214 { |
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
215 std::string instance = Orthanc::Toolbox::StripSpaces(*it); |
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
216 if(instance != "") |
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
217 nonEmptyInstances.insert(instance); |
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
218 } |
815 | 219 |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
220 loader.RetrieveReferencedSlices(nonEmptyInstances); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
221 } |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
222 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
223 void SetDefaultStructureVisibility() |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
224 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
225 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
226 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
227 size_t structureCount = loader.content_->GetStructuresCount(); |
815 | 228 |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
229 loader.structureVisibility_.resize(structureCount); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
230 bool everythingVisible = false; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
231 if ((loader.initiallyVisibleStructures_.size() == 1) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
232 && (loader.initiallyVisibleStructures_[0].size() == 1) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
233 && (loader.initiallyVisibleStructures_[0][0] == '*')) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
234 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
235 everythingVisible = true; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
236 } |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
237 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
238 for (size_t i = 0; i < structureCount; ++i) |
815 | 239 { |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
240 // if a single "*" string is supplied, this means we want everything |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
241 // to be visible... |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
242 if (everythingVisible) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
243 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
244 loader.structureVisibility_.at(i) = true; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
245 } |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
246 else |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
247 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
248 // otherwise, we only enable visibility for those structures whose |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
249 // names are mentioned in the initiallyVisibleStructures_ array |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
250 const std::string& structureName = loader.content_->GetStructureName(i); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
251 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
252 std::vector<std::string>::iterator foundIt = |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
253 std::find( |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
254 loader.initiallyVisibleStructures_.begin(), |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
255 loader.initiallyVisibleStructures_.end(), |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
256 structureName); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
257 std::vector<std::string>::iterator endIt = loader.initiallyVisibleStructures_.end(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
258 if (foundIt != endIt) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
259 loader.structureVisibility_.at(i) = true; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
260 else |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
261 loader.structureVisibility_.at(i) = false; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
262 } |
815 | 263 } |
264 } | |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
265 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
266 private: |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
267 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
268 |
815 | 269 }; |
270 | |
271 | |
272 class DicomStructureSetLoader::Slice : public IExtractedSlice | |
273 { | |
274 private: | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
275 const OrthancStone::DicomStructureSet& content_; |
815 | 276 uint64_t revision_; |
277 bool isValid_; | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
278 std::vector<bool> visibility_; |
815 | 279 |
280 public: | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
281 /** |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
282 The visibility vector must either: |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
283 - be empty |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
284 or |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
285 - contain the same number of items as the number of structures in the |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
286 structure set. |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
287 In the first case (empty vector), all the structures are displayed. |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
288 In the second case, the visibility of each structure is defined by the |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
289 content of the vector at the corresponding index. |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
290 */ |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
291 Slice(const OrthancStone::DicomStructureSet& content, |
815 | 292 uint64_t revision, |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
293 const OrthancStone::CoordinateSystem3D& cuttingPlane, |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
294 std::vector<bool> visibility = std::vector<bool>()) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
295 : content_(content) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
296 , revision_(revision) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
297 , visibility_(visibility) |
815 | 298 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
299 ORTHANC_ASSERT((visibility_.size() == content_.GetStructuresCount()) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
300 || (visibility_.size() == 0u)); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
301 |
815 | 302 bool opposite; |
303 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
304 const OrthancStone::Vector normal = content.GetNormal(); |
815 | 305 isValid_ = ( |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
306 OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetNormal()) || |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
307 OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetAxisX()) || |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
308 OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetAxisY())); |
815 | 309 } |
310 | |
311 virtual bool IsValid() | |
312 { | |
313 return isValid_; | |
314 } | |
315 | |
316 virtual uint64_t GetRevision() | |
317 { | |
318 return revision_; | |
319 } | |
320 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
321 virtual OrthancStone::ISceneLayer* CreateSceneLayer( |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
322 const OrthancStone::ILayerStyleConfigurator* configurator, |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
323 const OrthancStone::CoordinateSystem3D& cuttingPlane) |
815 | 324 { |
325 assert(isValid_); | |
326 | |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
327 std::unique_ptr<OrthancStone::PolylineSceneLayer> layer(new OrthancStone::PolylineSceneLayer); |
815 | 328 layer->SetThickness(2); |
329 | |
330 for (size_t i = 0; i < content_.GetStructuresCount(); i++) | |
331 { | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
332 if ((visibility_.size() == 0) || visibility_.at(i)) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
333 { |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
334 const OrthancStone::Color& color = content_.GetStructureColor(i); |
815 | 335 |
1006
4f28d9459e31
Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
336 #ifdef USE_BOOST_UNION_FOR_POLYGONS |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
337 std::vector< std::vector<OrthancStone::Point2D> > polygons; |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
338 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
339 if (content_.ProjectStructure(polygons, i, cuttingPlane)) |
815 | 340 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
341 for (size_t j = 0; j < polygons.size(); j++) |
815 | 342 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
343 PolylineSceneLayer::Chain chain; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
344 chain.resize(polygons[j].size()); |
815 | 345 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
346 for (size_t k = 0; k < polygons[j].size(); k++) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
347 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
348 chain[k] = ScenePoint2D(polygons[j][k].x, polygons[j][k].y); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
349 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
350 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
351 layer->AddChain(chain, true /* closed */, color); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
352 } |
815 | 353 } |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
354 #else |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
355 std::vector< std::pair<OrthancStone::Point2D, OrthancStone::Point2D> > segments; |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
356 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
357 if (content_.ProjectStructure(segments, i, cuttingPlane)) |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
358 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
359 for (size_t j = 0; j < segments.size(); j++) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
360 { |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
361 OrthancStone::PolylineSceneLayer::Chain chain; |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
362 chain.resize(2); |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
363 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
364 chain[0] = OrthancStone::ScenePoint2D(segments[j].first.x, segments[j].first.y); |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
365 chain[1] = OrthancStone::ScenePoint2D(segments[j].second.x, segments[j].second.y); |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
366 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
367 layer->AddChain(chain, false /* NOT closed */, color); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
368 } |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
369 } |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
370 #endif |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
371 } |
815 | 372 } |
373 | |
374 return layer.release(); | |
375 } | |
376 }; | |
377 | |
378 | |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
379 DicomStructureSetLoader::DicomStructureSetLoader( |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
380 OrthancStone::ILoadersContext& loadersContext) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
381 : LoaderStateMachine(loadersContext) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
382 , loadersContext_(loadersContext) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
383 , revision_(0) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
384 , countProcessedInstances_(0) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
385 , countReferencedInstances_(0) |
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
386 , structuresReady_(false) |
815 | 387 { |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
388 // the default handler to retrieve slice geometry is RestInstanceLookupHandler |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
389 instanceLookupHandler_ = RestInstanceLookupHandler::Create(*this); |
815 | 390 } |
391 | |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
392 boost::shared_ptr<OrthancStone::DicomStructureSetLoader> DicomStructureSetLoader::Create(OrthancStone::ILoadersContext& loadersContext) |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
393 { |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
394 boost::shared_ptr<DicomStructureSetLoader> obj( |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
395 new DicomStructureSetLoader( |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
396 loadersContext)); |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
397 obj->LoaderStateMachine::PostConstructor(); |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
398 return obj; |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
399 } |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
400 |
1416
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
401 void DicomStructureSetLoader::AddReferencedSlice(const Orthanc::DicomMap& dicom) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
402 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
403 content_->AddReferencedSlice(dicom); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
404 countProcessedInstances_ ++; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
405 assert(countProcessedInstances_ <= countReferencedInstances_); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
406 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
407 revision_++; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
408 SetStructuresUpdated(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
409 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
410 if (countProcessedInstances_ == countReferencedInstances_) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
411 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
412 // All the referenced instances have been loaded, finalize the RT-STRUCT |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
413 content_->CheckReferencedSlices(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
414 revision_++; |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
415 SetStructuresReady(); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
416 } |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
417 } |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
418 |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
419 void DicomStructureSetLoader::RetrieveReferencedSlices(const std::set<std::string>& nonEmptyInstances) |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
420 { |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
421 // we set the number of referenced instances. This allows to know, in the method above, when we're done |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
422 countReferencedInstances_ = static_cast<unsigned int>(nonEmptyInstances.size()); |
d959bc8f6c1b
Instance lookup is now performed in a separate class through an interface. Another implementation can be injected (SetInstanceLookupHandler)
Benjamin Golinvaux <bgo@osimis.io>
parents:
1385
diff
changeset
|
423 instanceLookupHandler_->RetrieveReferencedSlices(nonEmptyInstances); |
1314
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
424 } |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
425 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
426 void DicomStructureSetLoader::SetStructureDisplayState(size_t structureIndex, bool display) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
427 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
428 structureVisibility_.at(structureIndex) = display; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
429 revision_++; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
430 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
431 |
935
401808e7ff2e
Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
432 DicomStructureSetLoader::~DicomStructureSetLoader() |
401808e7ff2e
Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
433 { |
401808e7ff2e
Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
434 LOG(TRACE) << "DicomStructureSetLoader::~DicomStructureSetLoader()"; |
401808e7ff2e
Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
435 } |
401808e7ff2e
Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents:
842
diff
changeset
|
436 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
437 void DicomStructureSetLoader::LoadInstance( |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
438 const std::string& instanceId, |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
439 const std::vector<std::string>& initiallyVisibleStructures) |
815 | 440 { |
441 Start(); | |
442 | |
443 instanceId_ = instanceId; | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
444 initiallyVisibleStructures_ = initiallyVisibleStructures; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
445 |
815 | 446 { |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
447 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); |
815 | 448 command->SetHttpHeader("Accept-Encoding", "gzip"); |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
449 |
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
450 std::string uri = "/instances/" + instanceId + "/tags?ignore-length=3006-0050"; |
981
c20dbaab360c
Ability to cope with empty "Referenced SOP Instance UID" (dicom path (3006,0039)[i] / (0x3006, 0x0040)[0] / (0x3006, 0x0016)[0] / (0x0008, 0x1155)) + better logs + code formating
Benjamin Golinvaux <bgo@osimis.io>
parents:
977
diff
changeset
|
451 |
964
91f827272c1f
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
Benjamin Golinvaux <bgo@osimis.io>
parents:
954
diff
changeset
|
452 command->SetUri(uri); |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1059
diff
changeset
|
453 command->AcquirePayload(new LoadStructure(*this)); |
815 | 454 Schedule(command.release()); |
455 } | |
456 } | |
457 | |
1385
ffe9beb7c5d3
Added LoadInstanceFullVisibility for default-visible RTSTRUCT
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
458 void DicomStructureSetLoader::LoadInstanceFullVisibility(const std::string& instanceId) |
ffe9beb7c5d3
Added LoadInstanceFullVisibility for default-visible RTSTRUCT
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
459 { |
ffe9beb7c5d3
Added LoadInstanceFullVisibility for default-visible RTSTRUCT
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
460 std::vector<std::string> initiallyVisibleStructures; |
ffe9beb7c5d3
Added LoadInstanceFullVisibility for default-visible RTSTRUCT
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
461 initiallyVisibleStructures.push_back("*"); // wildcard to make all structure sets visible |
ffe9beb7c5d3
Added LoadInstanceFullVisibility for default-visible RTSTRUCT
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
462 LoadInstance(instanceId, initiallyVisibleStructures); |
ffe9beb7c5d3
Added LoadInstanceFullVisibility for default-visible RTSTRUCT
Benjamin Golinvaux <bgo@osimis.io>
parents:
1381
diff
changeset
|
463 } |
815 | 464 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
465 OrthancStone::IVolumeSlicer::IExtractedSlice* DicomStructureSetLoader::ExtractSlice(const OrthancStone::CoordinateSystem3D& cuttingPlane) |
815 | 466 { |
467 if (content_.get() == NULL) | |
468 { | |
469 // Geometry is not available yet | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
470 return new OrthancStone::IVolumeSlicer::InvalidSlice; |
815 | 471 } |
472 else | |
473 { | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
474 return new Slice(*content_, revision_, cuttingPlane, structureVisibility_); |
815 | 475 } |
476 } | |
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:
935
diff
changeset
|
477 |
1342
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
478 void DicomStructureSetLoader::SetStructuresUpdated() |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
479 { |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
480 BroadcastMessage(DicomStructureSetLoader::StructuresUpdated(*this)); |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
481 } |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
482 |
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:
935
diff
changeset
|
483 void DicomStructureSetLoader::SetStructuresReady() |
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:
935
diff
changeset
|
484 { |
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:
935
diff
changeset
|
485 ORTHANC_ASSERT(!structuresReady_); |
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:
935
diff
changeset
|
486 structuresReady_ = true; |
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:
935
diff
changeset
|
487 BroadcastMessage(DicomStructureSetLoader::StructuresReady(*this)); |
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:
935
diff
changeset
|
488 } |
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:
935
diff
changeset
|
489 |
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:
935
diff
changeset
|
490 bool DicomStructureSetLoader::AreStructuresReady() const |
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:
935
diff
changeset
|
491 { |
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:
935
diff
changeset
|
492 return structuresReady_; |
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:
935
diff
changeset
|
493 } |
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:
935
diff
changeset
|
494 |
815 | 495 } |