annotate Framework/Deprecated/Toolbox/Slice.h @ 872:733c6db3e5a3 am-dev

limiting the size of the cache
author Alain Mazy <alain@mazy.be>
date Mon, 01 Jul 2019 13:36:51 +0200
parents c35e98d22764
children 2d8ab34c8c91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 389
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
732
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
24 #include "../../Toolbox/CoordinateSystem3D.h"
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "DicomFrameConverter.h"
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
212
5412adf19980 resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 201
diff changeset
27 #include <Core/DicomFormat/DicomImageInformation.h>
647
6af3099ed8da uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
28 #include <Core/IDynamicObject.h>
118
a4d0b6c82b29 using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
29
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
30 namespace Deprecated
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
648
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 647
diff changeset
32 // TODO - Remove this class
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 647
diff changeset
33 class Slice :
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 647
diff changeset
34 public Orthanc::IDynamicObject /* to be used as a payload of SlicesSorter */
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 private:
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 enum Type
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 Type_Invalid,
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
40 Type_Standalone,
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
41 Type_OrthancDecodableFrame,
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
42 Type_OrthancRawFrame
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 // TODO A slice could come from some DICOM file (URL)
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 };
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
118
a4d0b6c82b29 using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
46 bool ComputeRTDoseGeometry(const Orthanc::DicomMap& dataset,
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
47 unsigned int frame);
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
48
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 Type type_;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 std::string orthancInstanceId_;
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
51 std::string sopClassUid_;
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 unsigned int frame_;
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
53 unsigned int frameCount_; // TODO : Redundant with "imageInformation_"
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
54 OrthancStone::CoordinateSystem3D geometry_;
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 double pixelSpacingX_;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 double pixelSpacingY_;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 double thickness_;
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
58 unsigned int width_; // TODO : Redundant with "imageInformation_"
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
59 unsigned int height_; // TODO : Redundant with "imageInformation_"
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
60 DicomFrameConverter converter_; // TODO : Partially redundant with "imageInformation_"
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
61
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
62 std::auto_ptr<Orthanc::DicomImageInformation> imageInformation_;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
63
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 public:
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
65 Slice() :
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
66 type_(Type_Invalid)
322
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
67 {
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
68 }
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
69
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
70
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
71 // this constructor is used to reference, i.e, a slice that is being loaded
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
72 Slice(const std::string& orthancInstanceId,
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
73 unsigned int frame) :
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
74 type_(Type_Invalid),
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
75 orthancInstanceId_(orthancInstanceId),
a902a07769d4 wip: preload slice
am@osimis.io
parents: 318
diff changeset
76 frame_(frame)
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 }
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
80 // TODO Is this constructor the best way to go to tackle missing
389
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 322
diff changeset
81 // layers within SliceViewerWidget?
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
82 Slice(const OrthancStone::CoordinateSystem3D& plane,
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
83 double thickness) :
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
84 type_(Type_Standalone),
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
85 frame_(0),
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
86 frameCount_(0),
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
87 geometry_(plane),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
88 pixelSpacingX_(1),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
89 pixelSpacingY_(1),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
90 thickness_(thickness),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
91 width_(0),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
92 height_(0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
93 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
94 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
95
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
96 Slice(const OrthancStone::CoordinateSystem3D& plane,
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
97 double pixelSpacingX,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
98 double pixelSpacingY,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
99 double thickness,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
100 unsigned int width,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
101 unsigned int height,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
102 const DicomFrameConverter& converter) :
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
103 type_(Type_Standalone),
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
104 frameCount_(1),
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
105 geometry_(plane),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
106 pixelSpacingX_(pixelSpacingX),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
107 pixelSpacingY_(pixelSpacingY),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
108 thickness_(thickness),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
109 width_(width),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
110 height_(height),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
111 converter_(converter)
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
112 {
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
113 }
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
114
99
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
115 bool IsValid() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
116 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
117 return type_ != Type_Invalid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
118 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
119
118
a4d0b6c82b29 using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
120 bool ParseOrthancFrame(const Orthanc::DicomMap& dataset,
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 const std::string& instanceId,
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 unsigned int frame);
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
124 bool HasOrthancDecoding() const
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 {
117
42c05a3baee3 loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 110
diff changeset
126 return type_ == Type_OrthancDecodableFrame;
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 }
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 const std::string GetOrthancInstanceId() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 unsigned int GetFrame() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
133 const OrthancStone::CoordinateSystem3D& GetGeometry() const;
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 double GetThickness() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 double GetPixelSpacingX() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 double GetPixelSpacingY() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 unsigned int GetWidth() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 unsigned int GetHeight() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 const DicomFrameConverter& GetConverter() const;
77
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 73
diff changeset
146
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
147 bool ContainsPlane(const OrthancStone::CoordinateSystem3D& plane) const;
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
148
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
149 void GetExtent(std::vector<OrthancStone::Vector>& points) const;
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
150
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
151 const Orthanc::DicomImageInformation& GetImageInformation() const;
318
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 212
diff changeset
152
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 212
diff changeset
153 Slice* Clone() const;
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 };
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 }