comparison Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp @ 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)
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 31 Jul 2019 10:24:09 +0200
parents 401808e7ff2e
children 32eaf4929b08
comparison
equal deleted inserted replaced
936:775ebd43bd3b 937:86ac61a040c9
262 std::auto_ptr<OracleCommandWithPayload> command; 262 std::auto_ptr<OracleCommandWithPayload> command;
263 263
264 if (quality == BEST_QUALITY) 264 if (quality == BEST_QUALITY)
265 { 265 {
266 std::auto_ptr<GetOrthancImageCommand> tmp(new GetOrthancImageCommand); 266 std::auto_ptr<GetOrthancImageCommand> tmp(new GetOrthancImageCommand);
267 // TODO: review the following comment. Commented out by bgo on 2019-07-19 267 // TODO: review the following comment.
268 // reason: Alain has seen cases where gzipping the uint16 image took 11 sec 268 // - Commented out by bgo on 2019-07-19 | reason: Alain has seen cases
269 // to produce 5mb. The unzipped request was much much faster. 269 // where gzipping the uint16 image took 11 sec to produce 5mb.
270 //tmp->SetHttpHeader("Accept-Encoding", "gzip"); 270 // The unzipped request was much much faster.
271 // - Re-enabled on 2019-07-30. Reason: in Web Assembly, the browser
272 // does not use the Accept-Encoding header and always requests
273 // compression. Furthermore, NOT
274 tmp->SetHttpHeader("Accept-Encoding", "gzip");
271 tmp->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); 275 tmp->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam)));
272 tmp->SetInstanceUri(instance, slice.GetExpectedPixelFormat()); 276 tmp->SetInstanceUri(instance, slice.GetExpectedPixelFormat());
273 tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat()); 277 tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat());
274 command.reset(tmp.release()); 278 command.reset(tmp.release());
275 } 279 }
285 command.reset(tmp.release()); 289 command.reset(tmp.release());
286 } 290 }
287 291
288 command->SetPayload(new Orthanc::SingleValueObject<unsigned int>(sliceIndex)); 292 command->SetPayload(new Orthanc::SingleValueObject<unsigned int>(sliceIndex));
289 oracle_.Schedule(*this, command.release()); 293 oracle_.Schedule(*this, command.release());
294 }
295 else
296 {
297 // loading is finished!
298 volumeImageReadyInHighQuality_ = true;
299 BroadcastMessage(OrthancSeriesVolumeProgressiveLoader::VolumeImageReadyInHighQuality(*this));
290 } 300 }
291 } 301 }
292 302
293 /** 303 /**
294 This is called in response to GET "/series/XXXXXXXXXXXXX/instances-tags" 304 This is called in response to GET "/series/XXXXXXXXXXXXX/instances-tags"
413 IObservable(oracleObservable.GetBroker()), 423 IObservable(oracleObservable.GetBroker()),
414 oracle_(oracle), 424 oracle_(oracle),
415 active_(false), 425 active_(false),
416 simultaneousDownloads_(4), 426 simultaneousDownloads_(4),
417 volume_(volume), 427 volume_(volume),
418 sorter_(new BasicFetchingItemsSorter::Factory) 428 sorter_(new BasicFetchingItemsSorter::Factory),
429 volumeImageReadyInHighQuality_(false)
419 { 430 {
420 oracleObservable.RegisterObserverCallback( 431 oracleObservable.RegisterObserverCallback(
421 new Callable<OrthancSeriesVolumeProgressiveLoader, OrthancRestApiCommand::SuccessMessage> 432 new Callable<OrthancSeriesVolumeProgressiveLoader, OrthancRestApiCommand::SuccessMessage>
422 (*this, &OrthancSeriesVolumeProgressiveLoader::LoadGeometry)); 433 (*this, &OrthancSeriesVolumeProgressiveLoader::LoadGeometry));
423 434