Mercurial > hg > orthanc-stone
annotate Framework/Loaders/OrthancMultiframeVolumeLoader.cpp @ 1092:5a35688c4874
Added tag toa2019102301 for changeset 5a18e6a395bc
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 23 Oct 2019 15:34:58 +0200 |
parents | 391fb6d6905d |
children | f72d1ab42932 33b0a762e98a |
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 "OrthancMultiframeVolumeLoader.h" | |
23 | |
816 | 24 #include <Core/Endianness.h> |
815 | 25 #include <Core/Toolbox.h> |
26 | |
27 namespace OrthancStone | |
28 { | |
29 class OrthancMultiframeVolumeLoader::LoadRTDoseGeometry : public LoaderStateMachine::State | |
30 { | |
31 private: | |
32 std::auto_ptr<Orthanc::DicomMap> dicom_; | |
33 | |
34 public: | |
35 LoadRTDoseGeometry(OrthancMultiframeVolumeLoader& that, | |
36 Orthanc::DicomMap* dicom) : | |
37 State(that), | |
38 dicom_(dicom) | |
39 { | |
40 if (dicom == NULL) | |
41 { | |
42 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | |
43 } | |
44 | |
45 } | |
46 | |
47 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message) | |
48 { | |
49 // Complete the DICOM tags with just-received "Grid Frame Offset Vector" | |
50 std::string s = Orthanc::Toolbox::StripSpaces(message.GetAnswer()); | |
51 dicom_->SetValue(Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR, s, false); | |
52 | |
53 GetLoader<OrthancMultiframeVolumeLoader>().SetGeometry(*dicom_); | |
54 } | |
55 }; | |
56 | |
57 | |
58 static std::string GetSopClassUid(const Orthanc::DicomMap& dicom) | |
59 { | |
60 std::string s; | |
994
1f74bc3459ba
fix build due to rename in Orthanc::DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
956
diff
changeset
|
61 if (!dicom.LookupStringValue(s, Orthanc::DICOM_TAG_SOP_CLASS_UID, false)) |
815 | 62 { |
63 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, | |
64 "DICOM file without SOP class UID"); | |
65 } | |
66 else | |
67 { | |
68 return s; | |
69 } | |
70 } | |
71 | |
72 | |
73 class OrthancMultiframeVolumeLoader::LoadGeometry : public State | |
74 { | |
75 public: | |
76 LoadGeometry(OrthancMultiframeVolumeLoader& that) : | |
77 State(that) | |
78 { | |
79 } | |
80 | |
81 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message) | |
82 { | |
83 OrthancMultiframeVolumeLoader& loader = GetLoader<OrthancMultiframeVolumeLoader>(); | |
84 | |
85 Json::Value body; | |
86 message.ParseJsonBody(body); | |
87 | |
88 if (body.type() != Json::objectValue) | |
89 { | |
90 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); | |
91 } | |
92 | |
93 std::auto_ptr<Orthanc::DicomMap> dicom(new Orthanc::DicomMap); | |
94 dicom->FromDicomAsJson(body); | |
95 | |
96 if (StringToSopClassUid(GetSopClassUid(*dicom)) == SopClassUid_RTDose) | |
97 { | |
98 // Download the "Grid Frame Offset Vector" DICOM tag, that is | |
99 // mandatory for RT-DOSE, but is too long to be returned by default | |
100 | |
101 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
102 command->SetUri("/instances/" + loader.GetInstanceId() + "/content/" + | |
103 Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR.Format()); | |
104 command->SetPayload(new LoadRTDoseGeometry(loader, dicom.release())); | |
105 | |
106 Schedule(command.release()); | |
107 } | |
108 else | |
109 { | |
110 loader.SetGeometry(*dicom); | |
111 } | |
112 } | |
113 }; | |
114 | |
115 class OrthancMultiframeVolumeLoader::LoadTransferSyntax : public State | |
116 { | |
117 public: | |
118 LoadTransferSyntax(OrthancMultiframeVolumeLoader& that) : | |
119 State(that) | |
120 { | |
121 } | |
122 | |
123 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message) | |
124 { | |
125 GetLoader<OrthancMultiframeVolumeLoader>().SetTransferSyntax(message.GetAnswer()); | |
126 } | |
127 }; | |
925
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
128 |
815 | 129 class OrthancMultiframeVolumeLoader::LoadUncompressedPixelData : public State |
130 { | |
131 public: | |
132 LoadUncompressedPixelData(OrthancMultiframeVolumeLoader& that) : | |
133 State(that) | |
134 { | |
135 } | |
136 | |
137 virtual void Handle(const OrthancRestApiCommand::SuccessMessage& message) | |
138 { | |
139 GetLoader<OrthancMultiframeVolumeLoader>().SetUncompressedPixelData(message.GetAnswer()); | |
140 } | |
141 }; | |
925
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
142 |
815 | 143 const std::string& OrthancMultiframeVolumeLoader::GetInstanceId() const |
144 { | |
145 if (IsActive()) | |
146 { | |
147 return instanceId_; | |
148 } | |
149 else | |
150 { | |
956
a7351ad54960
Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents:
949
diff
changeset
|
151 LOG(ERROR) << "OrthancMultiframeVolumeLoader::GetInstanceId(): (!IsActive())"; |
815 | 152 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
153 } | |
154 } | |
155 | |
156 void OrthancMultiframeVolumeLoader::ScheduleFrameDownloads() | |
157 { | |
158 if (transferSyntaxUid_.empty() || | |
159 !volume_->HasGeometry()) | |
160 { | |
161 return; | |
162 } | |
163 /* | |
164 1.2.840.10008.1.2 Implicit VR Endian: Default Transfer Syntax for DICOM | |
165 1.2.840.10008.1.2.1 Explicit VR Little Endian | |
166 1.2.840.10008.1.2.2 Explicit VR Big Endian | |
167 | |
168 See https://www.dicomlibrary.com/dicom/transfer-syntax/ | |
169 */ | |
170 if (transferSyntaxUid_ == "1.2.840.10008.1.2" || | |
171 transferSyntaxUid_ == "1.2.840.10008.1.2.1" || | |
172 transferSyntaxUid_ == "1.2.840.10008.1.2.2") | |
173 { | |
174 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
175 command->SetHttpHeader("Accept-Encoding", "gzip"); | |
176 command->SetUri("/instances/" + instanceId_ + "/content/" + | |
177 Orthanc::DICOM_TAG_PIXEL_DATA.Format() + "/0"); | |
178 command->SetPayload(new LoadUncompressedPixelData(*this)); | |
179 Schedule(command.release()); | |
180 } | |
181 else | |
182 { | |
183 throw Orthanc::OrthancException( | |
184 Orthanc::ErrorCode_NotImplemented, | |
185 "No support for multiframe instances with transfer syntax: " + transferSyntaxUid_); | |
186 } | |
187 } | |
188 | |
189 | |
190 void OrthancMultiframeVolumeLoader::SetTransferSyntax(const std::string& transferSyntax) | |
191 { | |
192 transferSyntaxUid_ = Orthanc::Toolbox::StripSpaces(transferSyntax); | |
193 ScheduleFrameDownloads(); | |
194 } | |
195 | |
196 void OrthancMultiframeVolumeLoader::SetGeometry(const Orthanc::DicomMap& dicom) | |
197 { | |
198 DicomInstanceParameters parameters(dicom); | |
199 volume_->SetDicomParameters(parameters); | |
200 | |
201 Orthanc::PixelFormat format; | |
202 if (!parameters.GetImageInformation().ExtractPixelFormat(format, true)) | |
203 { | |
204 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | |
205 } | |
206 | |
207 double spacingZ; | |
208 switch (parameters.GetSopClassUid()) | |
209 { | |
210 case SopClassUid_RTDose: | |
211 spacingZ = parameters.GetThickness(); | |
212 break; | |
213 | |
214 default: | |
215 throw Orthanc::OrthancException( | |
216 Orthanc::ErrorCode_NotImplemented, | |
217 "No support for multiframe instances with SOP class UID: " + GetSopClassUid(dicom)); | |
218 } | |
219 | |
220 const unsigned int width = parameters.GetImageInformation().GetWidth(); | |
221 const unsigned int height = parameters.GetImageInformation().GetHeight(); | |
222 const unsigned int depth = parameters.GetImageInformation().GetNumberOfFrames(); | |
223 | |
224 { | |
225 VolumeImageGeometry geometry; | |
949
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
226 geometry.SetSizeInVoxels(width, height, depth); |
815 | 227 geometry.SetAxialGeometry(parameters.GetGeometry()); |
228 geometry.SetVoxelDimensions(parameters.GetPixelSpacingX(), | |
229 parameters.GetPixelSpacingY(), spacingZ); | |
1072
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
994
diff
changeset
|
230 volume_->Initialize(geometry, format, true /* Do compute range */); |
815 | 231 } |
232 | |
233 volume_->GetPixelData().Clear(); | |
234 | |
235 ScheduleFrameDownloads(); | |
236 | |
949
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
237 |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
238 |
815 | 239 BroadcastMessage(DicomVolumeImage::GeometryReadyMessage(*volume_)); |
240 } | |
241 | |
242 | |
243 ORTHANC_FORCE_INLINE | |
925
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
244 static void CopyPixel(uint32_t& target, const void* source) |
815 | 245 { |
246 // TODO - check alignement? | |
247 target = le32toh(*reinterpret_cast<const uint32_t*>(source)); | |
248 } | |
925
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
249 |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
250 ORTHANC_FORCE_INLINE |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
251 static void CopyPixel(uint16_t& target, const void* source) |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
252 { |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
253 // TODO - check alignement? |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
254 target = le16toh(*reinterpret_cast<const uint16_t*>(source)); |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
255 } |
815 | 256 |
257 template <typename T> | |
258 void OrthancMultiframeVolumeLoader::CopyPixelData(const std::string& pixelData) | |
259 { | |
260 ImageBuffer3D& target = volume_->GetPixelData(); | |
261 | |
262 const unsigned int bpp = target.GetBytesPerPixel(); | |
263 const unsigned int width = target.GetWidth(); | |
264 const unsigned int height = target.GetHeight(); | |
265 const unsigned int depth = target.GetDepth(); | |
266 | |
267 if (pixelData.size() != bpp * width * height * depth) | |
268 { | |
269 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, | |
270 "The pixel data has not the proper size"); | |
271 } | |
272 | |
273 if (pixelData.empty()) | |
274 { | |
275 return; | |
276 } | |
277 | |
278 const uint8_t* source = reinterpret_cast<const uint8_t*>(pixelData.c_str()); | |
279 | |
280 for (unsigned int z = 0; z < depth; z++) | |
281 { | |
282 ImageBuffer3D::SliceWriter writer(target, VolumeProjection_Axial, z); | |
283 | |
284 assert (writer.GetAccessor().GetWidth() == width && | |
285 writer.GetAccessor().GetHeight() == height); | |
286 | |
287 for (unsigned int y = 0; y < height; y++) | |
288 { | |
289 assert(sizeof(T) == Orthanc::GetBytesPerPixel(target.GetFormat())); | |
290 | |
291 T* target = reinterpret_cast<T*>(writer.GetAccessor().GetRow(y)); | |
292 | |
293 for (unsigned int x = 0; x < width; x++) | |
294 { | |
295 CopyPixel(*target, source); | |
296 | |
297 target ++; | |
298 source += bpp; | |
299 } | |
300 } | |
301 } | |
302 } | |
303 | |
304 void OrthancMultiframeVolumeLoader::SetUncompressedPixelData(const std::string& pixelData) | |
305 { | |
306 switch (volume_->GetPixelData().GetFormat()) | |
307 { | |
308 case Orthanc::PixelFormat_Grayscale32: | |
309 CopyPixelData<uint32_t>(pixelData); | |
310 break; | |
925
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
311 case Orthanc::PixelFormat_Grayscale16: |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
312 CopyPixelData<uint16_t>(pixelData); |
4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
313 break; |
815 | 314 default: |
315 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | |
316 } | |
317 | |
318 volume_->IncrementRevision(); | |
319 | |
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
|
320 pixelDataLoaded_ = true; |
815 | 321 BroadcastMessage(DicomVolumeImage::ContentUpdatedMessage(*volume_)); |
322 } | |
949
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
323 |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
324 bool OrthancMultiframeVolumeLoader::HasGeometry() const |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
325 { |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
326 return volume_->HasGeometry(); |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
327 } |
815 | 328 |
949
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
329 const OrthancStone::VolumeImageGeometry& OrthancMultiframeVolumeLoader::GetImageGeometry() const |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
330 { |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
331 return volume_->GetGeometry(); |
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
332 } |
815 | 333 |
921
81d30cd93b65
Ability to ask the loader for the geometry in PULL mode (when subscribing to the messages is not possible) + small changes (removed const/ref qualifiers for boost::shared_ptr param, added traces, doc change)
Benjamin Golinvaux <bgo@osimis.io>
parents:
816
diff
changeset
|
334 OrthancMultiframeVolumeLoader::OrthancMultiframeVolumeLoader(boost::shared_ptr<DicomVolumeImage> volume, |
815 | 335 IOracle& oracle, |
336 IObservable& oracleObservable) : | |
337 LoaderStateMachine(oracle, oracleObservable), | |
338 IObservable(oracleObservable.GetBroker()), | |
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
|
339 volume_(volume), |
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
|
340 pixelDataLoaded_(false) |
815 | 341 { |
342 if (volume.get() == NULL) | |
343 { | |
344 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | |
345 } | |
346 } | |
347 | |
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:
925
diff
changeset
|
348 OrthancMultiframeVolumeLoader::~OrthancMultiframeVolumeLoader() |
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:
925
diff
changeset
|
349 { |
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:
925
diff
changeset
|
350 LOG(TRACE) << "OrthancMultiframeVolumeLoader::~OrthancMultiframeVolumeLoader()"; |
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:
925
diff
changeset
|
351 } |
815 | 352 |
353 void OrthancMultiframeVolumeLoader::LoadInstance(const std::string& instanceId) | |
354 { | |
355 Start(); | |
356 | |
357 instanceId_ = instanceId; | |
358 | |
359 { | |
360 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
361 command->SetHttpHeader("Accept-Encoding", "gzip"); | |
362 command->SetUri("/instances/" + instanceId + "/tags"); | |
363 command->SetPayload(new LoadGeometry(*this)); | |
364 Schedule(command.release()); | |
365 } | |
366 | |
367 { | |
368 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
369 command->SetUri("/instances/" + instanceId + "/metadata/TransferSyntax"); | |
370 command->SetPayload(new LoadTransferSyntax(*this)); | |
371 Schedule(command.release()); | |
372 } | |
373 } | |
374 } |