annotate OrthancStone/Sources/Volumes/VolumeSceneLayerSource.h @ 1853:cbb5c4a66160

back to mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Jun 2021 16:29:37 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1640
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * <http://www.gnu.org/licenses/>.
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "../Scene2D/Scene2D.h"
1606
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
26 #include "../Viewport/IViewport.h"
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "IVolumeSlicer.h"
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <boost/shared_ptr.hpp>
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace OrthancStone
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
1433
8635b333fa5b [BREAKING] VolumeSceneLayerSource now locks the viewport properly before using the scene. The ctor now accepts the viewport instead of a ref. to the scene. RtViewer sample has been adapted accordingly.
Benjamin Golinvaux <bgo@osimis.io>
parents: 1345
diff changeset
33 class IViewport;
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 /**
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 This class applies one "volume slicer" to a "3D volume", in order
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 to create one "2D scene layer" that will be set onto the "2D
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 scene". The style of the layer can be fine-tuned using a "layer
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 style configurator". The class only changes the layer if the
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 cutting plane has been modified since the last call to "Update()".
921
81d30cd93b65 Ability to ask the loader for the geometry in PULL mode (when subscribing to the messages is not possible) + small changes (removed const/ref qualifiers for boost::shared_ptr param, added traces, doc change)
Benjamin Golinvaux <bgo@osimis.io>
parents: 815
diff changeset
40 */
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 class VolumeSceneLayerSource : public boost::noncopyable
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 private:
1640
52b8b96cb55f cleaning namespaces
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1606
diff changeset
44 boost::weak_ptr<IViewport> viewport_;
1311
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
45 int layerDepth_;
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
46 boost::shared_ptr<IVolumeSlicer> slicer_;
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
47 std::unique_ptr<ILayerStyleConfigurator> configurator_;
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
48 std::unique_ptr<CoordinateSystem3D> lastPlane_;
1311
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
49 uint64_t lastRevision_;
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
50 uint64_t lastConfiguratorRevision_;
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 void ClearLayer();
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
1606
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
54 /**
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
55 This will return a scoped lock to the viewport.
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
56 If the viewport does not exist anymore, then nullptr is returned.
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
57 */
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
58 IViewport::ILock* GetViewportLock();
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
59 IViewport::ILock* GetViewportLock() const;
874e178f34e9 - ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents: 1598
diff changeset
60
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 public:
1640
52b8b96cb55f cleaning namespaces
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1606
diff changeset
62 VolumeSceneLayerSource(boost::weak_ptr<IViewport> viewport,
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 int layerDepth,
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 const boost::shared_ptr<IVolumeSlicer>& slicer);
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
934
094d10ed7ec2 VolumeSceneLayerSource dtor now clears the layer
Benjamin Golinvaux <bgo@osimis.io>
parents: 921
diff changeset
66 ~VolumeSceneLayerSource();
094d10ed7ec2 VolumeSceneLayerSource dtor now clears the layer
Benjamin Golinvaux <bgo@osimis.io>
parents: 921
diff changeset
67
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 const IVolumeSlicer& GetSlicer() const
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return *slicer_;
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 void RemoveConfigurator();
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 void SetConfigurator(ILayerStyleConfigurator* configurator);
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 bool HasConfigurator() const
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 return configurator_.get() != NULL;
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 }
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 ILayerStyleConfigurator& GetConfigurator() const;
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
1311
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
84 /**
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
85 Make sure the Scene2D is protected from concurrent accesses before
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
86 calling this method.
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
87
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
88 If the scene that has been supplied to the ctor is part of an IViewport,
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
89 you can lock the whole viewport data (including scene) by means of the
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
90 IViewport::Lock method.
3d26447ddd28 warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents: 1298
diff changeset
91 */
1345
0d6a01ffa1dd Clean version of the hack commited in
Benjamin Golinvaux <bgo@osimis.io>
parents: 1344
diff changeset
92 void Update(const CoordinateSystem3D& plane);
815
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 };
df442f1ba0c6 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 }