annotate Framework/Radiography/RadiographySceneReader.h @ 670:5dd496343fad

Restored missing code + fixed key ordering when generating code
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 15 May 2019 18:29:42 +0200
parents 92305ee35b1c
children d2c0e347ddc2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
1 /**
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
6 *
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
11 *
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
16 *
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
19 **/
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
20
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
21
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
22 #pragma once
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
23
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
24 #include "RadiographyScene.h"
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
25 #include "RadiographyAlphaLayer.h"
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
28 #include "RadiographyTextLayer.h"
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
29 #include <json/value.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
30 #include <Core/Images/FontRegistry.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
31
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
32 namespace OrthancStone
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
33 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
34 class OrthancApiClient;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
47
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
50 scene_(scene),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
51 fontRegistry_(NULL)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
52 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
53 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
61
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
62 void SetFontRegistry(const Orthanc::FontRegistry& fontRegistry)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
63 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
64 fontRegistry_ = &fontRegistry;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
65 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
88 };
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
89 }