Mercurial > hg > orthanc-stone
annotate Applications/Samples/SynchronizedSeriesApplication.h @ 925:4639d0bf6390
Added support for Grayscale16 in the multiframe loader (Victor)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 22 Jul 2019 16:00:03 +0200 |
parents | b70e9be013e4 |
children | 2d8ab34c8c91 |
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 | |
439 | 5 * Copyright (C) 2017-2019 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 | |
24 #include "SampleInteractor.h" | |
25 | |
51 | 26 #include "../../Framework/Toolbox/OrthancSeriesLoader.h" |
27 #include "../../Framework/Layers/SeriesFrameRendererFactory.h" | |
390
0cb925325470
renamed SiblingSliceLocation as ReferenceLine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
28 #include "../../Framework/Layers/ReferenceLineFactory.h" |
51 | 29 #include "../../Framework/Widgets/LayoutWidget.h" |
212
5412adf19980
resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
196
diff
changeset
|
30 |
5412adf19980
resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
196
diff
changeset
|
31 #include <Core/Logging.h> |
0 | 32 |
33 namespace OrthancStone | |
34 { | |
35 namespace Samples | |
36 { | |
37 class SynchronizedSeriesApplication : public SampleApplicationBase | |
38 { | |
39 private: | |
40 LayeredSceneWidget* CreateSeriesWidget(BasicApplicationContext& context, | |
41 const std::string& series) | |
42 { | |
57 | 43 std::auto_ptr<ISeriesLoader> loader |
44 (new OrthancSeriesLoader(context.GetWebService().GetConnection(), series)); | |
0 | 45 |
46 std::auto_ptr<SampleInteractor> interactor(new SampleInteractor(*loader, false)); | |
47 | |
48 std::auto_ptr<LayeredSceneWidget> widget(new LayeredSceneWidget); | |
49 widget->AddLayer(new SeriesFrameRendererFactory(loader.release(), false)); | |
50 widget->SetSlice(interactor->GetCursor().GetCurrentSlice()); | |
51 widget->SetInteractor(*interactor); | |
52 | |
53 context.AddInteractor(interactor.release()); | |
54 | |
55 return widget.release(); | |
56 } | |
57 | |
58 public: | |
59 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) | |
60 { | |
61 boost::program_options::options_description generic("Sample options"); | |
62 generic.add_options() | |
63 ("a", boost::program_options::value<std::string>(), | |
64 "Orthanc ID of the 1st series") | |
65 ("b", boost::program_options::value<std::string>(), | |
66 "Orthanc ID of the 2nd series") | |
67 ("c", boost::program_options::value<std::string>(), | |
68 "Orthanc ID of the 3rd series") | |
69 ; | |
70 | |
71 options.add(generic); | |
72 } | |
73 | |
74 virtual void Initialize(BasicApplicationContext& context, | |
75 IStatusBar& statusBar, | |
76 const boost::program_options::variables_map& parameters) | |
77 { | |
78 if (parameters.count("a") != 1 || | |
79 parameters.count("b") != 1 || | |
80 parameters.count("c") != 1) | |
81 { | |
82 LOG(ERROR) << "At least one of the three series IDs is missing"; | |
83 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
84 } | |
85 | |
86 std::auto_ptr<LayeredSceneWidget> a(CreateSeriesWidget(context, parameters["a"].as<std::string>())); | |
87 std::auto_ptr<LayeredSceneWidget> b(CreateSeriesWidget(context, parameters["b"].as<std::string>())); | |
88 std::auto_ptr<LayeredSceneWidget> c(CreateSeriesWidget(context, parameters["c"].as<std::string>())); | |
89 | |
390
0cb925325470
renamed SiblingSliceLocation as ReferenceLine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
90 ReferenceLineFactory::Configure(*a, *b); |
0cb925325470
renamed SiblingSliceLocation as ReferenceLine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
91 ReferenceLineFactory::Configure(*a, *c); |
0cb925325470
renamed SiblingSliceLocation as ReferenceLine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
92 ReferenceLineFactory::Configure(*b, *c); |
0 | 93 |
94 std::auto_ptr<LayoutWidget> layout(new LayoutWidget); | |
95 layout->SetPadding(5); | |
96 layout->AddWidget(a.release()); | |
97 | |
98 std::auto_ptr<LayoutWidget> layoutB(new LayoutWidget); | |
99 layoutB->SetVertical(); | |
100 layoutB->SetPadding(5); | |
101 layoutB->AddWidget(b.release()); | |
102 layoutB->AddWidget(c.release()); | |
103 layout->AddWidget(layoutB.release()); | |
104 | |
105 context.SetCentralWidget(layout.release()); | |
106 } | |
107 }; | |
108 } | |
109 } |