comparison Samples/Sdl/Loader.cpp @ 744:a4bfb420b869

SleepOracleCommand
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 May 2019 11:28:42 +0200
parents fa5febe0f0c2
children c44c1d2d3598
comparison
equal deleted inserted replaced
743:bcd3ea868bcd 744:a4bfb420b869
67 class IOracleCommand : public boost::noncopyable 67 class IOracleCommand : public boost::noncopyable
68 { 68 {
69 public: 69 public:
70 enum Type 70 enum Type
71 { 71 {
72 Type_Sleep,
72 Type_OrthancRestApi, 73 Type_OrthancRestApi,
73 Type_GetOrthancImage, 74 Type_GetOrthancImage,
74 Type_GetOrthancWebViewerJpeg 75 Type_GetOrthancWebViewerJpeg
75 }; 76 };
76 77
145 const Orthanc::IDynamicObject& GetPayload() const 146 const Orthanc::IDynamicObject& GetPayload() const
146 { 147 {
147 if (HasPayload()) 148 if (HasPayload())
148 { 149 {
149 return *payload_; 150 return *payload_;
151 }
152 else
153 {
154 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
155 }
156 }
157
158 Orthanc::IDynamicObject* ReleasePayload()
159 {
160 if (HasPayload())
161 {
162 return payload_.release();
150 } 163 }
151 else 164 else
152 { 165 {
153 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); 166 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
154 } 167 }
188 const Orthanc::OrthancException& GetException() const 201 const Orthanc::OrthancException& GetException() const
189 { 202 {
190 return exception_; 203 return exception_;
191 } 204 }
192 }; 205 };
206
207
208 class SleepOracleCommand : public OracleCommandWithPayload
209 {
210 private:
211 unsigned int milliseconds_;
212
213 public:
214 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, TimeoutMessage, SleepOracleCommand);
215
216 SleepOracleCommand(unsigned int milliseconds) :
217 milliseconds_(milliseconds)
218 {
219 }
220
221 virtual Type GetType() const
222 {
223 return Type_Sleep;
224 }
225
226 unsigned int GetDelay() const
227 {
228 return milliseconds_;
229 }
230 };
231
193 232
194 233
195 typedef std::map<std::string, std::string> HttpHeaders; 234 typedef std::map<std::string, std::string> HttpHeaders;
196 235
197 class OrthancRestApiCommand : public OracleCommandWithPayload 236 class OrthancRestApiCommand : public OracleCommandWithPayload
1935 1974
1936 1975
1937 1976
1938 1977
1939 1978
1940 class NativeOracle : public IOracle 1979 class ThreadedOracle : public IOracle
1941 { 1980 {
1942 private: 1981 private:
1943 class Item : public Orthanc::IDynamicObject 1982 class Item : public Orthanc::IDynamicObject
1944 { 1983 {
1945 private: 1984 private:
1961 const OrthancStone::IObserver& GetReceiver() const 2000 const OrthancStone::IObserver& GetReceiver() const
1962 { 2001 {
1963 return receiver_; 2002 return receiver_;
1964 } 2003 }
1965 2004
1966 const IOracleCommand& GetCommand() const 2005 IOracleCommand& GetCommand()
1967 { 2006 {
1968 assert(command_.get() != NULL); 2007 assert(command_.get() != NULL);
1969 return *command_; 2008 return *command_;
1970 } 2009 }
1971 }; 2010 };
1974 enum State 2013 enum State
1975 { 2014 {
1976 State_Setup, 2015 State_Setup,
1977 State_Running, 2016 State_Running,
1978 State_Stopped 2017 State_Stopped
2018 };
2019
2020
2021 class SleepingCommands : public boost::noncopyable
2022 {
2023 private:
2024 class Item
2025 {
2026 private:
2027 const OrthancStone::IObserver& receiver_;
2028 std::auto_ptr<SleepOracleCommand> command_;
2029 boost::posix_time::ptime expiration_;
2030
2031 public:
2032 Item(const OrthancStone::IObserver& receiver,
2033 SleepOracleCommand* command) :
2034 receiver_(receiver),
2035 command_(command)
2036 {
2037 if (command == NULL)
2038 {
2039 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
2040 }
2041
2042 expiration_ = (boost::posix_time::second_clock::local_time() +
2043 boost::posix_time::milliseconds(command_->GetDelay()));
2044 }
2045
2046 const boost::posix_time::ptime& GetExpirationTime() const
2047 {
2048 return expiration_;
2049 }
2050
2051 void Awake(IMessageEmitter& emitter)
2052 {
2053 assert(command_.get() != NULL);
2054
2055 SleepOracleCommand::TimeoutMessage message(*command_);
2056 emitter.EmitMessage(receiver_, message);
2057 }
2058 };
2059
2060 typedef std::list<Item*> Content;
2061
2062 boost::mutex mutex_;
2063 Content content_;
2064
2065 public:
2066 ~SleepingCommands()
2067 {
2068 for (Content::iterator it = content_.begin(); it != content_.end(); ++it)
2069 {
2070 if (*it != NULL)
2071 {
2072 delete *it;
2073 }
2074 }
2075 }
2076
2077 void Add(const OrthancStone::IObserver& receiver,
2078 SleepOracleCommand* command) // Takes ownership
2079 {
2080 boost::mutex::scoped_lock lock(mutex_);
2081
2082 content_.push_back(new Item(receiver, command));
2083 }
2084
2085 void AwakeExpired(IMessageEmitter& emitter)
2086 {
2087 boost::mutex::scoped_lock lock(mutex_);
2088
2089 const boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
2090
2091 Content stillSleeping;
2092
2093 for (Content::iterator it = content_.begin(); it != content_.end(); ++it)
2094 {
2095 if (*it != NULL &&
2096 (*it)->GetExpirationTime() <= now)
2097 {
2098 (*it)->Awake(emitter);
2099 delete *it;
2100 *it = NULL;
2101 }
2102 else
2103 {
2104 stillSleeping.push_back(*it);
2105 }
2106 }
2107
2108 // Compact the still-sleeping commands
2109 content_ = stillSleeping;
2110 }
1979 }; 2111 };
1980 2112
1981 2113
1982 IMessageEmitter& emitter_; 2114 IMessageEmitter& emitter_;
1983 Orthanc::WebServiceParameters orthanc_; 2115 Orthanc::WebServiceParameters orthanc_;
1984 Orthanc::SharedMessageQueue queue_; 2116 Orthanc::SharedMessageQueue queue_;
1985 State state_; 2117 State state_;
1986 boost::mutex mutex_; 2118 boost::mutex mutex_;
1987 std::vector<boost::thread*> workers_; 2119 std::vector<boost::thread*> workers_;
1988 2120 SleepingCommands sleepingCommands_;
2121 boost::thread sleepingWorker_;
2122 unsigned int sleepingTimeResolution_;
1989 2123
1990 void CopyHttpHeaders(Orthanc::HttpClient& client, 2124 void CopyHttpHeaders(Orthanc::HttpClient& client,
1991 const HttpHeaders& headers) 2125 const HttpHeaders& headers)
1992 { 2126 {
1993 for (HttpHeaders::const_iterator it = headers.begin(); it != headers.end(); it++ ) 2127 for (HttpHeaders::const_iterator it = headers.begin(); it != headers.end(); it++ )
2034 } 2168 }
2035 } 2169 }
2036 2170
2037 2171
2038 void Execute(const OrthancStone::IObserver& receiver, 2172 void Execute(const OrthancStone::IObserver& receiver,
2173 SleepOracleCommand& command)
2174 {
2175 std::auto_ptr<SleepOracleCommand> copy(new SleepOracleCommand(command.GetDelay()));
2176
2177 if (command.HasPayload())
2178 {
2179 copy->SetPayload(command.ReleasePayload());
2180 }
2181
2182 sleepingCommands_.Add(receiver, copy.release());
2183 }
2184
2185
2186 void Execute(const OrthancStone::IObserver& receiver,
2039 const OrthancRestApiCommand& command) 2187 const OrthancRestApiCommand& command)
2040 { 2188 {
2041 Orthanc::HttpClient client(orthanc_, command.GetUri()); 2189 Orthanc::HttpClient client(orthanc_, command.GetUri());
2042 client.SetMethod(command.GetMethod()); 2190 client.SetMethod(command.GetMethod());
2043 client.SetTimeout(command.GetTimeout()); 2191 client.SetTimeout(command.GetTimeout());
2101 { 2249 {
2102 std::auto_ptr<Orthanc::IDynamicObject> object(queue_.Dequeue(100)); 2250 std::auto_ptr<Orthanc::IDynamicObject> object(queue_.Dequeue(100));
2103 2251
2104 if (object.get() != NULL) 2252 if (object.get() != NULL)
2105 { 2253 {
2106 const Item& item = dynamic_cast<Item&>(*object); 2254 Item& item = dynamic_cast<Item&>(*object);
2107 2255
2108 try 2256 try
2109 { 2257 {
2110 switch (item.GetCommand().GetType()) 2258 switch (item.GetCommand().GetType())
2111 { 2259 {
2260 case IOracleCommand::Type_Sleep:
2261 Execute(item.GetReceiver(),
2262 dynamic_cast<SleepOracleCommand&>(item.GetCommand()));
2263 break;
2264
2112 case IOracleCommand::Type_OrthancRestApi: 2265 case IOracleCommand::Type_OrthancRestApi:
2113 Execute(item.GetReceiver(), 2266 Execute(item.GetReceiver(),
2114 dynamic_cast<const OrthancRestApiCommand&>(item.GetCommand())); 2267 dynamic_cast<const OrthancRestApiCommand&>(item.GetCommand()));
2115 break; 2268 break;
2116 2269
2141 } 2294 }
2142 } 2295 }
2143 } 2296 }
2144 2297
2145 2298
2146 static void Worker(NativeOracle* that) 2299 static void Worker(ThreadedOracle* that)
2147 { 2300 {
2148 assert(that != NULL); 2301 assert(that != NULL);
2149 2302
2150 for (;;) 2303 for (;;)
2151 { 2304 {
2160 that->Step(); 2313 that->Step();
2161 } 2314 }
2162 } 2315 }
2163 2316
2164 2317
2318 static void SleepingWorker(ThreadedOracle* that)
2319 {
2320 assert(that != NULL);
2321
2322 for (;;)
2323 {
2324 {
2325 boost::mutex::scoped_lock lock(that->mutex_);
2326 if (that->state_ != State_Running)
2327 {
2328 return;
2329 }
2330 }
2331
2332 that->sleepingCommands_.AwakeExpired(that->emitter_);
2333
2334 boost::this_thread::sleep(boost::posix_time::milliseconds(that->sleepingTimeResolution_));
2335 }
2336 }
2337
2338
2165 void StopInternal() 2339 void StopInternal()
2166 { 2340 {
2167 { 2341 {
2168 boost::mutex::scoped_lock lock(mutex_); 2342 boost::mutex::scoped_lock lock(mutex_);
2169 2343
2174 } 2348 }
2175 else 2349 else
2176 { 2350 {
2177 state_ = State_Stopped; 2351 state_ = State_Stopped;
2178 } 2352 }
2353 }
2354
2355 if (sleepingWorker_.joinable())
2356 {
2357 sleepingWorker_.join();
2179 } 2358 }
2180 2359
2181 for (size_t i = 0; i < workers_.size(); i++) 2360 for (size_t i = 0; i < workers_.size(); i++)
2182 { 2361 {
2183 if (workers_[i] != NULL) 2362 if (workers_[i] != NULL)
2192 } 2371 }
2193 } 2372 }
2194 2373
2195 2374
2196 public: 2375 public:
2197 NativeOracle(IMessageEmitter& emitter) : 2376 ThreadedOracle(IMessageEmitter& emitter) :
2198 emitter_(emitter), 2377 emitter_(emitter),
2199 state_(State_Setup), 2378 state_(State_Setup),
2200 workers_(4) 2379 workers_(4),
2201 { 2380 sleepingTimeResolution_(50) // By default, time resolution of 50ms
2202 } 2381 {
2203 2382 }
2204 virtual ~NativeOracle() 2383
2384 virtual ~ThreadedOracle()
2205 { 2385 {
2206 StopInternal(); 2386 StopInternal();
2207 } 2387 }
2208 2388
2209 void SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc) 2389 void SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc)
2236 { 2416 {
2237 workers_.resize(count); 2417 workers_.resize(count);
2238 } 2418 }
2239 } 2419 }
2240 2420
2421 void SetSleepingTimeResolution(unsigned int milliseconds)
2422 {
2423 boost::mutex::scoped_lock lock(mutex_);
2424
2425 if (milliseconds <= 0)
2426 {
2427 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
2428 }
2429 else if (state_ != State_Setup)
2430 {
2431 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
2432 }
2433 else
2434 {
2435 sleepingTimeResolution_ = milliseconds;
2436 }
2437 }
2438
2241 void Start() 2439 void Start()
2242 { 2440 {
2243 boost::mutex::scoped_lock lock(mutex_); 2441 boost::mutex::scoped_lock lock(mutex_);
2244 2442
2245 if (state_ != State_Setup) 2443 if (state_ != State_Setup)
2252 2450
2253 for (unsigned int i = 0; i < workers_.size(); i++) 2451 for (unsigned int i = 0; i < workers_.size(); i++)
2254 { 2452 {
2255 workers_[i] = new boost::thread(Worker, this); 2453 workers_[i] = new boost::thread(Worker, this);
2256 } 2454 }
2455
2456 sleepingWorker_ = boost::thread(SleepingWorker, this);
2257 } 2457 }
2258 } 2458 }
2259 2459
2260 void Stop() 2460 void Stop()
2261 { 2461 {
2343 2543
2344 2544
2345 class Toto : public OrthancStone::IObserver 2545 class Toto : public OrthancStone::IObserver
2346 { 2546 {
2347 private: 2547 private:
2548 void Handle(const Refactoring::SleepOracleCommand::TimeoutMessage& message)
2549 {
2550 printf("TIMEOUT! %d\n", dynamic_cast<const Orthanc::SingleValueObject<unsigned int>& >(message.GetOrigin().GetPayload()).GetValue());
2551 }
2552
2348 void Handle(const Refactoring::OrthancRestApiCommand::SuccessMessage& message) 2553 void Handle(const Refactoring::OrthancRestApiCommand::SuccessMessage& message)
2349 { 2554 {
2350 Json::Value v; 2555 Json::Value v;
2351 message.ParseJsonBody(v); 2556 message.ParseJsonBody(v);
2352 2557
2383 Toto(OrthancStone::IObservable& oracle) : 2588 Toto(OrthancStone::IObservable& oracle) :
2384 IObserver(oracle.GetBroker()) 2589 IObserver(oracle.GetBroker())
2385 { 2590 {
2386 oracle.RegisterObserverCallback 2591 oracle.RegisterObserverCallback
2387 (new OrthancStone::Callable 2592 (new OrthancStone::Callable
2593 <Toto, Refactoring::SleepOracleCommand::TimeoutMessage>(*this, &Toto::Handle));
2594
2595 oracle.RegisterObserverCallback
2596 (new OrthancStone::Callable
2388 <Toto, Refactoring::OrthancRestApiCommand::SuccessMessage>(*this, &Toto::Handle)); 2597 <Toto, Refactoring::OrthancRestApiCommand::SuccessMessage>(*this, &Toto::Handle));
2389 2598
2390 oracle.RegisterObserverCallback 2599 oracle.RegisterObserverCallback
2391 (new OrthancStone::Callable 2600 (new OrthancStone::Callable
2392 <Toto, Refactoring::GetOrthancImageCommand::SuccessMessage>(*this, &Toto::Handle)); 2601 <Toto, Refactoring::GetOrthancImageCommand::SuccessMessage>(*this, &Toto::Handle));
2413 toto.reset(new Toto(lock.GetOracleObservable())); 2622 toto.reset(new Toto(lock.GetOracleObservable()));
2414 loader1.reset(new Refactoring::VolumeSeriesOrthancLoader(oracle, lock.GetOracleObservable())); 2623 loader1.reset(new Refactoring::VolumeSeriesOrthancLoader(oracle, lock.GetOracleObservable()));
2415 loader2.reset(new Refactoring::VolumeSeriesOrthancLoader(oracle, lock.GetOracleObservable())); 2624 loader2.reset(new Refactoring::VolumeSeriesOrthancLoader(oracle, lock.GetOracleObservable()));
2416 } 2625 }
2417 2626
2418 if (1) 2627 if (0)
2419 { 2628 {
2420 Json::Value v = Json::objectValue; 2629 Json::Value v = Json::objectValue;
2421 v["Level"] = "Series"; 2630 v["Level"] = "Series";
2422 v["Query"] = Json::objectValue; 2631 v["Query"] = Json::objectValue;
2423 2632
2427 command->SetBody(v); 2636 command->SetBody(v);
2428 2637
2429 oracle.Schedule(*toto, command.release()); 2638 oracle.Schedule(*toto, command.release());
2430 } 2639 }
2431 2640
2432 if (1) 2641 if (0)
2433 { 2642 {
2434 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand); 2643 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand);
2435 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Jpeg))); 2644 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Jpeg)));
2436 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview"); 2645 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview");
2437 oracle.Schedule(*toto, command.release()); 2646 oracle.Schedule(*toto, command.release());
2438 } 2647 }
2439 2648
2440 if (1) 2649 if (0)
2441 { 2650 {
2442 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand); 2651 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand);
2443 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png))); 2652 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png)));
2444 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview"); 2653 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/preview");
2445 oracle.Schedule(*toto, command.release()); 2654 oracle.Schedule(*toto, command.release());
2446 } 2655 }
2447 2656
2448 if (1) 2657 if (0)
2449 { 2658 {
2450 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand); 2659 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand);
2451 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png))); 2660 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Png)));
2452 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); 2661 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16");
2453 oracle.Schedule(*toto, command.release()); 2662 oracle.Schedule(*toto, command.release());
2454 } 2663 }
2455 2664
2456 if (1) 2665 if (0)
2457 { 2666 {
2458 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand); 2667 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand);
2459 command->SetHttpHeader("Accept-Encoding", "gzip"); 2668 command->SetHttpHeader("Accept-Encoding", "gzip");
2460 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); 2669 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam)));
2461 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); 2670 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16");
2462 oracle.Schedule(*toto, command.release()); 2671 oracle.Schedule(*toto, command.release());
2463 } 2672 }
2464 2673
2465 if (1) 2674 if (0)
2466 { 2675 {
2467 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand); 2676 std::auto_ptr<Refactoring::GetOrthancImageCommand> command(new Refactoring::GetOrthancImageCommand);
2468 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); 2677 command->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam)));
2469 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16"); 2678 command->SetUri("/instances/6687cc73-07cae193-52ff29c8-f646cb16-0753ed92/image-uint16");
2470 oracle.Schedule(*toto, command.release()); 2679 oracle.Schedule(*toto, command.release());
2471 } 2680 }
2472 2681
2473 if (1) 2682 if (0)
2474 { 2683 {
2475 std::auto_ptr<Refactoring::GetOrthancWebViewerJpegCommand> command(new Refactoring::GetOrthancWebViewerJpegCommand); 2684 std::auto_ptr<Refactoring::GetOrthancWebViewerJpegCommand> command(new Refactoring::GetOrthancWebViewerJpegCommand);
2476 command->SetHttpHeader("Accept-Encoding", "gzip"); 2685 command->SetHttpHeader("Accept-Encoding", "gzip");
2477 command->SetInstance("e6c7c20b-c9f65d7e-0d76f2e2-830186f2-3e3c600e"); 2686 command->SetInstance("e6c7c20b-c9f65d7e-0d76f2e2-830186f2-3e3c600e");
2478 command->SetQuality(90); 2687 command->SetQuality(90);
2479 oracle.Schedule(*toto, command.release()); 2688 oracle.Schedule(*toto, command.release());
2480 } 2689 }
2481 2690
2482 2691
2692 if (0)
2693 {
2694 for (unsigned int i = 0; i < 10; i++)
2695 {
2696 std::auto_ptr<Refactoring::SleepOracleCommand> command(new Refactoring::SleepOracleCommand(i * 1000));
2697 command->SetPayload(new Orthanc::SingleValueObject<unsigned int>(42 * i));
2698 oracle.Schedule(*toto, command.release());
2699 }
2700 }
2701
2483 // 2017-11-17-Anonymized 2702 // 2017-11-17-Anonymized
2484 //loader1->LoadSeries("cb3ea4d1-d08f3856-ad7b6314-74d88d77-60b05618"); // CT 2703 //loader1->LoadSeries("cb3ea4d1-d08f3856-ad7b6314-74d88d77-60b05618"); // CT
2485 //loader2->LoadInstance("41029085-71718346-811efac4-420e2c15-d39f99b6"); // RT-DOSE 2704 //loader2->LoadInstance("41029085-71718346-811efac4-420e2c15-d39f99b6"); // RT-DOSE
2486 2705
2487 // Delphine 2706 // Delphine
2488 loader1->LoadSeries("5990e39c-51e5f201-fe87a54c-31a55943-e59ef80e"); // CT 2707 //loader1->LoadSeries("5990e39c-51e5f201-fe87a54c-31a55943-e59ef80e"); // CT
2708 loader1->LoadSeries("67f1b334-02c16752-45026e40-a5b60b6b-030ecab5"); // Lung 1/10mm
2489 2709
2490 LOG(WARNING) << "...Waiting for Ctrl-C..."; 2710 LOG(WARNING) << "...Waiting for Ctrl-C...";
2491 Orthanc::SystemToolbox::ServerBarrier(); 2711 Orthanc::SystemToolbox::ServerBarrier();
2492 //boost::this_thread::sleep(boost::posix_time::seconds(1)); 2712 //boost::this_thread::sleep(boost::posix_time::seconds(1));
2493 } 2713 }
2506 2726
2507 try 2727 try
2508 { 2728 {
2509 Refactoring::NativeApplicationContext context; 2729 Refactoring::NativeApplicationContext context;
2510 2730
2511 Refactoring::NativeOracle oracle(context); 2731 Refactoring::ThreadedOracle oracle(context);
2512 2732
2513 { 2733 {
2514 Orthanc::WebServiceParameters p; 2734 Orthanc::WebServiceParameters p;
2515 //p.SetUrl("http://localhost:8043/"); 2735 //p.SetUrl("http://localhost:8043/");
2516 p.SetCredentials("orthanc", "orthanc"); 2736 p.SetCredentials("orthanc", "orthanc");