Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/Slice.h @ 260:c887eddd48f1 am-2
merge
author | am@osimis.io |
---|---|
date | Tue, 17 Jul 2018 14:43:42 +0200 |
parents | 5412adf19980 |
children | 3a4ca166fafa |
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 | |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
5 * Copyright (C) 2017-2018 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) |
73 | 64 { |
65 } | |
66 | |
85 | 67 // TODO Is this constructor the best way to go to tackle missing |
68 // layers within LayerWidget? | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
69 Slice(const CoordinateSystem3D& plane, |
85 | 70 double thickness) : |
102 | 71 type_(Type_Standalone), |
85 | 72 frame_(0), |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
73 frameCount_(0), |
85 | 74 geometry_(plane), |
75 pixelSpacingX_(1), | |
76 pixelSpacingY_(1), | |
77 thickness_(thickness), | |
78 width_(0), | |
79 height_(0) | |
80 { | |
81 } | |
82 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
83 Slice(const CoordinateSystem3D& plane, |
102 | 84 double pixelSpacingX, |
85 double pixelSpacingY, | |
86 double thickness, | |
87 unsigned int width, | |
88 unsigned int height, | |
89 const DicomFrameConverter& converter) : | |
90 type_(Type_Standalone), | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
91 frameCount_(1), |
102 | 92 geometry_(plane), |
93 pixelSpacingX_(pixelSpacingX), | |
94 pixelSpacingY_(pixelSpacingY), | |
95 thickness_(thickness), | |
96 width_(width), | |
97 height_(height), | |
98 converter_(converter) | |
99 { | |
100 } | |
101 | |
99 | 102 bool IsValid() const |
103 { | |
104 return type_ != Type_Invalid; | |
105 } | |
106 | |
118
a4d0b6c82b29
using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
117
diff
changeset
|
107 bool ParseOrthancFrame(const Orthanc::DicomMap& dataset, |
73 | 108 const std::string& instanceId, |
109 unsigned int frame); | |
110 | |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
111 bool HasOrthancDecoding() const |
73 | 112 { |
117
42c05a3baee3
loading multi-frame instances as 3D volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
113 return type_ == Type_OrthancDecodableFrame; |
73 | 114 } |
115 | |
116 const std::string GetOrthancInstanceId() const; | |
117 | |
118 unsigned int GetFrame() const; | |
119 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
120 const CoordinateSystem3D& GetGeometry() const; |
73 | 121 |
122 double GetThickness() const; | |
123 | |
124 double GetPixelSpacingX() const; | |
125 | |
126 double GetPixelSpacingY() const; | |
127 | |
128 unsigned int GetWidth() const; | |
129 | |
130 unsigned int GetHeight() const; | |
131 | |
132 const DicomFrameConverter& GetConverter() const; | |
77 | 133 |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
134 bool ContainsPlane(const CoordinateSystem3D& plane) const; |
102 | 135 |
136 void GetExtent(std::vector<Vector>& points) const; | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
137 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
138 const Orthanc::DicomImageInformation& GetImageInformation() const; |
73 | 139 }; |
140 } |