Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/Slice.h @ 456:b70fcc134ba4
moved LambdaCallable (currently still disable because it does not work in WASM)
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 23 Jan 2019 13:58:51 +0100 |
parents | b70e9be013e4 |
children | 6af3099ed8da |
rev | line source |
---|---|
73 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
439 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
73 | 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 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
24 #include "CoordinateSystem3D.h" |
73 | 25 #include "DicomFrameConverter.h" |
26 | |
212
5412adf19980
resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
27 #include <Core/DicomFormat/DicomImageInformation.h> |
118
a4d0b6c82b29
using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
28 |
73 | 29 namespace OrthancStone |
30 { | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
31 class Slice : public boost::noncopyable |
73 | 32 { |
33 private: | |
34 enum Type | |
35 { | |
36 Type_Invalid, | |
102 | 37 Type_Standalone, |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
38 Type_OrthancDecodableFrame, |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
39 Type_OrthancRawFrame |
73 | 40 // TODO A slice could come from some DICOM file (URL) |
41 }; | |
42 | |
118
a4d0b6c82b29
using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
43 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
|
44 unsigned int frame); |
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
45 |
73 | 46 Type type_; |
47 std::string orthancInstanceId_; | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
48 std::string sopClassUid_; |
73 | 49 unsigned int frame_; |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
50 unsigned int frameCount_; // TODO : Redundant with "imageInformation_" |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
51 CoordinateSystem3D geometry_; |
73 | 52 double pixelSpacingX_; |
53 double pixelSpacingY_; | |
54 double thickness_; | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
55 unsigned int width_; // TODO : Redundant with "imageInformation_" |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
56 unsigned int height_; // TODO : Redundant with "imageInformation_" |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
57 DicomFrameConverter converter_; // TODO : Partially redundant with "imageInformation_" |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
58 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
59 std::auto_ptr<Orthanc::DicomImageInformation> imageInformation_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
60 |
73 | 61 public: |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
62 Slice() : |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
63 type_(Type_Invalid) |
322 | 64 { |
65 } | |
66 | |
67 | |
68 // this constructor is used to reference, i.e, a slice that is being loaded | |
69 Slice(const std::string& orthancInstanceId, | |
70 unsigned int frame) : | |
71 type_(Type_Invalid), | |
72 orthancInstanceId_(orthancInstanceId), | |
73 frame_(frame) | |
73 | 74 { |
75 } | |
76 | |
85 | 77 // TODO Is this constructor the best way to go to tackle missing |
389 | 78 // layers within SliceViewerWidget? |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
79 Slice(const CoordinateSystem3D& plane, |
85 | 80 double thickness) : |
102 | 81 type_(Type_Standalone), |
85 | 82 frame_(0), |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
83 frameCount_(0), |
85 | 84 geometry_(plane), |
85 pixelSpacingX_(1), | |
86 pixelSpacingY_(1), | |
87 thickness_(thickness), | |
88 width_(0), | |
89 height_(0) | |
90 { | |
91 } | |
92 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
93 Slice(const CoordinateSystem3D& plane, |
102 | 94 double pixelSpacingX, |
95 double pixelSpacingY, | |
96 double thickness, | |
97 unsigned int width, | |
98 unsigned int height, | |
99 const DicomFrameConverter& converter) : | |
100 type_(Type_Standalone), | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
101 frameCount_(1), |
102 | 102 geometry_(plane), |
103 pixelSpacingX_(pixelSpacingX), | |
104 pixelSpacingY_(pixelSpacingY), | |
105 thickness_(thickness), | |
106 width_(width), | |
107 height_(height), | |
108 converter_(converter) | |
109 { | |
110 } | |
111 | |
99 | 112 bool IsValid() const |
113 { | |
114 return type_ != Type_Invalid; | |
115 } | |
116 | |
118
a4d0b6c82b29
using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
117 bool ParseOrthancFrame(const Orthanc::DicomMap& dataset, |
73 | 118 const std::string& instanceId, |
119 unsigned int frame); | |
120 | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
121 bool HasOrthancDecoding() const |
73 | 122 { |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
123 return type_ == Type_OrthancDecodableFrame; |
73 | 124 } |
125 | |
126 const std::string GetOrthancInstanceId() const; | |
127 | |
128 unsigned int GetFrame() const; | |
129 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
130 const CoordinateSystem3D& GetGeometry() const; |
73 | 131 |
132 double GetThickness() const; | |
133 | |
134 double GetPixelSpacingX() const; | |
135 | |
136 double GetPixelSpacingY() const; | |
137 | |
138 unsigned int GetWidth() const; | |
139 | |
140 unsigned int GetHeight() const; | |
141 | |
142 const DicomFrameConverter& GetConverter() const; | |
77 | 143 |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
144 bool ContainsPlane(const CoordinateSystem3D& plane) const; |
102 | 145 |
146 void GetExtent(std::vector<Vector>& points) const; | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
147 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
148 const Orthanc::DicomImageInformation& GetImageInformation() const; |
318
3a4ca166fafa
ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents:
212
diff
changeset
|
149 |
3a4ca166fafa
ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents:
212
diff
changeset
|
150 Slice* Clone() const; |
73 | 151 }; |
152 } |