Mercurial > hg > orthanc-stone
comparison Framework/Deprecated/Radiography/RadiographySceneReader.h @ 1398:c5403d52078c
moved Radiography into Deprecated
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 20:43:09 +0200 |
parents | Framework/Radiography/RadiographySceneReader.h@257f2c9a02ac |
children | 30deba7bc8e2 |
comparison
equal
deleted
inserted
replaced
1397:1c2d065ba372 | 1398:c5403d52078c |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "RadiographyScene.h" | |
25 #include "RadiographyAlphaLayer.h" | |
26 #include "RadiographyDicomLayer.h" | |
27 #include "RadiographyMaskLayer.h" | |
28 #include "RadiographyTextLayer.h" | |
29 #include "../Deprecated/Toolbox/OrthancApiClient.h" | |
30 | |
31 #include <json/value.h> | |
32 #include <Core/Images/FontRegistry.h> | |
33 | |
34 namespace OrthancStone | |
35 { | |
36 // a layer containing only the geometry of a DICOM layer (bit hacky !) | |
37 class RadiographyPlaceholderLayer : public RadiographyDicomLayer | |
38 { | |
39 public: | |
40 RadiographyPlaceholderLayer(const RadiographyScene& scene) : | |
41 RadiographyDicomLayer(scene) | |
42 { | |
43 } | |
44 | |
45 }; | |
46 | |
47 | |
48 // HACK: I had to introduce this builder class in order to be able to recreate a RadiographyScene | |
49 // from a serialized scene that is passed to web-workers. | |
50 // It needs some architecturing... | |
51 class RadiographySceneBuilder : public boost::noncopyable | |
52 { | |
53 protected: | |
54 RadiographyScene& scene_; | |
55 std::unique_ptr<Orthanc::ImageAccessor> dicomImage_; | |
56 std::unique_ptr<Deprecated::DicomFrameConverter> dicomFrameConverter_; | |
57 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode_; | |
58 | |
59 public: | |
60 RadiographySceneBuilder(RadiographyScene& scene) : | |
61 scene_(scene) | |
62 { | |
63 } | |
64 | |
65 void Read(const Json::Value& input); | |
66 void Read(const Json::Value& input, | |
67 Orthanc::ImageAccessor* dicomImage, // takes ownership | |
68 Deprecated::DicomFrameConverter* dicomFrameConverter, // takes ownership | |
69 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode | |
70 ); | |
71 | |
72 static void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); | |
73 static void ReadDicomLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); | |
74 | |
75 protected: | |
76 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); | |
77 | |
78 }; | |
79 | |
80 | |
81 class RadiographySceneReader : public RadiographySceneBuilder | |
82 { | |
83 Deprecated::OrthancApiClient& orthancApiClient_; | |
84 | |
85 public: | |
86 RadiographySceneReader(RadiographyScene& scene, Deprecated::OrthancApiClient& orthancApiClient) : | |
87 RadiographySceneBuilder(scene), | |
88 orthancApiClient_(orthancApiClient) | |
89 { | |
90 } | |
91 | |
92 protected: | |
93 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); | |
94 }; | |
95 | |
96 // reads the whole scene but the DICOM image such that we have the full geometry | |
97 class RadiographySceneGeometryReader : public RadiographySceneBuilder | |
98 { | |
99 unsigned int dicomImageWidth_; | |
100 unsigned int dicomImageHeight_; | |
101 | |
102 public: | |
103 RadiographySceneGeometryReader(RadiographyScene& scene, unsigned int dicomImageWidth, unsigned int dicomImageHeight) : | |
104 RadiographySceneBuilder(scene), | |
105 dicomImageWidth_(dicomImageWidth), | |
106 dicomImageHeight_(dicomImageHeight) | |
107 { | |
108 } | |
109 | |
110 protected: | |
111 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); | |
112 }; | |
113 } |