Mercurial > hg > orthanc-stone
comparison Framework/Layers/FrameRenderer.cpp @ 77:f5f54ed8d307 wasm
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 May 2017 21:13:29 +0200 |
parents | 298f375dcb68 |
children | bd48431ac285 |
comparison
equal
deleted
inserted
replaced
76:0aef120d7e1c | 77:f5f54ed8d307 |
---|---|
74 return true; | 74 return true; |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 FrameRenderer::FrameRenderer(const SliceGeometry& viewportSlice, | 79 FrameRenderer::FrameRenderer(const SliceGeometry& frameSlice, |
80 const SliceGeometry& frameSlice, | |
81 double pixelSpacingX, | 80 double pixelSpacingX, |
82 double pixelSpacingY, | 81 double pixelSpacingY, |
83 bool isFullQuality) : | 82 bool isFullQuality) : |
84 viewportSlice_(viewportSlice), | |
85 frameSlice_(frameSlice), | 83 frameSlice_(frameSlice), |
86 pixelSpacingX_(pixelSpacingX), | 84 pixelSpacingX_(pixelSpacingX), |
87 pixelSpacingY_(pixelSpacingY), | 85 pixelSpacingY_(pixelSpacingY), |
88 isFullQuality_(isFullQuality) | 86 isFullQuality_(isFullQuality) |
89 { | 87 { |
136 } | 134 } |
137 } | 135 } |
138 | 136 |
139 | 137 |
140 bool FrameRenderer::RenderLayer(CairoContext& context, | 138 bool FrameRenderer::RenderLayer(CairoContext& context, |
141 const ViewportGeometry& view) | 139 const ViewportGeometry& view, |
140 const SliceGeometry& viewportSlice) | |
142 { | 141 { |
143 if (!style_.visible_) | 142 if (!style_.visible_) |
144 { | 143 { |
145 return true; | 144 return true; |
146 } | 145 } |
147 | 146 |
148 if (display_.get() == NULL) | 147 if (display_.get() == NULL) |
149 { | 148 { |
150 if (!ComputePixelTransform(transform_, viewportSlice_, frameSlice_, | 149 if (!ComputePixelTransform(transform_, viewportSlice, frameSlice_, |
151 pixelSpacingX_, pixelSpacingY_)) | 150 pixelSpacingX_, pixelSpacingY_)) |
152 { | 151 { |
153 return true; | 152 return true; |
154 } | 153 } |
155 | 154 |
214 display_.reset(NULL); | 213 display_.reset(NULL); |
215 } | 214 } |
216 | 215 |
217 | 216 |
218 ILayerRenderer* FrameRenderer::CreateRenderer(Orthanc::ImageAccessor* frame, | 217 ILayerRenderer* FrameRenderer::CreateRenderer(Orthanc::ImageAccessor* frame, |
219 const SliceGeometry& viewportSlice, | |
220 const SliceGeometry& frameSlice, | 218 const SliceGeometry& frameSlice, |
221 const OrthancPlugins::IDicomDataset& dicom, | 219 const OrthancPlugins::IDicomDataset& dicom, |
222 double pixelSpacingX, | 220 double pixelSpacingX, |
223 double pixelSpacingY, | 221 double pixelSpacingY, |
224 bool isFullQuality) | 222 bool isFullQuality) |
225 { | 223 { |
226 std::auto_ptr<Orthanc::ImageAccessor> protect(frame); | 224 std::auto_ptr<Orthanc::ImageAccessor> protect(frame); |
227 | 225 |
228 if (frame->GetFormat() == Orthanc::PixelFormat_RGB24) | 226 if (frame->GetFormat() == Orthanc::PixelFormat_RGB24) |
229 { | 227 { |
230 return new ColorFrameRenderer(protect.release(), viewportSlice, frameSlice, | 228 return new ColorFrameRenderer(protect.release(), frameSlice, |
231 pixelSpacingX, pixelSpacingY, isFullQuality); | 229 pixelSpacingX, pixelSpacingY, isFullQuality); |
232 } | 230 } |
233 else | 231 else |
234 { | 232 { |
235 DicomFrameConverter converter; | 233 DicomFrameConverter converter; |
236 converter.ReadParameters(dicom); | 234 converter.ReadParameters(dicom); |
237 return new GrayscaleFrameRenderer(protect.release(), converter, viewportSlice, frameSlice, | 235 return new GrayscaleFrameRenderer(protect.release(), converter, frameSlice, |
238 pixelSpacingX, pixelSpacingY, isFullQuality); | 236 pixelSpacingX, pixelSpacingY, isFullQuality); |
239 } | 237 } |
240 } | 238 } |
239 | |
240 | |
241 ILayerRenderer* FrameRenderer::CreateRenderer(Orthanc::ImageAccessor* frame, | |
242 const Slice& slice, | |
243 bool isFullQuality) | |
244 { | |
245 std::auto_ptr<Orthanc::ImageAccessor> protect(frame); | |
246 | |
247 if (frame->GetFormat() == Orthanc::PixelFormat_RGB24) | |
248 { | |
249 return new ColorFrameRenderer(protect.release(), slice.GetGeometry(), | |
250 slice.GetPixelSpacingX(), slice.GetPixelSpacingY(), isFullQuality); | |
251 } | |
252 else | |
253 { | |
254 return new GrayscaleFrameRenderer(protect.release(), slice.GetConverter(), slice.GetGeometry(), | |
255 slice.GetPixelSpacingX(), slice.GetPixelSpacingY(), isFullQuality); | |
256 } | |
257 } | |
241 } | 258 } |