Mercurial > hg > orthanc-stone
annotate Applications/Samples/SingleVolumeApplication.h @ 146:fb7d602e7025 wasm
OrientedBoundingBox::ComputeExtent
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Jan 2018 17:30:34 +0100 |
parents | e2fe9352f240 |
children | f48c5d422d45 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
130
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 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. | |
0 | 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 | |
47 | 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 | |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
102 | 24 #include "SampleApplicationBase.h" |
25 #include "../../Framework/dev.h" | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
26 #include "../../Framework/Layers/ILayerSource.h" |
51 | 27 #include "../../Framework/Layers/LineMeasureTracker.h" |
28 #include "../../Framework/Layers/CircleMeasureTracker.h" | |
116 | 29 |
30 #include <Core/Toolbox.h> | |
31 #include <Core/Logging.h> | |
0 | 32 |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
120
diff
changeset
|
33 #include <Plugins/Samples/Common/OrthancHttpConnection.h> // TODO REMOVE |
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
120
diff
changeset
|
34 #include "../../Framework/Layers/DicomStructureSetRendererFactory.h" // TODO REMOVE |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
121
diff
changeset
|
35 #include "../../Framework/Toolbox/MessagingToolbox.h" // TODO REMOVE |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
120
diff
changeset
|
36 |
0 | 37 namespace OrthancStone |
38 { | |
39 namespace Samples | |
40 { | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
41 class SingleVolumeApplication : public SampleApplicationBase |
0 | 42 { |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
43 private: |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
44 class Interactor : public VolumeImageInteractor |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
45 { |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
46 private: |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
47 LayerWidget& widget_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
48 size_t layer_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
49 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
50 protected: |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
51 virtual void NotifySliceChange(const ISlicedVolume& volume, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
52 const size_t& sliceIndex, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
53 const Slice& slice) |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
54 { |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
55 const OrthancVolumeImage& image = dynamic_cast<const OrthancVolumeImage&>(volume); |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
56 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
57 RenderStyle s = widget_.GetLayerStyle(layer_); |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
58 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
59 if (image.FitWindowingToRange(s, slice.GetConverter())) |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
60 { |
120
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
61 //printf("Windowing: %f => %f\n", s.customWindowCenter_, s.customWindowWidth_); |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
62 widget_.SetLayerStyle(layer_, s); |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
63 } |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
64 } |
120
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
65 |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
66 virtual void MouseOver(CairoContext& context, |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
67 WorldSceneWidget& widget, |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
68 const ViewportGeometry& view, |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
69 double x, |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
70 double y, |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
71 IStatusBar* statusBar) |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
72 { |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
73 const LayerWidget& w = dynamic_cast<const LayerWidget&>(widget); |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
74 Vector p = w.GetSlice().MapSliceToWorldCoordinates(x, y); |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
75 printf("%f %f %f\n", p[0], p[1], p[2]); |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
76 } |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
77 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
78 public: |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
79 Interactor(OrthancVolumeImage& volume, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
80 LayerWidget& widget, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
81 VolumeProjection projection, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
82 size_t layer) : |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
83 VolumeImageInteractor(volume, widget, projection), |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
84 widget_(widget), |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
85 layer_(layer) |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
86 { |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
87 } |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
88 }; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
89 |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
120
diff
changeset
|
90 |
0 | 91 public: |
92 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) | |
93 { | |
94 boost::program_options::options_description generic("Sample options"); | |
95 generic.add_options() | |
96 ("series", boost::program_options::value<std::string>(), | |
97 "Orthanc ID of the series") | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
98 ("instance", boost::program_options::value<std::string>(), |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
99 "Orthanc ID of a multi-frame instance that describes a 3D volume") |
0 | 100 ("threads", boost::program_options::value<unsigned int>()->default_value(3), |
101 "Number of download threads") | |
102 ("projection", boost::program_options::value<std::string>()->default_value("axial"), | |
103 "Projection of interest (can be axial, sagittal or coronal)") | |
104 ("reverse", boost::program_options::value<bool>()->default_value(false), | |
105 "Reverse the normal direction of the volume") | |
106 ; | |
107 | |
108 options.add(generic); | |
109 } | |
110 | |
111 virtual void Initialize(BasicApplicationContext& context, | |
112 IStatusBar& statusBar, | |
113 const boost::program_options::variables_map& parameters) | |
114 { | |
115 using namespace OrthancStone; | |
116 | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
117 if (parameters.count("series") > 1 || |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
118 parameters.count("instance") > 1) |
0 | 119 { |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
120 LOG(ERROR) << "Only one series or instance is allowed"; |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
121 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
122 } |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
123 |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
124 if (parameters.count("series") == 1 && |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
125 parameters.count("instance") == 1) |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
126 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
127 LOG(ERROR) << "Cannot specify both a series and an instance"; |
0 | 128 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
129 } | |
130 | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
131 std::string series; |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
132 if (parameters.count("series") == 1) |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
133 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
134 series = parameters["series"].as<std::string>(); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
135 } |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
136 |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
137 std::string instance; |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
138 if (parameters.count("instance") == 1) |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
139 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
140 instance = parameters["instance"].as<std::string>(); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
141 } |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
142 |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
143 if (series.empty() && |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
144 instance.empty()) |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
145 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
146 LOG(ERROR) << "The series ID or instance ID is missing"; |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
147 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
148 } |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
149 |
0 | 150 unsigned int threads = parameters["threads"].as<unsigned int>(); |
151 bool reverse = parameters["reverse"].as<bool>(); | |
152 | |
153 std::string tmp = parameters["projection"].as<std::string>(); | |
154 Orthanc::Toolbox::ToLowerCase(tmp); | |
104
eccd64f8e297
VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
103
diff
changeset
|
155 |
eccd64f8e297
VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
103
diff
changeset
|
156 VolumeProjection projection; |
0 | 157 if (tmp == "axial") |
158 { | |
104
eccd64f8e297
VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
103
diff
changeset
|
159 projection = VolumeProjection_Axial; |
0 | 160 } |
161 else if (tmp == "sagittal") | |
162 { | |
104
eccd64f8e297
VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
103
diff
changeset
|
163 projection = VolumeProjection_Sagittal; |
0 | 164 } |
165 else if (tmp == "coronal") | |
166 { | |
104
eccd64f8e297
VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
103
diff
changeset
|
167 projection = VolumeProjection_Coronal; |
0 | 168 } |
169 else | |
170 { | |
171 LOG(ERROR) << "Unknown projection: " << tmp; | |
172 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
173 } | |
174 | |
102 | 175 std::auto_ptr<LayerWidget> widget(new LayerWidget); |
176 | |
122
e3433dabfb8d
refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
121
diff
changeset
|
177 #if 0 |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
178 std::auto_ptr<OrthancVolumeImage> volume(new OrthancVolumeImage(context.GetWebService(), true)); |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
179 if (series.empty()) |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
180 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
181 volume->ScheduleLoadInstance(instance); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
182 } |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
183 else |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
184 { |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
185 volume->ScheduleLoadSeries(series); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
116
diff
changeset
|
186 } |
0 | 187 |
105 | 188 widget->AddLayer(new VolumeImageSource(*volume)); |
102 | 189 |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
190 context.AddInteractor(new Interactor(*volume, *widget, projection, 0)); |
130 | 191 context.AddSlicedVolume(volume.release()); |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
192 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
193 { |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
194 RenderStyle s; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
195 s.alpha_ = 1; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
196 s.applyLut_ = true; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
197 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
198 s.interpolation_ = ImageInterpolation_Linear; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
199 widget->SetLayerStyle(0, s); |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
200 } |
102 | 201 #else |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
202 std::auto_ptr<OrthancVolumeImage> ct(new OrthancVolumeImage(context.GetWebService(), false)); |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
203 //ct->ScheduleLoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d"); |
120
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
204 ct->ScheduleLoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // IBA |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
205 //ct->ScheduleLoadSeries("03677739-1d8bca40-db1daf59-d74ff548-7f6fc9c0"); // 0522c0001 TCIA |
126
c9e88e7935a4
rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
206 |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
207 std::auto_ptr<OrthancVolumeImage> pet(new OrthancVolumeImage(context.GetWebService(), true)); |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
208 //pet->ScheduleLoadSeries("aabad2e7-80702b5d-e599d26c-4f13398e-38d58a9e"); |
120
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
209 pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // IBA 1 |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
210 //pet->ScheduleLoadInstance("337876a1-a68a9718-f15abccd-38faafa1-b99b496a"); // IBA 2 |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
211 //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // IBA 3 |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
212 //pet->ScheduleLoadInstance("269f26f4-0c83eeeb-2e67abbd-5467a40f-f1bec90c"); // 0522c0001 TCIA |
0 | 213 |
130 | 214 std::auto_ptr<StructureSetLoader> rtStruct(new StructureSetLoader(context.GetWebService())); |
128 | 215 rtStruct->ScheduleLoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // IBA |
216 //rtStruct->ScheduleLoadInstance("17cd032b-ad92a438-ca05f06a-f9e96668-7e3e9e20"); // 0522c0001 TCIA | |
123
ed0003f6102c
dynamic loading of rt-struct renderers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
122
diff
changeset
|
217 |
105 | 218 widget->AddLayer(new VolumeImageSource(*ct)); |
219 widget->AddLayer(new VolumeImageSource(*pet)); | |
130 | 220 widget->AddLayer(new DicomStructureSetRendererFactory(*rtStruct)); |
105 | 221 |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
120
diff
changeset
|
222 context.AddInteractor(new Interactor(*pet, *widget, projection, 1)); |
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
120
diff
changeset
|
223 //context.AddInteractor(new VolumeImageInteractor(*ct, *widget, projection)); |
126
c9e88e7935a4
rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
123
diff
changeset
|
224 |
130 | 225 context.AddSlicedVolume(ct.release()); |
226 context.AddSlicedVolume(pet.release()); | |
227 context.AddVolumeLoader(rtStruct.release()); | |
0 | 228 |
102 | 229 { |
230 RenderStyle s; | |
231 //s.drawGrid_ = true; | |
232 s.alpha_ = 1; | |
104
eccd64f8e297
VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
103
diff
changeset
|
233 s.windowing_ = ImageWindowing_Bone; |
102 | 234 widget->SetLayerStyle(0, s); |
235 } | |
236 | |
237 { | |
238 RenderStyle s; | |
239 //s.drawGrid_ = true; | |
240 s.SetColor(255, 0, 0); // Draw missing PET layer in red | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
241 s.alpha_ = 0.5; |
102 | 242 s.applyLut_ = true; |
243 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET; | |
244 s.interpolation_ = ImageInterpolation_Linear; | |
120
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
245 s.windowing_ = ImageWindowing_Custom; |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
246 s.customWindowCenter_ = 0; |
063f7f3d9f14
fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
247 s.customWindowWidth_ = 128; |
102 | 248 widget->SetLayerStyle(1, s); |
249 } | |
250 #endif | |
251 | |
0 | 252 |
253 statusBar.SetMessage("Use the keys \"b\", \"l\" and \"d\" to change Hounsfield windowing"); | |
254 statusBar.SetMessage("Use the keys \"t\" to track the (X,Y,Z) mouse coordinates"); | |
255 statusBar.SetMessage("Use the keys \"m\" to measure distances"); | |
256 statusBar.SetMessage("Use the keys \"c\" to draw circles"); | |
102 | 257 |
258 widget->SetTransmitMouseOver(true); | |
259 context.SetCentralWidget(widget.release()); | |
0 | 260 } |
261 }; | |
262 } | |
263 } |