annotate Applications/Samples/SingleVolumeApplication.h @ 567:375dc0aeb19b

Merged am-dev into default
author Alain Mazy <am@osimis.io>
date Thu, 18 Apr 2019 09:05:43 +0000
parents b70e9be013e4
children 2d8ab34c8c91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * the License, or (at your option) any later version.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
15 * Affero General Public License for more details.
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
16 *
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
24 #include "SampleApplicationBase.h"
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
25 #include "../../Framework/dev.h"
51
b340879da9bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
26 #include "../../Framework/Layers/LineMeasureTracker.h"
b340879da9bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
27 #include "../../Framework/Layers/CircleMeasureTracker.h"
116
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 105
diff changeset
28
212
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
29 #include <Core/Toolbox.h>
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
30 #include <Core/Logging.h>
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
212
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
32 #include <Plugins/Samples/Common/OrthancHttpConnection.h> // TODO REMOVE
398
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 397
diff changeset
33 #include "../../Framework/Layers/DicomStructureSetSlicer.h" // TODO REMOVE
122
e3433dabfb8d refactoring DicomStructureSet
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 121
diff changeset
34 #include "../../Framework/Toolbox/MessagingToolbox.h" // TODO REMOVE
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 namespace OrthancStone
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 namespace Samples
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 class SingleVolumeApplication : public SampleApplicationBase
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 private:
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
43 class Interactor : public VolumeImageInteractor
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 private:
389
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 369
diff changeset
46 SliceViewerWidget& widget_;
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
47 size_t layer_;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
48
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
49 protected:
399
885e1ebd315c rename SliceChange as SliceContentChange
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 398
diff changeset
50 virtual void NotifySliceContentChange(const ISlicedVolume& volume,
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
51 const size_t& sliceIndex,
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
52 const Slice& slice)
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
54 const OrthancVolumeImage& image = dynamic_cast<const OrthancVolumeImage&>(volume);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
56 RenderStyle s = widget_.GetLayerStyle(layer_);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
58 if (image.FitWindowingToRange(s, slice.GetConverter()))
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
120
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
60 //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
61 widget_.SetLayerStyle(layer_, s);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 virtual void MouseOver(CairoContext& context,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 WorldSceneWidget& widget,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 const ViewportGeometry& view,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 double x,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 double y,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 IStatusBar* statusBar)
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
389
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 369
diff changeset
72 const SliceViewerWidget& w = dynamic_cast<const SliceViewerWidget&>(widget);
120
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
73 Vector p = w.GetSlice().MapSliceToWorldCoordinates(x, y);
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
74 printf("%f %f %f\n", p[0], p[1], p[2]);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 }
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
76
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
77 public:
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
78 Interactor(OrthancVolumeImage& volume,
389
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 369
diff changeset
79 SliceViewerWidget& widget,
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
80 VolumeProjection projection,
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
81 size_t layer) :
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
82 VolumeImageInteractor(volume, widget, projection),
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
83 widget_(widget),
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
84 layer_(layer)
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 public:
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
91 virtual void DeclareStartupOptions(boost::program_options::options_description& options)
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 boost::program_options::options_description generic("Sample options");
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 generic.add_options()
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 ("series", boost::program_options::value<std::string>(),
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 "Orthanc ID of the series")
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
97 ("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
98 "Orthanc ID of a multi-frame instance that describes a 3D volume")
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 ("threads", boost::program_options::value<unsigned int>()->default_value(3),
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 "Number of download threads")
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 ("projection", boost::program_options::value<std::string>()->default_value("axial"),
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 "Projection of interest (can be axial, sagittal or coronal)")
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 ("reverse", boost::program_options::value<bool>()->default_value(false),
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 "Reverse the normal direction of the volume")
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 ;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 options.add(generic);
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
110 virtual void Initialize(IStatusBar& statusBar,
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 const boost::program_options::variables_map& parameters)
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 using namespace OrthancStone;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
115 if (parameters.count("series") > 1 ||
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
116 parameters.count("instance") > 1)
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
118 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
119 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
120 }
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
121
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
122 if (parameters.count("series") == 1 &&
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
123 parameters.count("instance") == 1)
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
124 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
125 LOG(ERROR) << "Cannot specify both a series and an instance";
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
129 std::string series;
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
130 if (parameters.count("series") == 1)
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
131 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
132 series = parameters["series"].as<std::string>();
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
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
135 std::string instance;
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
136 if (parameters.count("instance") == 1)
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
137 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
138 instance = parameters["instance"].as<std::string>();
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
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
141 if (series.empty() &&
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
142 instance.empty())
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
143 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
144 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
145 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
146 }
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
147
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
148 //unsigned int threads = parameters["threads"].as<unsigned int>();
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
149 //bool reverse = parameters["reverse"].as<bool>();
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 std::string tmp = parameters["projection"].as<std::string>();
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 Orthanc::Toolbox::ToLowerCase(tmp);
104
eccd64f8e297 VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
153
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 VolumeProjection projection;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 if (tmp == "axial")
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 projection = VolumeProjection_Axial;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 else if (tmp == "sagittal")
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 projection = VolumeProjection_Sagittal;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 else if (tmp == "coronal")
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 projection = VolumeProjection_Coronal;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 else
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 LOG(ERROR) << "Unknown projection: " << tmp;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172
389
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 369
diff changeset
173 std::auto_ptr<SliceViewerWidget> widget(new SliceViewerWidget);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
316
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
175 #if 1
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
176 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
177 if (series.empty())
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
178 {
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
179 volume->ScheduleLoadInstance(instance);
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 else
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 volume->ScheduleLoadSeries(series);
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
184 }
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185
398
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 397
diff changeset
186 widget->AddLayer(new VolumeImageMPRSlicer(*volume));
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
187
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
188 context_->AddInteractor(new Interactor(*volume, *widget, projection, 0));
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
189 context_->AddSlicedVolume(volume.release());
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
316
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
191 if (1)
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
192 {
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
193 RenderStyle s;
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
194 //s.drawGrid_ = true;
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
195 s.alpha_ = 1;
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
196 s.windowing_ = ImageWindowing_Bone;
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
197 widget->SetLayerStyle(0, s);
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
198 }
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
199 else
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
200 {
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
201 RenderStyle s;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
202 s.alpha_ = 1;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
203 s.applyLut_ = true;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
204 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET;
147
f48c5d422d45 removed meaningless ImageInterpolation_Linear value
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
205 s.interpolation_ = ImageInterpolation_Bilinear;
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
206 widget->SetLayerStyle(0, s);
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
207 }
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
208 #else
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
209 std::auto_ptr<OrthancVolumeImage> ct(new OrthancVolumeImage(context_->GetWebService(), false));
173
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
210 //ct->ScheduleLoadSeries("15a6f44a-ac7b88fe-19c462d9-dddd918e-b01550d8"); // 0178023P
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
211 //ct->ScheduleLoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d");
173
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
212 //ct->ScheduleLoadSeries("a04ecf01-79b2fc33-58239f7e-ad9db983-28e81afa"); // IBA
120
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
213 //ct->ScheduleLoadSeries("03677739-1d8bca40-db1daf59-d74ff548-7f6fc9c0"); // 0522c0001 TCIA
173
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
214 ct->ScheduleLoadSeries("295e8a13-dfed1320-ba6aebb2-9a13e20f-1b3eb953"); // Captain
126
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 123
diff changeset
215
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
216 std::auto_ptr<OrthancVolumeImage> pet(new OrthancVolumeImage(context_->GetWebService(), true));
173
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
217 //pet->ScheduleLoadSeries("48d2997f-8e25cd81-dd715b64-bd79cdcc-e8fcee53"); // 0178023P
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
218 //pet->ScheduleLoadSeries("aabad2e7-80702b5d-e599d26c-4f13398e-38d58a9e");
173
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
219 //pet->ScheduleLoadInstance("830a69ff-8e4b5ee3-b7f966c8-bccc20fb-d322dceb"); // IBA 1
120
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
220 //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
221 //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
222 //pet->ScheduleLoadInstance("269f26f4-0c83eeeb-2e67abbd-5467a40f-f1bec90c"); // 0522c0001 TCIA
174
a7674c0ae4ac fix captain rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
223 pet->ScheduleLoadInstance("f080888c-0ab7528a-f7d9c28c-84980eb1-ff3b0ae6"); // Captain 1
a7674c0ae4ac fix captain rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 173
diff changeset
224 //pet->ScheduleLoadInstance("4f78055b-6499a2c5-1e089290-394acc05-3ec781c1"); // Captain 2
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
226 std::auto_ptr<StructureSetLoader> rtStruct(new StructureSetLoader(context_->GetWebService()));
173
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
227 //rtStruct->ScheduleLoadInstance("c2ebc17b-6b3548db-5e5da170-b8ecab71-ea03add3"); // 0178023P
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
228 //rtStruct->ScheduleLoadInstance("54460695-ba3885ee-ddf61ac0-f028e31d-a6e474d9"); // IBA
128
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
229 //rtStruct->ScheduleLoadInstance("17cd032b-ad92a438-ca05f06a-f9e96668-7e3e9e20"); // 0522c0001 TCIA
173
6b0411ac843a fix captain rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 147
diff changeset
230 rtStruct->ScheduleLoadInstance("96c889ab-29fe5c54-dda6e66c-3949e4da-58f90d75"); // Captain
123
ed0003f6102c dynamic loading of rt-struct renderers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
231
398
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 397
diff changeset
232 widget->AddLayer(new VolumeImageMPRSlicer(*ct));
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 397
diff changeset
233 widget->AddLayer(new VolumeImageMPRSlicer(*pet));
d257ea56b7be renamed DicomStructureSetRendererFactory as DicomStructureSetSlicer, VolumeImageSource as VolumeImageMPRSlicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 397
diff changeset
234 widget->AddLayer(new DicomStructureSetSlicer(*rtStruct));
105
e0ddd8cad909 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
235
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
236 context_->AddInteractor(new Interactor(*pet, *widget, projection, 1));
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
237 //context_->AddInteractor(new VolumeImageInteractor(*ct, *widget, projection));
126
c9e88e7935a4 rt-struct projection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 123
diff changeset
238
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
239 context_->AddSlicedVolume(ct.release());
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
240 context_->AddSlicedVolume(pet.release());
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
241 context_->AddVolumeLoader(rtStruct.release());
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
243 {
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
244 RenderStyle s;
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
245 //s.drawGrid_ = true;
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
246 s.alpha_ = 1;
104
eccd64f8e297 VolumeImageInteractor
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 103
diff changeset
247 s.windowing_ = ImageWindowing_Bone;
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
248 widget->SetLayerStyle(0, s);
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
249 }
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
250
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
251 {
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
252 RenderStyle s;
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
253 //s.drawGrid_ = true;
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
254 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
255 s.alpha_ = 0.5;
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
256 s.applyLut_ = true;
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
257 s.lut_ = Orthanc::EmbeddedResources::COLORMAP_JET;
147
f48c5d422d45 removed meaningless ImageInterpolation_Linear value
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
258 s.interpolation_ = ImageInterpolation_Bilinear;
120
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
259 s.windowing_ = ImageWindowing_Custom;
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
260 s.customWindowCenter_ = 0;
063f7f3d9f14 fix 3d locations of the doses
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 119
diff changeset
261 s.customWindowWidth_ = 128;
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
262 widget->SetLayerStyle(1, s);
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
263 }
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
264 #endif
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
265
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 statusBar.SetMessage("Use the keys \"b\", \"l\" and \"d\" to change Hounsfield windowing");
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 statusBar.SetMessage("Use the keys \"t\" to track the (X,Y,Z) mouse coordinates");
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 statusBar.SetMessage("Use the keys \"m\" to measure distances");
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 statusBar.SetMessage("Use the keys \"c\" to draw circles");
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
271
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 51
diff changeset
272 widget->SetTransmitMouseOver(true);
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents: 212
diff changeset
273 context_->SetCentralWidget(widget.release());
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 }