Mercurial > hg > orthanc-stone
comparison Framework/Deprecated/Loaders/DicomStructureSetLoader2.cpp @ 1225:16738485e457 broker
deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 08 Dec 2019 11:45:09 +0100 |
parents | Framework/Loaders/DicomStructureSetLoader2.cpp@29f5f2031310 |
children | 0ca50d275b9a |
comparison
equal
deleted
inserted
replaced
1224:37bc7f115f81 | 1225:16738485e457 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
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. | |
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 | |
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 | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 #ifdef BGO_ENABLE_DICOMSTRUCTURESETLOADER2 | |
22 | |
23 #include "DicomStructureSetLoader2.h" | |
24 | |
25 #include "../Messages/IObservable.h" | |
26 #include "../Oracle/IOracle.h" | |
27 #include "../Oracle/OracleCommandExceptionMessage.h" | |
28 | |
29 namespace Deprecated | |
30 { | |
31 | |
32 DicomStructureSetLoader2::DicomStructureSetLoader2( | |
33 DicomStructureSet2& structureSet | |
34 , IOracle& oracle | |
35 , IObservable& oracleObservable) | |
36 : IObserver(oracleObservable.GetBroker()) | |
37 , IObservable(oracleObservable.GetBroker()) | |
38 , structureSet_(structureSet) | |
39 , oracle_(oracle) | |
40 , oracleObservable_(oracleObservable) | |
41 , structuresReady_(false) | |
42 { | |
43 LOG(TRACE) << "DicomStructureSetLoader2(" << std::hex << this << std::dec << ")::DicomStructureSetLoader2()"; | |
44 | |
45 oracleObservable.RegisterObserverCallback( | |
46 new Callable<DicomStructureSetLoader2, OrthancRestApiCommand::SuccessMessage> | |
47 (*this, &DicomStructureSetLoader2::HandleSuccessMessage)); | |
48 | |
49 oracleObservable.RegisterObserverCallback( | |
50 new Callable<DicomStructureSetLoader2, OracleCommandExceptionMessage> | |
51 (*this, &DicomStructureSetLoader2::HandleExceptionMessage)); | |
52 } | |
53 | |
54 DicomStructureSetLoader2::~DicomStructureSetLoader2() | |
55 { | |
56 LOG(TRACE) << "DicomStructureSetLoader2(" << std::hex << this << std::dec << ")::~DicomStructureSetLoader2()"; | |
57 oracleObservable_.Unregister(this); | |
58 } | |
59 | |
60 void DicomStructureSetLoader2::LoadInstanceFromString(const std::string& body) | |
61 { | |
62 OrthancPlugins::FullOrthancDataset dicom(body); | |
63 //loader.content_.reset(new DicomStructureSet(dicom)); | |
64 structureSet_.Clear(); | |
65 structureSet_.SetContents(dicom); | |
66 SetStructuresReady(); | |
67 } | |
68 | |
69 void DicomStructureSetLoader2::HandleSuccessMessage(const OrthancRestApiCommand::SuccessMessage& message) | |
70 { | |
71 const std::string& body = message.GetAnswer(); | |
72 LoadInstanceFromString(body); | |
73 } | |
74 | |
75 void DicomStructureSetLoader2::HandleExceptionMessage(const OracleCommandExceptionMessage& message) | |
76 { | |
77 LOG(ERROR) << "DicomStructureSetLoader2::HandleExceptionMessage: error when trying to load data. " | |
78 << "Error: " << message.GetException().What() << " Details: " | |
79 << message.GetException().GetDetails(); | |
80 } | |
81 | |
82 void DicomStructureSetLoader2::LoadInstance(const std::string& instanceId) | |
83 { | |
84 std::auto_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); | |
85 command->SetHttpHeader("Accept-Encoding", "gzip"); | |
86 | |
87 std::string uri = "/instances/" + instanceId + "/tags?ignore-length=3006-0050"; | |
88 | |
89 command->SetUri(uri); | |
90 oracle_.Schedule(*this, command.release()); | |
91 } | |
92 | |
93 void DicomStructureSetLoader2::SetStructuresReady() | |
94 { | |
95 structuresReady_ = true; | |
96 } | |
97 | |
98 bool DicomStructureSetLoader2::AreStructuresReady() const | |
99 { | |
100 return structuresReady_; | |
101 } | |
102 | |
103 /* | |
104 | |
105 void LoaderStateMachine::HandleExceptionMessage(const OracleCommandExceptionMessage& message) | |
106 { | |
107 LOG(ERROR) << "LoaderStateMachine::HandleExceptionMessage: error in the state machine, stopping all processing"; | |
108 LOG(ERROR) << "Error: " << message.GetException().What() << " Details: " << | |
109 message.GetException().GetDetails(); | |
110 Clear(); | |
111 } | |
112 | |
113 LoaderStateMachine::~LoaderStateMachine() | |
114 { | |
115 Clear(); | |
116 } | |
117 | |
118 | |
119 */ | |
120 | |
121 } | |
122 | |
123 #endif | |
124 // BGO_ENABLE_DICOMSTRUCTURESETLOADER2 | |
125 |