Mercurial > hg > orthanc-stone
annotate Framework/Loaders/DicomStructureSetLoader.h @ 1293:f050391249f0
Merged changes from bugfix branch
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 21 Feb 2020 15:27:42 +0100 |
parents | 2d8ab34c8c91 |
children | 8a0a62189f46 |
rev | line source |
---|---|
815 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1030
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
815 | 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 | |
22 #pragma once | |
23 | |
24 #include "../Toolbox/DicomStructureSet.h" | |
25 #include "../Volumes/IVolumeSlicer.h" | |
26 #include "LoaderStateMachine.h" | |
27 | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
28 #include <vector> |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
29 |
815 | 30 namespace OrthancStone |
31 { | |
32 class DicomStructureSetLoader : | |
33 public LoaderStateMachine, | |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
34 public IVolumeSlicer, |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
35 public IObservable |
815 | 36 { |
37 private: | |
38 class Slice; | |
39 | |
40 // States of LoaderStateMachine | |
41 class AddReferencedInstance; // 3rd state | |
42 class LookupInstance; // 2nd state | |
43 class LoadStructure; // 1st state | |
44 | |
45 std::auto_ptr<DicomStructureSet> content_; | |
46 uint64_t revision_; | |
47 std::string instanceId_; | |
48 unsigned int countProcessedInstances_; | |
49 unsigned int countReferencedInstances_; | |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
50 |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
51 // will be set to true once the loading is finished |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
52 bool structuresReady_; |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
53 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
54 /** |
1030
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
55 At load time, these strings are used to initialize the structureVisibility_ |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
56 vector. |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
57 |
1030
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
58 As a special case, if initiallyVisibleStructures_ contains a single string |
7014c2397b45
Empty structureNames now means NOTHING will be (initially) displayed
Benjamin Golinvaux <bgo@osimis.io>
parents:
1019
diff
changeset
|
59 that is '*', ALL structures will be made visible. |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
60 */ |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
61 std::vector<std::string> initiallyVisibleStructures_; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
62 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
63 /** |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
64 Contains the "Should this structure be displayed?" flag for all structures. |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
65 Only filled when structures are loaded. |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
66 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
67 Changing this value directly affects the rendering |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
68 */ |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
69 std::vector<bool> structureVisibility_; |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
70 |
815 | 71 public: |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
72 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, StructuresReady, DicomStructureSetLoader); |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
73 |
815 | 74 DicomStructureSetLoader(IOracle& oracle, |
75 IObservable& oracleObservable); | |
76 | |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
77 DicomStructureSet* GetContent() |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
78 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
79 return content_.get(); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
80 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
81 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
82 void SetStructureDisplayState(size_t structureIndex, bool display); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
83 |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
84 bool GetStructureDisplayState(size_t structureIndex) const |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
85 { |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
86 return structureVisibility_.at(structureIndex); |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
87 } |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
88 |
935
401808e7ff2e
Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents:
815
diff
changeset
|
89 ~DicomStructureSetLoader(); |
401808e7ff2e
Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents:
815
diff
changeset
|
90 |
1019
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
91 void LoadInstance(const std::string& instanceId, |
29f5f2031310
Added a way to specificy which structures are to be initially displayed (the
Benjamin Golinvaux <bgo@osimis.io>
parents:
1000
diff
changeset
|
92 const std::vector<std::string>& initiallyVisibleStructures = std::vector<std::string>()); |
815 | 93 |
1000
50e5acf5553b
changed RTSTRUCT rendering from polygons to segments
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
94 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE; |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
95 |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
96 void SetStructuresReady(); |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
97 |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
98 bool AreStructuresReady() const; |
815 | 99 }; |
100 } |