annotate Framework/Radiography/RadiographySceneReader.h @ 1145:4f99c7905f8d broker

mingw qt
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 Nov 2019 18:28:46 +0100
parents d7887f88710f
children bdc6837d5917
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"
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
31 #include <json/value.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
32 #include <Core/Images/FontRegistry.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
33
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
34 namespace OrthancStone
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_;
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
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
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
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
1022
1e80a925323a ReadDicomLayerGeometry
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
67 static void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input);
1e80a925323a ReadDicomLayerGeometry
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
68 static void ReadDicomLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input);
1e80a925323a ReadDicomLayerGeometry
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
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
1e80a925323a ReadDicomLayerGeometry
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
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 {
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1022
diff changeset
78 private:
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1022
diff changeset
79 boost::shared_ptr<Deprecated::OrthancApiClient> orthancApiClient_;
553
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 481
diff changeset
80
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 481
diff changeset
81 public:
1070
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1022
diff changeset
82 RadiographySceneReader(RadiographyScene& scene,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1022
diff changeset
83 boost::shared_ptr<Deprecated::OrthancApiClient> orthancApiClient) :
553
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 481
diff changeset
84 RadiographySceneBuilder(scene),
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 481
diff changeset
85 orthancApiClient_(orthancApiClient)
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 }
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 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
90
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 481
diff changeset
91 protected:
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 481
diff changeset
92 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
93 };
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
94 }