comparison Framework/Loaders/DicomStructureSetLoader2.h @ 998:38b6bb0bdd72

added a new set of classes that correctly handle non-convex polygons (not used yet because of limitations in coordinates computing): DicomStructure2, DicomStructureSet2, DicomStructurePolygon2, DicomStructureSetSlicer2. Too many shortcuts have been taken when computing the actual position.
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 20 Sep 2019 11:58:00 +0200
parents d225bccd4d4a
children 29f5f2031310
comparison
equal deleted inserted replaced
995:9893fa8cd7a6 998:38b6bb0bdd72
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 #pragma once
22
23 #include "../Toolbox/DicomStructureSet2.h"
24 #include "../Messages/IMessage.h"
25 #include "../Messages/IObserver.h"
26 #include "../Messages/IObservable.h"
27 #include "../Oracle/OrthancRestApiCommand.h"
28
29 #include <boost/noncopyable.hpp>
30
31 namespace OrthancStone
32 {
33 class IOracle;
34 class IObservable;
35 class OrthancRestApiCommand;
36 class OracleCommandExceptionMessage;
37
38 class DicomStructureSetLoader2 : public IObserver, public IObservable
39 {
40 public:
41 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, StructuresReady, DicomStructureSetLoader2);
42
43 /**
44 Warning: the structureSet, oracle and oracleObservable objects must live
45 at least as long as this object (TODO: shared_ptr?)
46 */
47 DicomStructureSetLoader2(DicomStructureSet2& structureSet, IOracle& oracle, IObservable& oracleObservable);
48
49 ~DicomStructureSetLoader2();
50
51 void LoadInstance(const std::string& instanceId);
52
53 /** Internal use */
54 void LoadInstanceFromString(const std::string& body);
55
56 void SetStructuresReady();
57 bool AreStructuresReady() const;
58
59 private:
60 /**
61 Called back by the oracle when data is ready!
62 */
63 void HandleSuccessMessage(const OrthancRestApiCommand::SuccessMessage& message);
64
65 /**
66 Called back by the oracle when shit hits the fan
67 */
68 void HandleExceptionMessage(const OracleCommandExceptionMessage& message);
69
70 /**
71 The structure set that will be (cleared and) filled with data from the
72 loader
73 */
74 DicomStructureSet2& structureSet_;
75
76 IOracle& oracle_;
77 IObservable& oracleObservable_;
78 bool structuresReady_;
79 };
80 }