comparison Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1964:2034ae383cfd deep-learning

integration default->deep-learning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Oct 2022 07:47:55 +0200
parents 0661115af939 79fdc3b1f031
children 963f28eb40cb
comparison
equal deleted inserted replaced
1953:0661115af939 1964:2034ae383cfd
1583 virtual void SignalStoneAnnotationRemoved(const ViewerViewport& viewport) = 0; 1583 virtual void SignalStoneAnnotationRemoved(const ViewerViewport& viewport) = 0;
1584 }; 1584 };
1585 1585
1586 private: 1586 private:
1587 static const int LAYER_TEXTURE = 0; 1587 static const int LAYER_TEXTURE = 0;
1588 static const int LAYER_DEEP_LEARNING = 1; 1588 static const int LAYER_OVERLAY = 1;
1589 static const int LAYER_OVERLAY = 2; 1589 static const int LAYER_ORIENTATION_MARKERS = 2;
1590 static const int LAYER_REFERENCE_LINES = 3; 1590 static const int LAYER_REFERENCE_LINES = 3;
1591 static const int LAYER_ANNOTATIONS_OSIRIX = 4; 1591 static const int LAYER_ANNOTATIONS_OSIRIX = 4;
1592 static const int LAYER_ANNOTATIONS_STONE = 5; 1592 static const int LAYER_ANNOTATIONS_STONE = 5;
1593 static const int LAYER_DEEP_LEARNING = 6;
1593 1594
1594 1595
1595 class ICommand : public Orthanc::IDynamicObject 1596 class ICommand : public Orthanc::IDynamicObject
1596 { 1597 {
1597 private: 1598 private:
2255 deepLearningLayer->SetFlipY(flipY_); 2256 deepLearningLayer->SetFlipY(flipY_);
2256 } 2257 }
2257 2258
2258 StoneAnnotationsRegistry::GetInstance().Load(*stoneAnnotations_, instance.GetSopInstanceUid(), frameIndex); 2259 StoneAnnotationsRegistry::GetInstance().Load(*stoneAnnotations_, instance.GetSopInstanceUid(), frameIndex);
2259 2260
2261 // Orientation markers, new in Stone Web viewer 2.4
2262 std::unique_ptr<OrthancStone::MacroSceneLayer> orientationMarkers;
2263
2264 if (instance.GetGeometry().IsValid())
2265 {
2266 orientationMarkers.reset(new OrthancStone::MacroSceneLayer);
2267
2268 std::string top, bottom, left, right;
2269 instance.GetGeometry().GetOrientationMarkers(top, bottom, left, right);
2270
2271 std::unique_ptr<OrthancStone::TextSceneLayer> text;
2272
2273 text.reset(new OrthancStone::TextSceneLayer);
2274 text->SetText(top);
2275 text->SetPosition(pixelSpacingX * static_cast<double>(frame.GetWidth()) / 2.0, 0);
2276 text->SetAnchor(OrthancStone::BitmapAnchor_TopCenter);
2277 orientationMarkers->AddLayer(text.release());
2278
2279 text.reset(new OrthancStone::TextSceneLayer);
2280 text->SetText(bottom);
2281 text->SetPosition(pixelSpacingX * static_cast<double>(frame.GetWidth()) / 2.0,
2282 pixelSpacingY * static_cast<double>(frame.GetHeight()));
2283 text->SetAnchor(OrthancStone::BitmapAnchor_BottomCenter);
2284 orientationMarkers->AddLayer(text.release());
2285
2286 text.reset(new OrthancStone::TextSceneLayer);
2287 text->SetText(left);
2288 text->SetPosition(0, pixelSpacingY * static_cast<double>(frame.GetHeight()) / 2.0);
2289 text->SetAnchor(OrthancStone::BitmapAnchor_CenterLeft);
2290 orientationMarkers->AddLayer(text.release());
2291
2292 text.reset(new OrthancStone::TextSceneLayer);
2293 text->SetText(right);
2294 text->SetPosition(pixelSpacingX * static_cast<double>(frame.GetWidth()),
2295 pixelSpacingY * static_cast<double>(frame.GetHeight()) / 2.0);
2296 text->SetAnchor(OrthancStone::BitmapAnchor_CenterRight);
2297 orientationMarkers->AddLayer(text.release());
2298 }
2299
2300
2260 { 2301 {
2261 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); 2302 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock());
2262 2303
2263 OrthancStone::Scene2D& scene = lock->GetController().GetScene(); 2304 OrthancStone::Scene2D& scene = lock->GetController().GetScene();
2264 2305
2278 scene.SetLayer(LAYER_ANNOTATIONS_OSIRIX, annotationsOsiriX.release()); 2319 scene.SetLayer(LAYER_ANNOTATIONS_OSIRIX, annotationsOsiriX.release());
2279 } 2320 }
2280 else 2321 else
2281 { 2322 {
2282 scene.DeleteLayer(LAYER_ANNOTATIONS_OSIRIX); 2323 scene.DeleteLayer(LAYER_ANNOTATIONS_OSIRIX);
2324 }
2325
2326 if (orientationMarkers.get() != NULL)
2327 {
2328 scene.SetLayer(LAYER_ORIENTATION_MARKERS, orientationMarkers.release());
2329 }
2330 else
2331 {
2332 scene.DeleteLayer(LAYER_ORIENTATION_MARKERS);
2283 } 2333 }
2284 2334
2285 if (deepLearningLayer.get() != NULL) 2335 if (deepLearningLayer.get() != NULL)
2286 { 2336 {
2287 scene.SetLayer(LAYER_DEEP_LEARNING, deepLearningLayer.release()); 2337 scene.SetLayer(LAYER_DEEP_LEARNING, deepLearningLayer.release());