Mercurial > hg > orthanc-stone
annotate Framework/Loaders/DicomStructureSetLoader.cpp @ 1342:13573ff63eb6 broker
New StructuresUpdated message that is sent
during individual structure set addition.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 06 Apr 2020 08:42:40 +0200 |
parents | 556b4bc19118 |
children | 0d6a01ffa1dd |
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 |
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 |
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 |
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 |
815 | 52 class DicomStructureSetLoader::AddReferencedInstance : public LoaderStateMachine::State |
53 { | |
54 private: | |
55 std::string instanceId_; | |
56 | |
57 public: | |
58 AddReferencedInstance(DicomStructureSetLoader& that, | |
59 const std::string& instanceId) : | |
60 State(that), | |
61 instanceId_(instanceId) | |
62 { | |
63 } | |
64 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
65 virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
815 | 66 { |
67 Json::Value tags; | |
68 message.ParseJsonBody(tags); | |
69 | |
70 Orthanc::DicomMap dicom; | |
71 dicom.FromDicomAsJson(tags); | |
72 | |
73 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
|
74 |
815 | 75 loader.content_->AddReferencedSlice(dicom); |
76 loader.countProcessedInstances_ ++; | |
77 assert(loader.countProcessedInstances_ <= loader.countReferencedInstances_); | |
78 | |
1342
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
79 loader.SetStructuresUpdated(); |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
80 |
815 | 81 if (loader.countProcessedInstances_ == loader.countReferencedInstances_) |
82 { | |
83 // All the referenced instances have been loaded, finalize the RT-STRUCT | |
84 loader.content_->CheckReferencedSlices(); | |
85 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
|
86 loader.SetStructuresReady(); |
815 | 87 } |
88 } | |
89 }; | |
90 | |
91 | |
92 // State that converts a "SOP Instance UID" to an Orthanc identifier | |
93 class DicomStructureSetLoader::LookupInstance : public LoaderStateMachine::State | |
94 { | |
95 private: | |
96 std::string sopInstanceUid_; | |
97 | |
98 public: | |
99 LookupInstance(DicomStructureSetLoader& that, | |
100 const std::string& sopInstanceUid) : | |
101 State(that), | |
102 sopInstanceUid_(sopInstanceUid) | |
103 { | |
104 } | |
105 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
106 virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
815 | 107 { |
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
|
108 #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
|
109 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
|
110 #endif |
815 | 111 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); |
112 | |
113 Json::Value lookup; | |
114 message.ParseJsonBody(lookup); | |
115 | |
116 if (lookup.type() != Json::arrayValue || | |
117 lookup.size() != 1 || | |
118 !lookup[0].isMember("Type") || | |
119 !lookup[0].isMember("Path") || | |
120 lookup[0]["Type"].type() != Json::stringValue || | |
121 lookup[0]["ID"].type() != Json::stringValue || | |
122 lookup[0]["Type"].asString() != "Instance") | |
123 { | |
841
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
124 std::stringstream msg; |
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
828
diff
changeset
|
125 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
|
126 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
|
127 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
|
128 { |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
129 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
|
130 } |
842
2b245953b44b
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
131 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
|
132 LOG(ERROR) << msgStr; |
815 | 133 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); |
134 } | |
135 | |
136 const std::string instanceId = lookup[0]["ID"].asString(); | |
137 | |
138 { | |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
139 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); |
815 | 140 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
|
141 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
|
142 command->SetUri(uri); |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1059
diff
changeset
|
143 command->AcquirePayload(new AddReferencedInstance(loader, instanceId)); |
815 | 144 Schedule(command.release()); |
145 } | |
146 } | |
147 }; | |
148 | |
149 | |
150 class DicomStructureSetLoader::LoadStructure : public LoaderStateMachine::State | |
151 { | |
152 public: | |
153 LoadStructure(DicomStructureSetLoader& that) : | |
154 State(that) | |
155 { | |
156 } | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
157 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
158 virtual void Handle(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message) |
815 | 159 { |
160 DicomStructureSetLoader& loader = GetLoader<DicomStructureSetLoader>(); | |
161 | |
162 { | |
163 OrthancPlugins::FullOrthancDataset dicom(message.GetAnswer()); | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
164 loader.content_.reset(new OrthancStone::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
|
165 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
|
166 loader.structureVisibility_.resize(structureCount); |
1030
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
167 bool everythingVisible = false; |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
168 if ((loader.initiallyVisibleStructures_.size() == 1) |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
169 && (loader.initiallyVisibleStructures_[0].size() == 1) |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
170 && (loader.initiallyVisibleStructures_[0][0] == '*')) |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
171 { |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
172 everythingVisible = true; |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
173 } |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
174 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
175 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
|
176 { |
1030
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
177 // 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
|
178 // to be visible... |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
179 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
|
180 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
181 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
|
182 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
183 else |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
184 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
185 // 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
|
186 // 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
|
187 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
|
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 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
|
190 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
|
191 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
|
192 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
|
193 structureName); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
194 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
|
195 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
|
196 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
|
197 else |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
198 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
|
199 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
200 } |
815 | 201 } |
202 | |
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
|
203 // 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
|
204 // 0008,1155 tag. We try our best to cope with this. |
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; |
815 | 207 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
|
208 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
|
209 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
|
210 { |
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 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
|
212 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
|
213 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
|
214 } |
815 | 215 |
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 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
|
217 static_cast<unsigned int>(nonEmptyInstances.size()); |
815 | 218 |
219 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
|
220 it = nonEmptyInstances.begin(); it != nonEmptyInstances.end(); ++it) |
815 | 221 { |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
222 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); |
815 | 223 command->SetUri("/tools/lookup"); |
224 command->SetMethod(Orthanc::HttpMethod_Post); | |
225 command->SetBody(*it); | |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1059
diff
changeset
|
226 command->AcquirePayload(new LookupInstance(loader, *it)); |
815 | 227 Schedule(command.release()); |
228 } | |
229 } | |
230 }; | |
231 | |
232 | |
233 class DicomStructureSetLoader::Slice : public IExtractedSlice | |
234 { | |
235 private: | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
236 const OrthancStone::DicomStructureSet& content_; |
815 | 237 uint64_t revision_; |
238 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
|
239 std::vector<bool> visibility_; |
815 | 240 |
241 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
|
242 /** |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
243 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
|
244 - 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
|
245 or |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
246 - 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 */ |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
252 Slice(const OrthancStone::DicomStructureSet& content, |
815 | 253 uint64_t revision, |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
254 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
|
255 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
|
256 : 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
|
257 , 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
|
258 , visibility_(visibility) |
815 | 259 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
260 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
|
261 || (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
|
262 |
815 | 263 bool opposite; |
264 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
265 const OrthancStone::Vector normal = content.GetNormal(); |
815 | 266 isValid_ = ( |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
267 OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetNormal()) || |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
268 OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetAxisX()) || |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
269 OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, normal, cuttingPlane.GetAxisY())); |
815 | 270 } |
271 | |
272 virtual bool IsValid() | |
273 { | |
274 return isValid_; | |
275 } | |
276 | |
277 virtual uint64_t GetRevision() | |
278 { | |
279 return revision_; | |
280 } | |
281 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
282 virtual OrthancStone::ISceneLayer* CreateSceneLayer( |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
283 const OrthancStone::ILayerStyleConfigurator* configurator, |
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
284 const OrthancStone::CoordinateSystem3D& cuttingPlane) |
815 | 285 { |
286 assert(isValid_); | |
287 | |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
288 std::unique_ptr<OrthancStone::PolylineSceneLayer> layer(new OrthancStone::PolylineSceneLayer); |
815 | 289 layer->SetThickness(2); |
290 | |
291 for (size_t i = 0; i < content_.GetStructuresCount(); i++) | |
292 { | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
293 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
|
294 { |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
295 const OrthancStone::Color& color = content_.GetStructureColor(i); |
815 | 296 |
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
|
297 #ifdef USE_BOOST_UNION_FOR_POLYGONS |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
298 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
|
299 |
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 (content_.ProjectStructure(polygons, i, cuttingPlane)) |
815 | 301 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
302 for (size_t j = 0; j < polygons.size(); j++) |
815 | 303 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
304 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
|
305 chain.resize(polygons[j].size()); |
815 | 306 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
307 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
|
308 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
309 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
|
310 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
311 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
312 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
|
313 } |
815 | 314 } |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
315 #else |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
316 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
|
317 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
318 if (content_.ProjectStructure(segments, i, cuttingPlane)) |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
319 { |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
320 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
|
321 { |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
322 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
|
323 chain.resize(2); |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
324 |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
325 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
|
326 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
|
327 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
328 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
|
329 } |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
330 } |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
331 #endif |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
981
diff
changeset
|
332 } |
815 | 333 } |
334 | |
335 return layer.release(); | |
336 } | |
337 }; | |
338 | |
339 | |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
340 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
|
341 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
|
342 : 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
|
343 , 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
|
344 , 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
|
345 , 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
|
346 , 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
|
347 , structuresReady_(false) |
815 | 348 { |
349 } | |
1310
9bea7e15b519
- first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents:
1300
diff
changeset
|
350 |
815 | 351 |
1339
556b4bc19118
The loaders have been adapter to the nobroker architecture
Benjamin Golinvaux <bgo@osimis.io>
parents:
1337
diff
changeset
|
352 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
|
353 { |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
354 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
|
355 new DicomStructureSetLoader( |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
356 loadersContext)); |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
357 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
|
358 return obj; |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
359 |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
360 } |
9b126de2cde2
Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents:
1310
diff
changeset
|
361 |
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 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
|
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 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
|
365 revision_++; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
366 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
367 |
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
|
368 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
|
369 { |
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
|
370 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
|
371 } |
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
|
372 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
373 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
|
374 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
|
375 const std::vector<std::string>& initiallyVisibleStructures) |
815 | 376 { |
377 Start(); | |
378 | |
379 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
|
380 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
|
381 |
815 | 382 { |
1299
c38c89684d83
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
383 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand); |
815 | 384 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
|
385 |
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
|
386 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
|
387 |
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
|
388 command->SetUri(uri); |
1128
8e3763d1736a
removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1059
diff
changeset
|
389 command->AcquirePayload(new LoadStructure(*this)); |
815 | 390 Schedule(command.release()); |
391 } | |
392 } | |
393 | |
394 | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
395 OrthancStone::IVolumeSlicer::IExtractedSlice* DicomStructureSetLoader::ExtractSlice(const OrthancStone::CoordinateSystem3D& cuttingPlane) |
815 | 396 { |
397 if (content_.get() == NULL) | |
398 { | |
399 // Geometry is not available yet | |
1225
16738485e457
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1128
diff
changeset
|
400 return new OrthancStone::IVolumeSlicer::InvalidSlice; |
815 | 401 } |
402 else | |
403 { | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1006
diff
changeset
|
404 return new Slice(*content_, revision_, cuttingPlane, structureVisibility_); |
815 | 405 } |
406 } | |
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
|
407 |
1342
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
408 void DicomStructureSetLoader::SetStructuresUpdated() |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
409 { |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
410 BroadcastMessage(DicomStructureSetLoader::StructuresUpdated(*this)); |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
411 } |
13573ff63eb6
New StructuresUpdated message that is sent
Benjamin Golinvaux <bgo@osimis.io>
parents:
1339
diff
changeset
|
412 |
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
|
413 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
|
414 { |
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 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
|
416 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
|
417 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
|
418 } |
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
|
419 |
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
|
420 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
|
421 { |
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
|
422 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
|
423 } |
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
|
424 |
815 | 425 } |