Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Volumes/DicomVolumeImageMPRSlicer.h @ 1619:4c9e68291467
Added code to remove the wheel callback in dtor, to prevent access to dead object
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 02 Nov 2020 17:55:35 +0100 |
parents | 8563ea5d8ae4 |
children | 9ac2a65d4172 |
rev | line source |
---|---|
814 | 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:
1072
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
814 | 6 * |
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 |
814 | 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 | |
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/>. |
814 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "DicomVolumeImage.h" | |
26 #include "IVolumeSlicer.h" | |
27 | |
28 #include <boost/shared_ptr.hpp> | |
29 | |
30 namespace OrthancStone | |
31 { | |
32 /** | |
33 Implements the IVolumeSlicer on Dicom volume data when the cutting plane | |
34 that is supplied to the slicer is either axial, sagittal or coronal. | |
35 Arbitrary planes are *not* supported | |
36 */ | |
37 class DicomVolumeImageMPRSlicer : public IVolumeSlicer | |
38 { | |
39 public: | |
40 class Slice : public IExtractedSlice | |
41 { | |
42 private: | |
43 const DicomVolumeImage& volume_; | |
817
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
44 uint64_t revision_; |
814 | 45 bool valid_; |
46 VolumeProjection projection_; | |
47 unsigned int sliceIndex_; | |
48 | |
49 void CheckValid() const; | |
50 | |
51 public: | |
52 /** | |
53 Represents a slice of a volume image that is parallel to the | |
54 coordinate system axis. | |
55 The constructor initializes the type of projection (axial, sagittal or | |
56 coronal) and the corresponding slice index, from the cutting plane. | |
57 */ | |
58 Slice(const DicomVolumeImage& volume, | |
59 const CoordinateSystem3D& cuttingPlane); | |
60 | |
817
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
61 void SetRevision(uint64_t revision) |
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
62 { |
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
63 revision_ = revision; |
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
64 } |
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
65 |
814 | 66 VolumeProjection GetProjection() const; |
67 | |
68 unsigned int GetSliceIndex() const; | |
69 | |
70 virtual bool IsValid() | |
71 { | |
72 return valid_; | |
73 } | |
74 | |
817
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
75 virtual uint64_t GetRevision() |
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
76 { |
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
77 return revision_; |
68f888812af4
simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
814
diff
changeset
|
78 } |
814 | 79 |
80 virtual ISceneLayer* CreateSceneLayer(const ILayerStyleConfigurator* configurator, | |
81 const CoordinateSystem3D& cuttingPlane); | |
82 }; | |
83 | |
84 private: | |
85 boost::shared_ptr<DicomVolumeImage> volume_; | |
86 | |
87 public: | |
1571 | 88 explicit DicomVolumeImageMPRSlicer(const boost::shared_ptr<DicomVolumeImage>& volume) : |
814 | 89 volume_(volume) |
90 { | |
91 } | |
92 | |
1072
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
93 boost::shared_ptr<const DicomVolumeImage> GetVolume() const |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
94 { |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
95 return volume_; |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
96 } |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
97 |
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:
817
diff
changeset
|
98 virtual ~DicomVolumeImageMPRSlicer(); |
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:
817
diff
changeset
|
99 |
814 | 100 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE; |
101 }; | |
102 } |