comparison Framework/Radiography/RadiographyScene.h @ 430:b85f635f1eb5 am-vsol-upgrade

added serialization for RadiographyScene
author am@osimis.io
date Thu, 29 Nov 2018 15:11:19 +0100
parents 3f9017db1738
children 4eb96c6b4e96
comparison
equal deleted inserted replaced
429:c7fb700a7d12 430:b85f635f1eb5
30 class RadiographyScene : 30 class RadiographyScene :
31 public IObserver, 31 public IObserver,
32 public IObservable 32 public IObservable
33 { 33 {
34 public: 34 public:
35 typedef OriginMessage<MessageType_Widget_GeometryChanged, RadiographyScene> GeometryChangedMessage; 35 class GeometryChangedMessage :
36 typedef OriginMessage<MessageType_Widget_ContentChanged, RadiographyScene> ContentChangedMessage; 36 public OriginMessage<MessageType_Scene_GeometryChanged, RadiographyScene>
37 {
38 private:
39 RadiographyLayer& layer_;
40
41 public:
42 GeometryChangedMessage(const RadiographyScene& origin,
43 RadiographyLayer& layer) :
44 OriginMessage(origin),
45 layer_(layer)
46 {
47 }
48
49 RadiographyLayer& GetLayer() const
50 {
51 return layer_;
52 }
53 };
54
55 class ContentChangedMessage :
56 public OriginMessage<MessageType_Scene_ContentChanged, RadiographyScene>
57 {
58 private:
59 RadiographyLayer& layer_;
60
61 public:
62 ContentChangedMessage(const RadiographyScene& origin,
63 RadiographyLayer& layer) :
64 OriginMessage(origin),
65 layer_(layer)
66 {
67 }
68
69 RadiographyLayer& GetLayer() const
70 {
71 return layer_;
72 }
73 };
74
37 75
38 class LayerAccessor : public boost::noncopyable 76 class LayerAccessor : public boost::noncopyable
39 { 77 {
40 private: 78 private:
41 RadiographyScene& scene_; 79 RadiographyScene& scene_;
67 RadiographyLayer& GetLayer() const; 105 RadiographyLayer& GetLayer() const;
68 }; 106 };
69 107
70 108
71 private: 109 private:
72 class AlphaLayer;
73 class DicomLayer;
74
75 typedef std::map<size_t, RadiographyLayer*> Layers; 110 typedef std::map<size_t, RadiographyLayer*> Layers;
76 111
77 size_t countLayers_; 112 size_t countLayers_;
78 bool hasWindowing_; 113 bool hasWindowing_;
79 float windowingCenter_; 114 float windowingCenter_;
103 138
104 void SetWindowing(float center, 139 void SetWindowing(float center,
105 float width); 140 float width);
106 141
107 RadiographyLayer& LoadText(const Orthanc::Font& font, 142 RadiographyLayer& LoadText(const Orthanc::Font& font,
108 const std::string& utf8); 143 const std::string& utf8,
144 RadiographyLayer::Geometry* geometry);
109 145
110 RadiographyLayer& LoadTestBlock(unsigned int width, 146 RadiographyLayer& LoadTestBlock(unsigned int width,
111 unsigned int height); 147 unsigned int height,
112 148 RadiographyLayer::Geometry* geometry);
149
150 RadiographyLayer& LoadAlphaBitmap(Orthanc::ImageAccessor* bitmap, // takes ownership
151 RadiographyLayer::Geometry* geometry);
152
113 RadiographyLayer& LoadDicomFrame(OrthancApiClient& orthanc, 153 RadiographyLayer& LoadDicomFrame(OrthancApiClient& orthanc,
114 const std::string& instance, 154 const std::string& instance,
115 unsigned int frame, 155 unsigned int frame,
116 bool httpCompression); 156 bool httpCompression,
157 RadiographyLayer::Geometry* geometry); // pass NULL if you want default geometry
117 158
118 RadiographyLayer& LoadDicomWebFrame(IWebService& web); 159 RadiographyLayer& LoadDicomWebFrame(IWebService& web);
119 160
120 void RemoveLayer(size_t layerIndex); 161 void RemoveLayer(size_t layerIndex);
121 162
122 size_t GetLayerCount() 163 const RadiographyLayer& GetLayer(size_t layerIndex) const;
123 { 164
124 return countLayers_; 165 void GetLayersIndexes(std::vector<size_t>& output) const;
125 }
126
127 RadiographyLayer& GetLayer(size_t layerIndex);
128 166
129 Extent2D GetSceneExtent() const; 167 Extent2D GetSceneExtent() const;
130 168
131 void Render(Orthanc::ImageAccessor& buffer, 169 void Render(Orthanc::ImageAccessor& buffer,
132 const AffineTransform2D& viewTransform, 170 const AffineTransform2D& viewTransform,
153 bool invert, 191 bool invert,
154 ImageInterpolation interpolation, 192 ImageInterpolation interpolation,
155 bool usePam); 193 bool usePam);
156 194
157 // temporary version used by VSOL because we need to send the same request at another url 195 // temporary version used by VSOL because we need to send the same request at another url
158 void Export(Json::Value& createDicomRequestContent, 196 void ExportToCreateDicomRequest(Json::Value& createDicomRequestContent,
159 const Orthanc::DicomMap& dicom, 197 const Orthanc::DicomMap& dicom,
160 double pixelSpacingX, 198 double pixelSpacingX,
161 double pixelSpacingY, 199 double pixelSpacingY,
162 bool invert, 200 bool invert,
163 ImageInterpolation interpolation, 201 ImageInterpolation interpolation,