Mercurial > hg > orthanc-stone
diff Framework/Deprecated/SmartLoader.cpp @ 1068:04a95ee91327 broker
recovery of OrthancStoneSingleFrame
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 15 Oct 2019 19:36:57 +0200 |
parents | b537002f83a9 |
children | 0ca50d275b9a |
line wrap: on
line diff
--- a/Framework/Deprecated/SmartLoader.cpp Tue Oct 15 18:11:40 2019 +0200 +++ b/Framework/Deprecated/SmartLoader.cpp Tue Oct 15 19:36:57 2019 +0200 @@ -113,7 +113,7 @@ }; - SmartLoader::SmartLoader(OrthancApiClient& orthancApiClient) : + SmartLoader::SmartLoader(boost::shared_ptr<OrthancApiClient> orthancApiClient) : imageQuality_(SliceImageQuality_FullPam), orthancApiClient_(orthancApiClient) { @@ -131,7 +131,7 @@ // the messages to its observables // in both cases, we must be carefull about objects lifecycle !!! - std::auto_ptr<IVolumeSlicer> layerSource; + boost::shared_ptr<IVolumeSlicer> layerSource; std::string sliceKeyId = instanceId + ":" + boost::lexical_cast<std::string>(frame); SmartLoader::CachedSlice* cachedSlice = NULL; @@ -142,7 +142,8 @@ } else { - layerSource.reset(new DicomSeriesVolumeSlicer(orthancApiClient_)); + layerSource.reset(new DicomSeriesVolumeSlicer); + dynamic_cast<DicomSeriesVolumeSlicer*>(layerSource.get())->Connect(orthancApiClient_); dynamic_cast<DicomSeriesVolumeSlicer*>(layerSource.get())->SetImageQuality(imageQuality_); Register<IVolumeSlicer::GeometryReadyMessage>(*layerSource, &SmartLoader::OnLayerGeometryReady); Register<DicomSeriesVolumeSlicer::FrameReadyMessage>(*layerSource, &SmartLoader::OnFrameReady); @@ -153,11 +154,11 @@ // make sure that the widget registers the events before we trigger them if (sliceViewer.GetLayerCount() == layerIndex) { - sliceViewer.AddLayer(layerSource.release()); + sliceViewer.AddLayer(layerSource); } else if (sliceViewer.GetLayerCount() > layerIndex) { - sliceViewer.ReplaceLayer(layerIndex, layerSource.release()); + sliceViewer.ReplaceLayer(layerIndex, layerSource); } else { @@ -190,8 +191,8 @@ cachedSlices_[sliceKeyId] = boost::shared_ptr<CachedSlice>(cachedSlice); - std::auto_ptr<IVolumeSlicer> layerSource(new DicomSeriesVolumeSlicer(orthancApiClient_)); - + std::auto_ptr<IVolumeSlicer> layerSource(new DicomSeriesVolumeSlicer); + dynamic_cast<DicomSeriesVolumeSlicer*>(layerSource.get())->Connect(orthancApiClient_); dynamic_cast<DicomSeriesVolumeSlicer*>(layerSource.get())->SetImageQuality(imageQuality_); Register<IVolumeSlicer::GeometryReadyMessage>(*layerSource, &SmartLoader::OnLayerGeometryReady); Register<DicomSeriesVolumeSlicer::FrameReadyMessage>(*layerSource, &SmartLoader::OnFrameReady);