comparison Framework/Radiography/RadiographySceneWriter.cpp @ 481:159a465e27bd am-touch-events

reworked RadiographyScene export to export to an Orthanc::Image too
author am@osimis.io
date Thu, 14 Feb 2019 16:23:59 +0100
parents b85f635f1eb5
children aede9b042cb7
comparison
equal deleted inserted replaced
480:2f6ecb5037ea 481:159a465e27bd
53 void RadiographySceneWriter::WriteLayer(Json::Value& output, const RadiographyTextLayer& layer) 53 void RadiographySceneWriter::WriteLayer(Json::Value& output, const RadiographyTextLayer& layer)
54 { 54 {
55 output["type"] = "text"; 55 output["type"] = "text";
56 output["text"] = layer.GetText(); 56 output["text"] = layer.GetText();
57 output["fontName"] = layer.GetFontName(); 57 output["fontName"] = layer.GetFontName();
58 }
59
60 void RadiographySceneWriter::WriteLayer(Json::Value& output, const RadiographyMaskLayer& layer)
61 {
62 output["type"] = "mask";
63 output["instanceId"] = layer.GetInstanceId(); // the dicom layer it's being linked to
64 output["foreground"] = layer.GetForeground();
65 output["corners"] = Json::arrayValue;
66 const std::vector<MaskPoint>& corners = layer.GetCorners();
67 for (size_t i = 0; i < corners.size(); i++)
68 {
69 Json::Value corner;
70 corner["x"] = corners[i].x;
71 corner["y"] = corners[i].y;
72 output["corners"].append(corner);
73 }
58 } 74 }
59 75
60 void RadiographySceneWriter::WriteLayer(Json::Value& output, const RadiographyAlphaLayer& layer) 76 void RadiographySceneWriter::WriteLayer(Json::Value& output, const RadiographyAlphaLayer& layer)
61 { 77 {
62 output["type"] = "alpha"; 78 output["type"] = "alpha";
126 } 142 }
127 else if (dynamic_cast<const RadiographyAlphaLayer*>(&layer) != NULL) 143 else if (dynamic_cast<const RadiographyAlphaLayer*>(&layer) != NULL)
128 { 144 {
129 WriteLayer(output, dynamic_cast<const RadiographyAlphaLayer&>(layer)); 145 WriteLayer(output, dynamic_cast<const RadiographyAlphaLayer&>(layer));
130 } 146 }
147 else if (dynamic_cast<const RadiographyMaskLayer*>(&layer) != NULL)
148 {
149 WriteLayer(output, dynamic_cast<const RadiographyMaskLayer&>(layer));
150 }
131 else 151 else
132 { 152 {
133 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); 153 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
134 } 154 }
135 } 155 }