Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographySceneReader.h @ 585:b9ce24c606ae
TextSceneLayer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 19 Apr 2019 17:57:58 +0200 |
parents | 92305ee35b1c |
children | d2c0e347ddc2 |
rev | line source |
---|---|
430 | 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-2018 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" | |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
430
diff
changeset
|
27 #include "RadiographyMaskLayer.h" |
430 | 28 #include "RadiographyTextLayer.h" |
29 #include <json/value.h> | |
30 #include <Core/Images/FontRegistry.h> | |
31 | |
32 namespace OrthancStone | |
33 { | |
34 class OrthancApiClient; | |
35 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
36 // HACK: I had to introduce this builder class in order to be able to recreate a RadiographyScene |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
37 // from a serialized scene that is passed to web-workers. |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
38 // It needs some architecturing... |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
39 class RadiographySceneBuilder : public boost::noncopyable |
430 | 40 { |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
41 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
42 RadiographyScene& scene_; |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
43 const Orthanc::FontRegistry* fontRegistry_; |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
44 std::auto_ptr<Orthanc::ImageAccessor> dicomImage_; |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
45 std::auto_ptr<DicomFrameConverter> dicomFrameConverter_; |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
46 PhotometricDisplayMode preferredPhotometricDisplayMode_; |
430 | 47 |
48 public: | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
49 RadiographySceneBuilder(RadiographyScene& scene) : |
430 | 50 scene_(scene), |
51 fontRegistry_(NULL) | |
52 { | |
53 } | |
54 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
55 void Read(const Json::Value& input); |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
56 void Read(const Json::Value& input, |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
57 Orthanc::ImageAccessor* dicomImage, // takes ownership |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
58 DicomFrameConverter* dicomFrameConverter, // takes ownership |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
59 PhotometricDisplayMode preferredPhotometricDisplayMode |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
60 ); |
430 | 61 |
62 void SetFontRegistry(const Orthanc::FontRegistry& fontRegistry) | |
63 { | |
64 fontRegistry_ = &fontRegistry; | |
65 } | |
66 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
67 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
68 void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
69 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
70 }; |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
71 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
72 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
73 class RadiographySceneReader : public RadiographySceneBuilder |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
74 { |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
75 OrthancApiClient& orthancApiClient_; |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
76 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
77 public: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
78 RadiographySceneReader(RadiographyScene& scene, OrthancApiClient& orthancApiClient) : |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
79 RadiographySceneBuilder(scene), |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
80 orthancApiClient_(orthancApiClient) |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
81 { |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
82 } |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
83 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
84 void Read(const Json::Value& input); |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
85 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
86 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
87 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); |
430 | 88 }; |
89 } |