comparison Framework/Radiography/RadiographySceneReader.h @ 553:92305ee35b1c dev

web-worker consequences: give access to lower level data
author Alain Mazy <alain@mazy.be>
date Wed, 03 Apr 2019 17:38:43 +0200
parents 159a465e27bd
children d2c0e347ddc2
comparison
equal deleted inserted replaced
545:e1ba16436d59 553:92305ee35b1c
31 31
32 namespace OrthancStone 32 namespace OrthancStone
33 { 33 {
34 class OrthancApiClient; 34 class OrthancApiClient;
35 35
36 class RadiographySceneReader : public boost::noncopyable 36 // HACK: I had to introduce this builder class in order to be able to recreate a RadiographyScene
37 // from a serialized scene that is passed to web-workers.
38 // It needs some architecturing...
39 class RadiographySceneBuilder : public boost::noncopyable
37 { 40 {
38 RadiographyScene& scene_; 41 protected:
39 OrthancApiClient& orthancApiClient_; 42 RadiographyScene& scene_;
40 const Orthanc::FontRegistry* fontRegistry_; 43 const Orthanc::FontRegistry* fontRegistry_;
44 std::auto_ptr<Orthanc::ImageAccessor> dicomImage_;
45 std::auto_ptr<DicomFrameConverter> dicomFrameConverter_;
46 PhotometricDisplayMode preferredPhotometricDisplayMode_;
41 47
42 public: 48 public:
43 RadiographySceneReader(RadiographyScene& scene, OrthancApiClient& orthancApiClient) : 49 RadiographySceneBuilder(RadiographyScene& scene) :
44 scene_(scene), 50 scene_(scene),
45 orthancApiClient_(orthancApiClient),
46 fontRegistry_(NULL) 51 fontRegistry_(NULL)
47 { 52 {
48 } 53 }
49 54
50 void Read(const Json::Value& output); 55 void Read(const Json::Value& input);
56 void Read(const Json::Value& input,
57 Orthanc::ImageAccessor* dicomImage, // takes ownership
58 DicomFrameConverter* dicomFrameConverter, // takes ownership
59 PhotometricDisplayMode preferredPhotometricDisplayMode
60 );
51 61
52 void SetFontRegistry(const Orthanc::FontRegistry& fontRegistry) 62 void SetFontRegistry(const Orthanc::FontRegistry& fontRegistry)
53 { 63 {
54 fontRegistry_ = &fontRegistry; 64 fontRegistry_ = &fontRegistry;
55 } 65 }
56 66
57 private: 67 protected:
58 void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& output); 68 void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input);
69 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry);
70 };
71
72
73 class RadiographySceneReader : public RadiographySceneBuilder
74 {
75 OrthancApiClient& orthancApiClient_;
76
77 public:
78 RadiographySceneReader(RadiographyScene& scene, OrthancApiClient& orthancApiClient) :
79 RadiographySceneBuilder(scene),
80 orthancApiClient_(orthancApiClient)
81 {
82 }
83
84 void Read(const Json::Value& input);
85
86 protected:
87 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry);
59 }; 88 };
60 } 89 }