Mercurial > hg > orthanc-stone
comparison Framework/Layers/OrthancFrameLayerSource.cpp @ 247:3d523c9a8f0d am
trying to use boost::signals2 even more.
author | am@osimis.io |
---|---|
date | Mon, 02 Jul 2018 12:32:02 +0200 |
parents | 5412adf19980 |
children |
comparison
equal
deleted
inserted
replaced
246:5470b15f7cf2 | 247:3d523c9a8f0d |
---|---|
53 const Slice& slice, | 53 const Slice& slice, |
54 std::auto_ptr<Orthanc::ImageAccessor>& image, | 54 std::auto_ptr<Orthanc::ImageAccessor>& image, |
55 SliceImageQuality quality) | 55 SliceImageQuality quality) |
56 { | 56 { |
57 bool isFull = (quality == SliceImageQuality_Full); | 57 bool isFull = (quality == SliceImageQuality_Full); |
58 LayerSourceBase::NotifyLayerReady(FrameRenderer::CreateRenderer(image.release(), slice, isFull), | 58 LayerSourceBase::NotifyLayerReady(boost::shared_ptr<ILayerRenderer>(FrameRenderer::CreateRenderer(image.release(), slice, isFull)), |
59 slice.GetGeometry(), false); | 59 slice.GetGeometry(), false); |
60 } | 60 } |
61 | 61 |
62 void OrthancFrameLayerSource::NotifySliceImageError(const OrthancSlicesLoader& loader, | 62 void OrthancFrameLayerSource::NotifySliceImageError(const OrthancSlicesLoader& loader, |
63 unsigned int sliceIndex, | 63 unsigned int sliceIndex, |
66 { | 66 { |
67 LayerSourceBase::NotifyLayerReady(NULL, slice.GetGeometry(), true); | 67 LayerSourceBase::NotifyLayerReady(NULL, slice.GetGeometry(), true); |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 OrthancFrameLayerSource::OrthancFrameLayerSource(IWebService& orthanc) : | 71 OrthancFrameLayerSource::OrthancFrameLayerSource() : |
72 loader_(*this, orthanc), | |
73 quality_(SliceImageQuality_Full) | 72 quality_(SliceImageQuality_Full) |
74 { | 73 { |
75 } | 74 } |
76 | 75 |
77 | 76 void OrthancFrameLayerSource::Init(IWebService& orthanc) { |
77 // note: there must have been a shared_ptr created on this object before calling shared_from_this() | |
78 | |
79 loader_.reset(new OrthancSlicesLoader(shared_from_this(), orthanc)); | |
80 } | |
81 | |
78 void OrthancFrameLayerSource::LoadSeries(const std::string& seriesId) | 82 void OrthancFrameLayerSource::LoadSeries(const std::string& seriesId) |
79 { | 83 { |
80 loader_.ScheduleLoadSeries(seriesId); | 84 loader_->ScheduleLoadSeries(loader_, seriesId); |
81 } | 85 } |
82 | 86 |
83 | 87 |
84 void OrthancFrameLayerSource::LoadInstance(const std::string& instanceId) | 88 void OrthancFrameLayerSource::LoadInstance(const std::string& instanceId) |
85 { | 89 { |
86 loader_.ScheduleLoadInstance(instanceId); | 90 loader_->ScheduleLoadInstance(loader_, instanceId); |
87 } | 91 } |
88 | 92 |
89 | 93 |
90 void OrthancFrameLayerSource::LoadFrame(const std::string& instanceId, | 94 void OrthancFrameLayerSource::LoadFrame(const std::string& instanceId, |
91 unsigned int frame) | 95 unsigned int frame) |
92 { | 96 { |
93 loader_.ScheduleLoadFrame(instanceId, frame); | 97 loader_->ScheduleLoadFrame(loader_, instanceId, frame); |
94 } | 98 } |
95 | 99 |
96 | 100 |
97 bool OrthancFrameLayerSource::GetExtent(std::vector<Vector>& points, | 101 bool OrthancFrameLayerSource::GetExtent(std::vector<Vector>& points, |
98 const CoordinateSystem3D& viewportSlice) | 102 const CoordinateSystem3D& viewportSlice) |
99 { | 103 { |
100 size_t index; | 104 size_t index; |
101 if (loader_.IsGeometryReady() && | 105 if (loader_->IsGeometryReady() && |
102 loader_.LookupSlice(index, viewportSlice)) | 106 loader_->LookupSlice(index, viewportSlice)) |
103 { | 107 { |
104 loader_.GetSlice(index).GetExtent(points); | 108 loader_->GetSlice(index).GetExtent(points); |
105 return true; | 109 return true; |
106 } | 110 } |
107 else | 111 else |
108 { | 112 { |
109 return false; | 113 return false; |
113 | 117 |
114 void OrthancFrameLayerSource::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice) | 118 void OrthancFrameLayerSource::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice) |
115 { | 119 { |
116 size_t index; | 120 size_t index; |
117 | 121 |
118 if (loader_.IsGeometryReady()) | 122 if (loader_->IsGeometryReady()) |
119 { | 123 { |
120 if (loader_.LookupSlice(index, viewportSlice)) | 124 if (loader_->LookupSlice(index, viewportSlice)) |
121 { | 125 { |
122 loader_.ScheduleLoadSliceImage(index, quality_); | 126 loader_->ScheduleLoadSliceImage(loader_, index, quality_); |
123 } | 127 } |
124 else | 128 else |
125 { | 129 { |
126 Slice slice; | 130 Slice slice; |
127 LayerSourceBase::NotifyLayerReady(NULL, slice.GetGeometry(), true); | 131 LayerSourceBase::NotifyLayerReady(NULL, slice.GetGeometry(), true); |