Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographySceneReader.h @ 1092:5a35688c4874
Added tag toa2019102301 for changeset 5a18e6a395bc
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 23 Oct 2019 15:34:58 +0200 |
parents | 1e80a925323a |
children | d7887f88710f f417a0ae282b |
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" |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
29 #include "../Deprecated/Toolbox/OrthancApiClient.h" |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
30 |
430 | 31 #include <json/value.h> |
32 #include <Core/Images/FontRegistry.h> | |
33 | |
34 namespace OrthancStone | |
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_; |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
45 std::auto_ptr<Deprecated::DicomFrameConverter> dicomFrameConverter_; |
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
46 RadiographyPhotometricDisplayMode 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 |
714
d2c0e347ddc2
deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
553
diff
changeset
|
58 Deprecated::DicomFrameConverter* dicomFrameConverter, // takes ownership |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
59 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode |
553
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 | |
1022 | 67 static void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); |
68 static void ReadDicomLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); | |
69 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
70 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
71 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); |
1022 | 72 |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
73 }; |
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 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
76 class RadiographySceneReader : public RadiographySceneBuilder |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
77 { |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
78 Deprecated::OrthancApiClient& orthancApiClient_; |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
79 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
80 public: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
81 RadiographySceneReader(RadiographyScene& scene, Deprecated::OrthancApiClient& orthancApiClient) : |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
82 RadiographySceneBuilder(scene), |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
83 orthancApiClient_(orthancApiClient) |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
84 { |
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 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
87 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
|
88 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
89 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
90 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); |
430 | 91 }; |
92 } |