Mercurial > hg > orthanc-stone
annotate UnitTestsSources/UnitTestsMain.cpp @ 138:77c4fef7f4a5 wasm
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Jan 2018 13:47:54 +0100 |
parents | e2fe9352f240 |
children | 9b83f30fc1c0 |
rev | line source |
---|---|
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
121
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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. | |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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 | |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
102 | 22 #include "../Framework/dev.h" |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "gtest/gtest.h" |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
113
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
25 #include "../Framework/Layers/FrameRenderer.h" |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
26 #include "../Framework/Layers/LayerSourceBase.h" |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
27 #include "../Framework/Toolbox/DownloadStack.h" |
73 | 28 #include "../Framework/Toolbox/OrthancSlicesLoader.h" |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
29 #include "../Framework/Volumes/ImageBuffer3D.h" |
88 | 30 #include "../Framework/Volumes/SlicedVolumeBase.h" |
113
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
31 #include "../Platforms/Generic/OracleWebService.h" |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
32 |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
33 #include <Core/HttpClient.h> |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
34 #include <Core/Images/ImageProcessing.h> |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
35 #include <Core/Logging.h> |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
36 #include <Core/MultiThreading/SharedMessageQueue.h> |
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
37 #include <Core/OrthancException.h> |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
38 |
68 | 39 #include <boost/lexical_cast.hpp> |
70
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
40 #include <boost/date_time/posix_time/posix_time.hpp> |
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
41 #include <boost/thread/thread.hpp> |
102 | 42 #include <boost/math/special_functions/round.hpp> |
43 | |
68 | 44 |
65
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
45 namespace OrthancStone |
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
46 { |
72
c1cc3bdba18c
cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
47 class Tata : public OrthancSlicesLoader::ICallback |
67
acb60cbb8301
refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
66
diff
changeset
|
48 { |
acb60cbb8301
refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
66
diff
changeset
|
49 public: |
72
c1cc3bdba18c
cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
50 virtual void NotifyGeometryReady(const OrthancSlicesLoader& loader) |
67
acb60cbb8301
refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
66
diff
changeset
|
51 { |
80 | 52 printf(">> %d\n", (int) loader.GetSliceCount()); |
70
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
53 |
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
54 for (size_t i = 0; i < loader.GetSliceCount(); i++) |
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
55 { |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
56 const_cast<OrthancSlicesLoader&>(loader).ScheduleLoadSliceImage(i, SliceImageQuality_Full); |
70
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
57 } |
68 | 58 } |
59 | |
72
c1cc3bdba18c
cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
60 virtual void NotifyGeometryError(const OrthancSlicesLoader& loader) |
68 | 61 { |
62 printf("Error\n"); | |
67
acb60cbb8301
refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
66
diff
changeset
|
63 } |
66 | 64 |
72
c1cc3bdba18c
cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
65 virtual void NotifySliceImageReady(const OrthancSlicesLoader& loader, |
68 | 66 unsigned int sliceIndex, |
67 const Slice& slice, | |
102 | 68 std::auto_ptr<Orthanc::ImageAccessor>& image, |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
69 SliceImageQuality quality) |
67
acb60cbb8301
refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
66
diff
changeset
|
70 { |
68 | 71 std::auto_ptr<Orthanc::ImageAccessor> tmp(image); |
70
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
72 printf("Slice OK %dx%d\n", tmp->GetWidth(), tmp->GetHeight()); |
68 | 73 } |
74 | |
72
c1cc3bdba18c
cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
75 virtual void NotifySliceImageError(const OrthancSlicesLoader& loader, |
68 | 76 unsigned int sliceIndex, |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
77 const Slice& slice, |
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
78 SliceImageQuality quality) |
68 | 79 { |
80 printf("ERROR 2\n"); | |
67
acb60cbb8301
refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
66
diff
changeset
|
81 } |
acb60cbb8301
refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
66
diff
changeset
|
82 }; |
65
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
83 } |
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
84 |
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
85 |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
86 TEST(Toto, DISABLED_Tutu) |
65
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
87 { |
80 | 88 OrthancStone::Oracle oracle(4); |
89 oracle.Start(); | |
90 | |
65
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
91 Orthanc::WebServiceParameters web; |
80 | 92 //OrthancStone::OrthancAsynchronousWebService orthanc(web, 4); |
93 OrthancStone::OracleWebService orthanc(oracle, web); | |
94 //orthanc.Start(); | |
65
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
95 |
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
96 OrthancStone::Tata tata; |
72
c1cc3bdba18c
cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
97 OrthancStone::OrthancSlicesLoader loader(tata, orthanc); |
80 | 98 loader.ScheduleLoadSeries("c1c4cb95-05e3bd11-8da9f5bb-87278f71-0b2b43f5"); |
77 | 99 //loader.ScheduleLoadSeries("67f1b334-02c16752-45026e40-a5b60b6b-030ecab5"); |
71
30c768873d47
OrthancSliceLoader::ScheduleLoadInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
70
diff
changeset
|
100 |
80 | 101 //loader.ScheduleLoadInstance("19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5", 0); |
68 | 102 |
70
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
103 /*printf(">> %d\n", loader.GetSliceCount()); |
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
104 loader.ScheduleLoadSliceImage(31);*/ |
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
105 |
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
106 boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); |
f73aed014bde
OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
107 |
80 | 108 //orthanc.Stop(); |
109 oracle.Stop(); | |
65
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
110 } |
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
111 |
885932a893de
OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
112 |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
113 TEST(Toto, Tata) |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
114 { |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
115 OrthancStone::Oracle oracle(4); |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
116 oracle.Start(); |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
117 |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
118 Orthanc::WebServiceParameters web; |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
119 OrthancStone::OracleWebService orthanc(oracle, web); |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
120 OrthancStone::OrthancVolumeImage volume(orthanc, true); |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
121 |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
122 //volume.ScheduleLoadInstance("19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5", 0); |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
123 //volume.ScheduleLoadSeries("318603c5-03e8cffc-a82b6ee1-3ccd3c1e-18d7e3bb"); // COMUNIX PET |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
124 //volume.ScheduleLoadSeries("7124dba7-09803f33-98b73826-33f14632-ea842d29"); // COMUNIX CT |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
125 //volume.ScheduleLoadSeries("5990e39c-51e5f201-fe87a54c-31a55943-e59ef80e"); // Delphine sagital |
93
5945e81734a3
decoding of JPEG images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
126 volume.ScheduleLoadSeries("6f1b492a-e181e200-44e51840-ef8db55e-af529ab6"); // Delphine ax 2.5 |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
127 |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
128 boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
129 |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
130 oracle.Stop(); |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
131 } |
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
82
diff
changeset
|
132 |
20
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 int main(int argc, char **argv) |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 { |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 Orthanc::Logging::Initialize(); |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 Orthanc::Logging::EnableInfoLevel(true); |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 ::testing::InitGoogleTest(&argc, argv); |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 int result = RUN_ALL_TESTS(); |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 Orthanc::Logging::Finalize(); |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 return result; |
946377d1c992
skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 } |