annotate UnitTestsSources/UnitTestsMain.cpp @ 88:90bf4116a23c wasm

ISlicedVolume
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 May 2017 16:11:52 +0200
parents 4a541cd4fa83
children f244018a4e4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
40
7207a407bcd8 shared copyright with osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 20
diff changeset
5 * Copyright (C) 2017 Osimis, 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
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.
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
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
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
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include "gtest/gtest.h"
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
24 #include "../Platforms/Generic/OracleWebService.h"
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 72
diff changeset
25 #include "../Framework/Toolbox/OrthancSlicesLoader.h"
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
26 #include "../Resources/Orthanc/Core/HttpClient.h"
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "../Resources/Orthanc/Core/Logging.h"
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
28 #include "../Resources/Orthanc/Core/MultiThreading/SharedMessageQueue.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
29 #include "../Resources/Orthanc/Core/OrthancException.h"
67
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
30
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
31 #include "../Framework/Toolbox/IVolumeSlicesObserver.h"
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
32 #include "../Framework/Volumes/ImageBuffer3D.h"
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
33 #include "../Framework/Volumes/SlicedVolumeBase.h"
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
34 #include "../Framework/Toolbox/DownloadStack.h"
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
35 #include "../Resources/Orthanc/Core/Images/ImageProcessing.h"
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
36
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
37 #include <boost/lexical_cast.hpp>
70
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
38 #include <boost/date_time/posix_time/posix_time.hpp>
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
39 #include <boost/thread/thread.hpp>
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
40
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
41 namespace OrthancStone
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
42 {
72
c1cc3bdba18c cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 71
diff changeset
43 class Tata : public OrthancSlicesLoader::ICallback
67
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
44 {
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
45 public:
72
c1cc3bdba18c cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 71
diff changeset
46 virtual void NotifyGeometryReady(const OrthancSlicesLoader& loader)
67
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
47 {
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
48 printf(">> %d\n", (int) loader.GetSliceCount());
70
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
49
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
50 for (size_t i = 0; i < loader.GetSliceCount(); i++)
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
51 {
72
c1cc3bdba18c cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 71
diff changeset
52 const_cast<OrthancSlicesLoader&>(loader).ScheduleLoadSliceImage(i);
70
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
53 }
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
54 }
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
55
72
c1cc3bdba18c cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 71
diff changeset
56 virtual void NotifyGeometryError(const OrthancSlicesLoader& loader)
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
57 {
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
58 printf("Error\n");
67
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
59 }
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 65
diff changeset
60
72
c1cc3bdba18c cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 71
diff changeset
61 virtual void NotifySliceImageReady(const OrthancSlicesLoader& loader,
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
62 unsigned int sliceIndex,
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
63 const Slice& slice,
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
64 Orthanc::ImageAccessor* image)
67
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
65 {
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
66 std::auto_ptr<Orthanc::ImageAccessor> tmp(image);
70
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
67 printf("Slice OK %dx%d\n", tmp->GetWidth(), tmp->GetHeight());
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
68 }
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
69
72
c1cc3bdba18c cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 71
diff changeset
70 virtual void NotifySliceImageError(const OrthancSlicesLoader& loader,
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
71 unsigned int sliceIndex,
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
72 const Slice& slice)
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
73 {
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
74 printf("ERROR 2\n");
67
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
75 }
acb60cbb8301 refactoring SeriesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
76 };
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
77
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
78
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
79 class OrthancVolumeImageLoader :
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
80 public SlicedVolumeBase,
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
81 private OrthancSlicesLoader::ICallback
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
82 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
83 private:
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
84 OrthancSlicesLoader loader_;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
85 IVolumeSlicesObserver* observer_;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
86 std::auto_ptr<ImageBuffer3D> image_;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
87 std::auto_ptr<DownloadStack> downloadStack_;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
88
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
89
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
90 void ScheduleSliceDownload()
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
91 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
92 assert(downloadStack_.get() != NULL);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
93
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
94 unsigned int slice;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
95 if (downloadStack_->Pop(slice))
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
96 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
97 loader_.ScheduleLoadSliceImage(slice);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
98 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
99 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
100
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
101
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
102 static bool IsCompatible(const Slice& a,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
103 const Slice& b)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
104 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
105 if (!GeometryToolbox::IsParallel(a.GetGeometry().GetNormal(),
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
106 b.GetGeometry().GetNormal()))
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
107 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
108 LOG(ERROR) << "Some slice in the volume image is not parallel to the others";
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
109 return false;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
110 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
111
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
112 if (a.GetConverter().GetExpectedPixelFormat() != b.GetConverter().GetExpectedPixelFormat())
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
113 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
114 LOG(ERROR) << "The pixel format changes across the slices of the volume image";
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
115 return false;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
116 }
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 if (a.GetWidth() != b.GetWidth() ||
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
119 a.GetHeight() != b.GetHeight())
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
120 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
121 LOG(ERROR) << "The width/height of the slices change across the volume image";
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
122 return false;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
123 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
124
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
125 if (!GeometryToolbox::IsNear(a.GetPixelSpacingX(), b.GetPixelSpacingX()) ||
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
126 !GeometryToolbox::IsNear(a.GetPixelSpacingY(), b.GetPixelSpacingY()))
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 LOG(ERROR) << "The pixel spacing of the slices change across the volume image";
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
129 return false;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
130 }
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 return true;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
133 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
134
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
135
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
136 static double GetDistance(const Slice& a,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
137 const Slice& b)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
138 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
139 return fabs(a.GetGeometry().ProjectAlongNormal(a.GetGeometry().GetOrigin()) -
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
140 a.GetGeometry().ProjectAlongNormal(b.GetGeometry().GetOrigin()));
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
141 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
142
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
143
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
144 virtual void NotifyGeometryReady(const OrthancSlicesLoader& loader)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
145 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
146 if (loader.GetSliceCount() == 0)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
147 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
148 LOG(ERROR) << "Empty volume image";
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
149 SlicedVolumeBase::NotifyGeometryError();
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
150 return;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
151 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
152
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
153 for (size_t i = 1; i < loader.GetSliceCount(); i++)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
154 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
155 if (!IsCompatible(loader.GetSlice(0), loader.GetSlice(i)))
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
156 {
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
157 SlicedVolumeBase::NotifyGeometryError();
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
158 return;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
159 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
160 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
161
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
162 double spacingZ;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
163
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
164 if (loader.GetSliceCount() > 1)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
165 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
166 spacingZ = GetDistance(loader.GetSlice(0), loader.GetSlice(1));
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
167 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
168 else
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
169 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
170 // This is a volume with one single slice: Choose a dummy
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
171 // z-dimension for voxels
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
172 spacingZ = 1;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
173 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
174
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
175 for (size_t i = 1; i < loader.GetSliceCount(); i++)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
176 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
177 if (!GeometryToolbox::IsNear(spacingZ, GetDistance(loader.GetSlice(i - 1), loader.GetSlice(i))))
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
178 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
179 LOG(ERROR) << "The distance between successive slices is not constant in a volume image";
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
180 SlicedVolumeBase::NotifyGeometryError();
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
181 return;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
182 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
183 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
184
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
185 unsigned int width = loader.GetSlice(0).GetWidth();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
186 unsigned int height = loader.GetSlice(0).GetHeight();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
187 Orthanc::PixelFormat format = loader.GetSlice(0).GetConverter().GetExpectedPixelFormat();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
188 LOG(INFO) << "Creating a volume image of size " << width << "x" << height
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
189 << "x" << loader.GetSliceCount() << " in " << Orthanc::EnumerationToString(format);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
190
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
191 image_.reset(new ImageBuffer3D(format, width, height, loader.GetSliceCount()));
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
192 image_->SetAxialGeometry(loader.GetSlice(0).GetGeometry());
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
193 image_->SetVoxelDimensions(loader.GetSlice(0).GetPixelSpacingX(),
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
194 loader.GetSlice(0).GetPixelSpacingY(), spacingZ);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
195 image_->Clear();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
196
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
197 downloadStack_.reset(new DownloadStack(loader.GetSliceCount()));
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
198
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
199 SlicedVolumeBase::NotifyGeometryReady();
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
200
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
201 for (unsigned int i = 0; i < 4; i++) // Limit to 4 simultaneous downloads
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
202 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
203 ScheduleSliceDownload();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
204 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
205 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
206
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
207 virtual void NotifyGeometryError(const OrthancSlicesLoader& loader)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
208 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
209 LOG(ERROR) << "Unable to download a volume image";
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
210 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
211
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
212 virtual void NotifySliceImageReady(const OrthancSlicesLoader& loader,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
213 unsigned int sliceIndex,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
214 const Slice& slice,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
215 Orthanc::ImageAccessor* image)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
216 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
217 std::auto_ptr<Orthanc::ImageAccessor> protection(image);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
218
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
219 {
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
220 ImageBuffer3D::SliceWriter writer(*image_, VolumeProjection_Axial, sliceIndex);
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
221 Orthanc::ImageProcessing::Copy(writer.GetAccessor(), *protection);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
222 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
223
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
224 SlicedVolumeBase::NotifySliceChange(sliceIndex, slice);
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
225
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
226 ScheduleSliceDownload();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
227 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
228
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
229 virtual void NotifySliceImageError(const OrthancSlicesLoader& loader,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
230 unsigned int sliceIndex,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
231 const Slice& slice)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
232 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
233 LOG(ERROR) << "Cannot download slice " << sliceIndex << " in a volume image";
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
234 ScheduleSliceDownload();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
235 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
236
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
237 public:
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
238 OrthancVolumeImageLoader(IWebService& orthanc) :
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
239 loader_(*this, orthanc),
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
240 observer_(NULL)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
241 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
242 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
243
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
244 void ScheduleLoadSeries(const std::string& seriesId)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
245 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
246 loader_.ScheduleLoadSeries(seriesId);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
247 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
248
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
249 void ScheduleLoadInstance(const std::string& instanceId,
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
250 unsigned int frame)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
251 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
252 loader_.ScheduleLoadInstance(instanceId, frame);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
253 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
254
88
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
255 virtual size_t GetSliceCount() const
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
256 {
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
257 return loader_.GetSliceCount();
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
258 }
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
259
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
260 virtual const Slice& GetSlice(size_t index) const
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
261 {
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
262 return loader_.GetSlice(index);
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
263 }
90bf4116a23c ISlicedVolume
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
264
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
265 void SetObserver(IVolumeSlicesObserver& observer)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
266 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
267 if (observer_ == NULL)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
268 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
269 observer_ = &observer;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
270 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
271 else
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
272 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
273 // Cannot add more than one observer
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
274 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
275 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
276 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
277
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
278 };
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
279 }
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
280
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
281
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
282 TEST(Toto, DISABLED_Tutu)
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
283 {
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
284 OrthancStone::Oracle oracle(4);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
285 oracle.Start();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
286
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
287 Orthanc::WebServiceParameters web;
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
288 //OrthancStone::OrthancAsynchronousWebService orthanc(web, 4);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
289 OrthancStone::OracleWebService orthanc(oracle, web);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
290 //orthanc.Start();
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
291
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
292 OrthancStone::Tata tata;
72
c1cc3bdba18c cleaning up OrthancSlicesLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 71
diff changeset
293 OrthancStone::OrthancSlicesLoader loader(tata, orthanc);
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
294 loader.ScheduleLoadSeries("c1c4cb95-05e3bd11-8da9f5bb-87278f71-0b2b43f5");
77
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 73
diff changeset
295 //loader.ScheduleLoadSeries("67f1b334-02c16752-45026e40-a5b60b6b-030ecab5");
71
30c768873d47 OrthancSliceLoader::ScheduleLoadInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 70
diff changeset
296
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
297 //loader.ScheduleLoadInstance("19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5", 0);
68
1526d38ef6da SliceSorter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 67
diff changeset
298
70
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
299 /*printf(">> %d\n", loader.GetSliceCount());
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
300 loader.ScheduleLoadSliceImage(31);*/
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
301
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
302 boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
f73aed014bde OrthancAsynchronousWebService
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 69
diff changeset
303
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
304 //orthanc.Stop();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
305 oracle.Stop();
65
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
306 }
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
307
885932a893de OrthancFrameLayerSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
308
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
309 TEST(Toto, Tata)
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
310 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
311 OrthancStone::Oracle oracle(4);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
312 oracle.Start();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
313
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
314 Orthanc::WebServiceParameters web;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
315 OrthancStone::OracleWebService orthanc(oracle, web);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
316 OrthancStone::OrthancVolumeImageLoader volume(orthanc);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
317
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
318 volume.ScheduleLoadInstance("19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5", 0);
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
319 //volume.ScheduleLoadSeries("318603c5-03e8cffc-a82b6ee1-3ccd3c1e-18d7e3bb"); // COMUNIX PET
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
320 //volume.ScheduleLoadSeries("5990e39c-51e5f201-fe87a54c-31a55943-e59ef80e"); // Delphine sagital
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
321
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
322 boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
323
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
324 oracle.Stop();
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
325 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
326
20
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 int main(int argc, char **argv)
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 {
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 Orthanc::Logging::Initialize();
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 Orthanc::Logging::EnableInfoLevel(true);
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 ::testing::InitGoogleTest(&argc, argv);
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 int result = RUN_ALL_TESTS();
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 Orthanc::Logging::Finalize();
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 return result;
946377d1c992 skeleton for unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 }