Mercurial > hg > orthanc-stone
diff 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 |
line wrap: on
line diff
--- a/Framework/Radiography/RadiographySceneReader.h Fri Mar 29 15:21:33 2019 +0100 +++ b/Framework/Radiography/RadiographySceneReader.h Wed Apr 03 17:38:43 2019 +0200 @@ -33,28 +33,57 @@ { class OrthancApiClient; - class RadiographySceneReader : public boost::noncopyable + // HACK: I had to introduce this builder class in order to be able to recreate a RadiographyScene + // from a serialized scene that is passed to web-workers. + // It needs some architecturing... + class RadiographySceneBuilder : public boost::noncopyable { - RadiographyScene& scene_; - OrthancApiClient& orthancApiClient_; - const Orthanc::FontRegistry* fontRegistry_; + protected: + RadiographyScene& scene_; + const Orthanc::FontRegistry* fontRegistry_; + std::auto_ptr<Orthanc::ImageAccessor> dicomImage_; + std::auto_ptr<DicomFrameConverter> dicomFrameConverter_; + PhotometricDisplayMode preferredPhotometricDisplayMode_; public: - RadiographySceneReader(RadiographyScene& scene, OrthancApiClient& orthancApiClient) : + RadiographySceneBuilder(RadiographyScene& scene) : scene_(scene), - orthancApiClient_(orthancApiClient), fontRegistry_(NULL) { } - void Read(const Json::Value& output); + void Read(const Json::Value& input); + void Read(const Json::Value& input, + Orthanc::ImageAccessor* dicomImage, // takes ownership + DicomFrameConverter* dicomFrameConverter, // takes ownership + PhotometricDisplayMode preferredPhotometricDisplayMode + ); void SetFontRegistry(const Orthanc::FontRegistry& fontRegistry) { fontRegistry_ = &fontRegistry; } - private: - void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& output); + protected: + void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); + virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); + }; + + + class RadiographySceneReader : public RadiographySceneBuilder + { + OrthancApiClient& orthancApiClient_; + + public: + RadiographySceneReader(RadiographyScene& scene, OrthancApiClient& orthancApiClient) : + RadiographySceneBuilder(scene), + orthancApiClient_(orthancApiClient) + { + } + + void Read(const Json::Value& input); + + protected: + virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); }; }