Mercurial > hg > orthanc-stone
annotate Framework/Loaders/DicomStructureSetLoader.cpp @ 1115:f00deb2b4733
Added tag toa2019110401 for changeset 33b0a762e98a
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 04 Nov 2019 15:11:44 +0100 |
parents | f6be9412e42a |
children | e713f1a99861 2d8ab34c8c91 |
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 | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
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 | |
24 #include "../Scene2D/PolylineSceneLayer.h" | |
1048
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1030
diff
changeset
|
25 #include "../StoneException.h" |
815 | 26 #include "../Toolbox/GeometryToolbox.h" |
27 | |
1048
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1030
diff
changeset
|
28 #include <Core/Toolbox.h> |
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 |
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
|
32 #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
|
33 bool logbgo233 = false; |
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 bool logbgo115 = false; |
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 #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
|
36 |
815 | 37 namespace OrthancStone |
38 { | |
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
|
39 |
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 #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
|
41 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
|
42 { |
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 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
|
44 //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
|
45 //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
|
46 //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
|
47 // << "," << 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
|
48 //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
|
49 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
|
50 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
|
51 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
|
52 //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
|
53 } |
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
|
54 #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
|
55 |
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
|
56 |
815 | 57 class DicomStructureSetLoader::AddReferencedInstance : public LoaderStateMachine::State |
58 { | |
59 private: | |
60 std::string instanceId_; | |
61 | |
62 public: | |
63 AddReferencedInstance(DicomStructureSetLoader& that, | |
64 const std::string& instanceId) : | |
65 State(that), | |
66 instanceId_(instanceId) | |
67 { | |
68 } | |
69 | |
70 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message) | |
71 { | |
72 Json::Value tags; | |
73 message.ParseJsonBody(tags); | |
74 | |
75 Orthanc::DicomMap dicom; | |
76 dicom.FromDicomAsJson(tags); | |
77 | |
78 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); | |
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
|
79 |
815 | 80 loader.content_->AddReferencedSlice(dicom); |
81 | |
82 loader.countProcessedInstances_ ++; | |
83 assert(loader.countProcessedInstances_ <= loader.countReferencedInstances_); | |
84 | |
85 if (loader.countProcessedInstances_ == loader.countReferencedInstances_) | |
86 { | |
87 // All the referenced instances have been loaded, finalize the RT-STRUCT | |
88 loader.content_->CheckReferencedSlices(); | |
89 loader.revision_++; | |
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
|
90 loader.SetStructuresReady(); |
815 | 91 } |
92 } | |
93 }; | |
94 | |
95 | |
96 // State that converts a "SOP Instance UID" to an Orthanc identifier | |
97 class DicomStructureSetLoader::LookupInstance : public LoaderStateMachine::State | |
98 { | |
99 private: | |
100 std::string sopInstanceUid_; | |
101 | |
102 public: | |
103 LookupInstance(DicomStructureSetLoader& that, | |
104 const std::string& sopInstanceUid) : | |
105 State(that), | |
106 sopInstanceUid_(sopInstanceUid) | |
107 { | |
108 } | |
109 | |
110 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message) | |
111 { | |
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
|
112 #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
|
113 LOG(TRACE) << "DicomStructureSetLoader::LookupInstance::Handle() (SUCCESS)"; |
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
|
114 #endif |
815 | 115 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); |
116 | |
117 Json::Value lookup; | |
118 message.ParseJsonBody(lookup); | |
119 | |
120 if (lookup.type() != Json::arrayValue || | |
121 lookup.size() != 1 || | |
122 !lookup[0].isMember("Type") || | |
123 !lookup[0].isMember("Path") || | |
124 lookup[0]["Type"].type() != Json::stringValue || | |
125 lookup[0]["ID"].type() != Json::stringValue || | |
126 lookup[0]["Type"].asString() != "Instance") | |
127 { | |
841
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
128 std::stringstream msg; |
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
129 msg << "Unknown resource! message.GetAnswer() = " << message.GetAnswer() << " message.GetAnswerHeaders() = "; |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
130 for (OrthancRestApiCommand::HttpHeaders::const_iterator it = message.GetAnswerHeaders().begin(); |
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
131 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
|
132 { |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
133 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
|
134 } |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
135 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
|
136 LOG(ERROR) << msgStr; |
815 | 137 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); |
138 } | |
139 | |
140 const std::string instanceId = lookup[0]["ID"].asString(); | |
141 | |
142 { | |
143 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
144 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
|
145 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
|
146 command->SetUri(uri); |
815 | 147 command->SetPayload(new AddReferencedInstance(loader, instanceId)); |
148 Schedule(command.release()); | |
149 } | |
150 } | |
151 }; | |
152 | |
153 | |
154 class DicomStructureSetLoader::LoadStructure : public LoaderStateMachine::State | |
155 { | |
156 public: | |
157 LoadStructure(DicomStructureSetLoader& that) : | |
158 State(that) | |
159 { | |
160 } | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
161 |
815 | 162 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message) |
163 { | |
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
|
164 #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
|
165 if (logbgo115) |
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
|
166 LOG(TRACE) << "DicomStructureSetLoader::LoadStructure::Handle() (SUCCESS)"; |
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
|
167 #endif |
815 | 168 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); |
169 | |
170 { | |
171 OrthancPlugins::FullOrthancDataset dicom(message.GetAnswer()); | |
172 loader.content_.reset(new DicomStructureSet(dicom)); | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
173 size_t structureCount = loader.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
|
174 loader.structureVisibility_.resize(structureCount); |
1030
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
175 bool everythingVisible = false; |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
176 if ((loader.initiallyVisibleStructures_.size() == 1) |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
177 && (loader.initiallyVisibleStructures_[0].size() == 1) |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
178 && (loader.initiallyVisibleStructures_[0][0] == '*')) |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
179 { |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
180 everythingVisible = true; |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
181 } |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
182 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
183 for (size_t i = 0; i < structureCount; ++i) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
184 { |
1030
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
185 // if a single "*" string is supplied, this means we want everything |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
186 // to be visible... |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
187 if(everythingVisible) |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
188 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
189 loader.structureVisibility_.at(i) = true; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
190 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
191 else |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
192 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
193 // otherwise, we only enable visibility for those structures whose |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
194 // names are mentioned in the initiallyVisibleStructures_ array |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
195 const std::string& structureName = loader.content_->GetStructureName(i); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
196 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
197 std::vector<std::string>::iterator foundIt = |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
198 std::find( |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
199 loader.initiallyVisibleStructures_.begin(), |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
200 loader.initiallyVisibleStructures_.end(), |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
201 structureName); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
202 std::vector<std::string>::iterator endIt = loader.initiallyVisibleStructures_.end(); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
203 if (foundIt != endIt) |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
204 loader.structureVisibility_.at(i) = true; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
205 else |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
206 loader.structureVisibility_.at(i) = false; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
207 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
208 } |
815 | 209 } |
210 | |
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
|
211 // 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
|
212 // 0008,1155 tag. We try our best to cope with this. |
815 | 213 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
|
214 std::set<std::string> nonEmptyInstances; |
815 | 215 loader.content_->GetReferencedInstances(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
|
216 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
|
217 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
|
218 { |
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
|
219 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
|
220 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
|
221 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
|
222 } |
815 | 223 |
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
|
224 loader.countReferencedInstances_ = |
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
|
225 static_cast<unsigned int>(nonEmptyInstances.size()); |
815 | 226 |
227 for (std::set<std::string>::const_iterator | |
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
|
228 it = nonEmptyInstances.begin(); it != nonEmptyInstances.end(); ++it) |
815 | 229 { |
230 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
231 command->SetUri("/tools/lookup"); | |
232 command->SetMethod(Orthanc::HttpMethod_Post); | |
233 command->SetBody(*it); | |
234 command->SetPayload(new LookupInstance(loader, *it)); | |
235 Schedule(command.release()); | |
236 } | |
237 } | |
238 }; | |
239 | |
240 | |
241 class DicomStructureSetLoader::Slice : public IExtractedSlice | |
242 { | |
243 private: | |
244 const DicomStructureSet& content_; | |
245 uint64_t revision_; | |
246 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
|
247 std::vector<bool> visibility_; |
815 | 248 |
249 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
|
250 /** |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
251 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
|
252 - 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
|
253 or |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
254 - 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 */ |
815 | 260 Slice(const DicomStructureSet& content, |
261 uint64_t revision, | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
262 const CoordinateSystem3D& cuttingPlane, |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
263 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
|
264 : 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
|
265 , 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
|
266 , visibility_(visibility) |
815 | 267 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
268 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
|
269 || (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
|
270 |
815 | 271 bool opposite; |
272 | |
273 const Vector normal = content.GetNormal(); | |
274 isValid_ = ( | |
275 GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetNormal()) || | |
276 GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetAxisX()) || | |
277 GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetAxisY())); | |
278 } | |
279 | |
280 virtual bool IsValid() | |
281 { | |
282 return isValid_; | |
283 } | |
284 | |
285 virtual uint64_t GetRevision() | |
286 { | |
287 return revision_; | |
288 } | |
289 | |
290 virtual ISceneLayer* CreateSceneLayer(const ILayerStyleConfigurator* configurator, | |
291 const CoordinateSystem3D& cuttingPlane) | |
292 { | |
293 assert(isValid_); | |
294 | |
295 std::auto_ptr<PolylineSceneLayer> layer(new PolylineSceneLayer); | |
296 layer->SetThickness(2); | |
297 | |
298 for (size_t i = 0; i < content_.GetStructuresCount(); i++) | |
299 { | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
300 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
|
301 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
302 const Color& color = content_.GetStructureColor(i); |
815 | 303 |
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
|
304 #ifdef USE_BOOST_UNION_FOR_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
|
305 std::vector< std::vector<Point2D> > polygons; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
306 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
307 if (content_.ProjectStructure(polygons, i, cuttingPlane)) |
815 | 308 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
309 for (size_t j = 0; j < polygons.size(); j++) |
815 | 310 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
311 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
|
312 chain.resize(polygons[j].size()); |
815 | 313 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
314 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
|
315 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
316 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
|
317 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
318 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
319 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
|
320 } |
815 | 321 } |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
322 #else |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
323 std::vector< std::pair<Point2D, Point2D> > segments; |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
324 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
325 if (content_.ProjectStructure(segments, i, cuttingPlane)) |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
326 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
327 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
|
328 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
329 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
|
330 chain.resize(2); |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
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 chain[0] = ScenePoint2D(segments[j].first.x, segments[j].first.y); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
333 chain[1] = 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
|
334 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
335 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
|
336 } |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
337 } |
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 #endif |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
339 } |
815 | 340 } |
341 | |
342 return layer.release(); | |
343 } | |
344 }; | |
345 | |
346 | |
347 DicomStructureSetLoader::DicomStructureSetLoader(IOracle& oracle, | |
348 IObservable& oracleObservable) : | |
954 | 349 LoaderStateMachine(oracle, oracleObservable), |
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
|
350 IObservable(oracleObservable.GetBroker()), |
815 | 351 revision_(0), |
352 countProcessedInstances_(0), | |
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
|
353 countReferencedInstances_(0), |
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
|
354 structuresReady_(false) |
815 | 355 { |
356 } | |
357 | |
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 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
|
360 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
361 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
|
362 revision_++; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
363 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
364 |
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
|
365 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
|
366 { |
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
|
367 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
|
368 } |
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
|
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 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
|
371 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
|
372 const std::vector<std::string>& initiallyVisibleStructures) |
815 | 373 { |
374 Start(); | |
375 | |
376 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
|
377 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
|
378 |
815 | 379 { |
380 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
381 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
|
382 |
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
|
383 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
|
384 |
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
|
385 command->SetUri(uri); |
815 | 386 command->SetPayload(new LoadStructure(*this)); |
387 Schedule(command.release()); | |
388 } | |
389 } | |
390 | |
391 | |
392 IVolumeSlicer::IExtractedSlice* DicomStructureSetLoader::ExtractSlice(const CoordinateSystem3D& cuttingPlane) | |
393 { | |
394 if (content_.get() == NULL) | |
395 { | |
396 // Geometry is not available yet | |
397 return new IVolumeSlicer::InvalidSlice; | |
398 } | |
399 else | |
400 { | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
401 return new Slice(*content_, revision_, cuttingPlane, structureVisibility_); |
815 | 402 } |
403 } | |
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
|
404 |
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
|
405 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
|
406 { |
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
|
407 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
|
408 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
|
409 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
|
410 } |
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
|
411 |
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
|
412 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
|
413 { |
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
|
414 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
|
415 } |
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
|
416 |
815 | 417 } |