Mercurial > hg > orthanc
comparison OrthancCppClient/Series.cpp @ 548:ffedcc8f0938 laaw
progress
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 20 Sep 2013 17:47:59 +0200 |
parents | 50d9660f960c |
children | b2357f1f026f |
comparison
equal
deleted
inserted
replaced
546:0e510ea3de31 | 548:ffedcc8f0938 |
---|---|
151 instance_.DiscardImage(); | 151 instance_.DiscardImage(); |
152 | 152 |
153 return true; | 153 return true; |
154 } | 154 } |
155 }; | 155 }; |
156 | |
157 | |
158 class ProgressToFloatListener : public Orthanc::ThreadedCommandProcessor::IListener | |
159 { | |
160 private: | |
161 float* target_; | |
162 | |
163 public: | |
164 ProgressToFloatListener(float* target) : target_(target) | |
165 { | |
166 } | |
167 | |
168 virtual void SignalProgress(unsigned int current, | |
169 unsigned int total) | |
170 { | |
171 if (total == 0) | |
172 { | |
173 *target_ = 0; | |
174 } | |
175 else | |
176 { | |
177 *target_ = static_cast<float>(current) / static_cast<float>(total); | |
178 } | |
179 } | |
180 | |
181 virtual void SignalSuccess(unsigned int total) | |
182 { | |
183 *target_ = 1; | |
184 } | |
185 | |
186 virtual void SignalFailure() | |
187 { | |
188 *target_ = 0; | |
189 } | |
190 | |
191 virtual void SignalCancel() | |
192 { | |
193 *target_ = 0; | |
194 } | |
195 }; | |
196 | |
156 } | 197 } |
157 | 198 |
158 | 199 |
159 void Series::Check3DImage() | 200 void Series::Check3DImage() |
160 { | 201 { |
175 | 216 |
176 Instance& i1 = GetInstance(0); | 217 Instance& i1 = GetInstance(0); |
177 | 218 |
178 for (unsigned int i = 0; i < GetInstanceCount(); i++) | 219 for (unsigned int i = 0; i < GetInstanceCount(); i++) |
179 { | 220 { |
180 Instance& i2 = GetInstance(1); | 221 Instance& i2 = GetInstance(i); |
181 | 222 |
182 if (std::string(i1.GetTagAsString("Columns")) != std::string(i2.GetTagAsString("Columns")) || | 223 if (std::string(i1.GetTagAsString("Columns")) != std::string(i2.GetTagAsString("Columns")) || |
183 std::string(i1.GetTagAsString("Rows")) != std::string(i2.GetTagAsString("Rows")) || | 224 std::string(i1.GetTagAsString("Rows")) != std::string(i2.GetTagAsString("Rows")) || |
184 std::string(i1.GetTagAsString("ImageOrientationPatient")) != std::string(i2.GetTagAsString("ImageOrientationPatient")) || | 225 std::string(i1.GetTagAsString("ImageOrientationPatient")) != std::string(i2.GetTagAsString("ImageOrientationPatient")) || |
185 std::string(i1.GetTagAsString("SliceThickness")) != std::string(i2.GetTagAsString("SliceThickness")) || | 226 std::string(i1.GetTagAsString("SliceThickness")) != std::string(i2.GetTagAsString("SliceThickness")) || |
330 } | 371 } |
331 } | 372 } |
332 | 373 |
333 | 374 |
334 | 375 |
335 void Series::Load3DImage(void* target, | 376 void Series::Load3DImageInternal(void* target, |
336 Orthanc::PixelFormat format, | 377 Orthanc::PixelFormat format, |
337 size_t lineStride, | 378 size_t lineStride, |
338 size_t stackStride, | 379 size_t stackStride, |
339 Orthanc::ThreadedCommandProcessor::IListener* listener) | 380 Orthanc::ThreadedCommandProcessor::IListener* listener) |
340 { | 381 { |
341 using namespace Orthanc; | 382 using namespace Orthanc; |
342 | 383 |
343 // Choose the extraction mode, depending on the format of the | 384 // Choose the extraction mode, depending on the format of the |
344 // target image. | 385 // target image. |
454 { | 495 { |
455 LoadVoxelSize(); | 496 LoadVoxelSize(); |
456 return voxelSizeZ_; | 497 return voxelSizeZ_; |
457 } | 498 } |
458 | 499 |
500 void Series::Load3DImage(void* target, | |
501 Orthanc::PixelFormat format, | |
502 int64_t lineStride, | |
503 int64_t stackStride, | |
504 float* progress) | |
505 { | |
506 ProgressToFloatListener listener(progress); | |
507 Load3DImageInternal(target, format, lineStride, stackStride, &listener); | |
508 } | |
459 } | 509 } |