Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographySceneReader.h @ 1290:7def6ab2929f bugs/2020-02-invisible-slice
Removal of debugging logs
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 21 Feb 2020 15:20:29 +0100 |
parents | 1c7ae79c426d |
children | 68579a31eeb4 8a0a62189f46 |
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 | |
1280
1c7ae79c426d
fix copyright years
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1259
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
430 | 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 { | |
1259
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
36 // a layer containing only the geometry of a DICOM layer (bit hacky !) |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
37 class RadiographyPlaceholderLayer : public RadiographyDicomLayer |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
38 { |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
39 public: |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
40 RadiographyPlaceholderLayer(MessageBroker& broker, const RadiographyScene& scene) : |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
41 RadiographyDicomLayer(broker, scene) |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
42 { |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
43 } |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
44 |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
45 }; |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
46 |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
47 |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
48 // 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
|
49 // 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
|
50 // It needs some architecturing... |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
51 class RadiographySceneBuilder : public boost::noncopyable |
430 | 52 { |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
53 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
54 RadiographyScene& scene_; |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
55 std::auto_ptr<Orthanc::ImageAccessor> dicomImage_; |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
56 std::auto_ptr<Deprecated::DicomFrameConverter> dicomFrameConverter_; |
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
57 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode_; |
430 | 58 |
59 public: | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
60 RadiographySceneBuilder(RadiographyScene& scene) : |
1190 | 61 scene_(scene) |
430 | 62 { |
63 } | |
64 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
65 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
|
66 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
|
67 Orthanc::ImageAccessor* dicomImage, // takes ownership |
714
d2c0e347ddc2
deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
553
diff
changeset
|
68 Deprecated::DicomFrameConverter* dicomFrameConverter, // takes ownership |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
69 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
70 ); |
430 | 71 |
1022 | 72 static void ReadLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); |
73 static void ReadDicomLayerGeometry(RadiographyLayer::Geometry& geometry, const Json::Value& input); | |
74 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
75 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
76 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); |
1022 | 77 |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
78 }; |
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 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
81 class RadiographySceneReader : public RadiographySceneBuilder |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
82 { |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
83 Deprecated::OrthancApiClient& orthancApiClient_; |
553
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 public: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
86 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
|
87 RadiographySceneBuilder(scene), |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
88 orthancApiClient_(orthancApiClient) |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
89 { |
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 |
1259
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
92 protected: |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
93 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
94 }; |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
95 |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
96 // reads the whole scene but the DICOM image such that we have the full geometry |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
97 class RadiographySceneGeometryReader : public RadiographySceneBuilder |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
98 { |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
99 unsigned int dicomImageWidth_; |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
100 unsigned int dicomImageHeight_; |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
101 |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
102 public: |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
103 RadiographySceneGeometryReader(RadiographyScene& scene, unsigned int dicomImageWidth, unsigned int dicomImageHeight) : |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
104 RadiographySceneBuilder(scene), |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
105 dicomImageWidth_(dicomImageWidth), |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
106 dicomImageHeight_(dicomImageHeight) |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
107 { |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
108 } |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
109 |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
110 protected: |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
481
diff
changeset
|
111 virtual RadiographyDicomLayer* LoadDicom(const std::string& instanceId, unsigned int frame, RadiographyLayer::Geometry* geometry); |
430 | 112 }; |
113 } |