comparison Framework/Deprecated/Toolbox/Slice.h @ 732:c35e98d22764

move Deprecated classes to a separate folder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 May 2019 14:27:35 +0200
parents Framework/Toolbox/Slice.h@d2c0e347ddc2
children 2d8ab34c8c91
comparison
equal deleted inserted replaced
729:529189f399ec 732:c35e98d22764
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
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
24 #include "../../Toolbox/CoordinateSystem3D.h"
25 #include "DicomFrameConverter.h"
26
27 #include <Core/DicomFormat/DicomImageInformation.h>
28 #include <Core/IDynamicObject.h>
29
30 namespace Deprecated
31 {
32 // TODO - Remove this class
33 class Slice :
34 public Orthanc::IDynamicObject /* to be used as a payload of SlicesSorter */
35 {
36 private:
37 enum Type
38 {
39 Type_Invalid,
40 Type_Standalone,
41 Type_OrthancDecodableFrame,
42 Type_OrthancRawFrame
43 // TODO A slice could come from some DICOM file (URL)
44 };
45
46 bool ComputeRTDoseGeometry(const Orthanc::DicomMap& dataset,
47 unsigned int frame);
48
49 Type type_;
50 std::string orthancInstanceId_;
51 std::string sopClassUid_;
52 unsigned int frame_;
53 unsigned int frameCount_; // TODO : Redundant with "imageInformation_"
54 OrthancStone::CoordinateSystem3D geometry_;
55 double pixelSpacingX_;
56 double pixelSpacingY_;
57 double thickness_;
58 unsigned int width_; // TODO : Redundant with "imageInformation_"
59 unsigned int height_; // TODO : Redundant with "imageInformation_"
60 DicomFrameConverter converter_; // TODO : Partially redundant with "imageInformation_"
61
62 std::auto_ptr<Orthanc::DicomImageInformation> imageInformation_;
63
64 public:
65 Slice() :
66 type_(Type_Invalid)
67 {
68 }
69
70
71 // this constructor is used to reference, i.e, a slice that is being loaded
72 Slice(const std::string& orthancInstanceId,
73 unsigned int frame) :
74 type_(Type_Invalid),
75 orthancInstanceId_(orthancInstanceId),
76 frame_(frame)
77 {
78 }
79
80 // TODO Is this constructor the best way to go to tackle missing
81 // layers within SliceViewerWidget?
82 Slice(const OrthancStone::CoordinateSystem3D& plane,
83 double thickness) :
84 type_(Type_Standalone),
85 frame_(0),
86 frameCount_(0),
87 geometry_(plane),
88 pixelSpacingX_(1),
89 pixelSpacingY_(1),
90 thickness_(thickness),
91 width_(0),
92 height_(0)
93 {
94 }
95
96 Slice(const OrthancStone::CoordinateSystem3D& plane,
97 double pixelSpacingX,
98 double pixelSpacingY,
99 double thickness,
100 unsigned int width,
101 unsigned int height,
102 const DicomFrameConverter& converter) :
103 type_(Type_Standalone),
104 frameCount_(1),
105 geometry_(plane),
106 pixelSpacingX_(pixelSpacingX),
107 pixelSpacingY_(pixelSpacingY),
108 thickness_(thickness),
109 width_(width),
110 height_(height),
111 converter_(converter)
112 {
113 }
114
115 bool IsValid() const
116 {
117 return type_ != Type_Invalid;
118 }
119
120 bool ParseOrthancFrame(const Orthanc::DicomMap& dataset,
121 const std::string& instanceId,
122 unsigned int frame);
123
124 bool HasOrthancDecoding() const
125 {
126 return type_ == Type_OrthancDecodableFrame;
127 }
128
129 const std::string GetOrthancInstanceId() const;
130
131 unsigned int GetFrame() const;
132
133 const OrthancStone::CoordinateSystem3D& GetGeometry() const;
134
135 double GetThickness() const;
136
137 double GetPixelSpacingX() const;
138
139 double GetPixelSpacingY() const;
140
141 unsigned int GetWidth() const;
142
143 unsigned int GetHeight() const;
144
145 const DicomFrameConverter& GetConverter() const;
146
147 bool ContainsPlane(const OrthancStone::CoordinateSystem3D& plane) const;
148
149 void GetExtent(std::vector<OrthancStone::Vector>& points) const;
150
151 const Orthanc::DicomImageInformation& GetImageInformation() const;
152
153 Slice* Clone() const;
154 };
155 }