annotate Framework/Toolbox/Slice.h @ 371:fe4befe03935

integration legacy->default
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Nov 2018 10:04:56 +0100
parents 5412adf19980
children 3a4ca166fafa
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
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
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
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
24 #include "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>
118
a4d0b6c82b29 using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
28
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace OrthancStone
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 118
diff changeset
31 class Slice : public boost::noncopyable
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 private:
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 enum Type
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 Type_Invalid,
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 // TODO A slice could come from some DICOM file (URL)
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 };
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 Type type_;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 double pixelSpacingX_;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 double pixelSpacingY_;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
67 // TODO Is this constructor the best way to go to tackle missing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
70 double thickness) :
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
71 type_(Type_Standalone),
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
74 geometry_(plane),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
75 pixelSpacingX_(1),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
76 pixelSpacingY_(1),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
77 thickness_(thickness),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
78 width_(0),
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
79 height_(0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
80 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
81 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
82
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
83 Slice(const CoordinateSystem3D& plane,
102
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
84 double pixelSpacingX,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
85 double pixelSpacingY,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
86 double thickness,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
87 unsigned int width,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
88 unsigned int height,
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
89 const DicomFrameConverter& converter) :
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
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
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
92 geometry_(plane),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
93 pixelSpacingX_(pixelSpacingX),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
94 pixelSpacingY_(pixelSpacingY),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
95 thickness_(thickness),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
96 width_(width),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
97 height_(height),
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
98 converter_(converter)
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
99 {
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
100 }
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
101
99
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
102 bool IsValid() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
103 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
104 return type_ != Type_Invalid;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
105 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 89
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 const std::string& instanceId,
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 unsigned int frame);
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 const std::string GetOrthancInstanceId() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 unsigned int GetFrame() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
120 const CoordinateSystem3D& GetGeometry() const;
73
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 double GetThickness() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 double GetPixelSpacingX() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 double GetPixelSpacingY() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 unsigned int GetWidth() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 unsigned int GetHeight() const;
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 const DicomFrameConverter& GetConverter() const;
77
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 73
diff changeset
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
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
135
fcec0ab44054 display volumes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 99
diff changeset
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
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 };
ffa6dded91bd reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 }