Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographySceneReader.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 | 8f7220433b59 |
children | aede9b042cb7 |
comparison
equal
deleted
inserted
replaced
480:2f6ecb5037ea | 481:159a465e27bd |
---|---|
33 unsigned int version = input["version"].asUInt(); | 33 unsigned int version = input["version"].asUInt(); |
34 | 34 |
35 if (version != 1) | 35 if (version != 1) |
36 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | 36 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
37 | 37 |
38 RadiographyDicomLayer* dicomLayer = NULL; | |
38 for(size_t layerIndex = 0; layerIndex < input["layers"].size(); layerIndex++) | 39 for(size_t layerIndex = 0; layerIndex < input["layers"].size(); layerIndex++) |
39 { | 40 { |
40 const Json::Value& jsonLayer = input["layers"][(int)layerIndex]; | 41 const Json::Value& jsonLayer = input["layers"][(int)layerIndex]; |
41 RadiographyLayer::Geometry geometry; | 42 RadiographyLayer::Geometry geometry; |
42 | 43 |
43 if (jsonLayer["type"].asString() == "dicom") | 44 if (jsonLayer["type"].asString() == "dicom") |
44 { | 45 { |
45 ReadLayerGeometry(geometry, jsonLayer); | 46 ReadLayerGeometry(geometry, jsonLayer); |
46 scene_.LoadDicomFrame(orthancApiClient_, jsonLayer["instanceId"].asString(), jsonLayer["frame"].asUInt(), false, &geometry); | 47 dicomLayer = dynamic_cast<RadiographyDicomLayer*>(&(scene_.LoadDicomFrame(orthancApiClient_, jsonLayer["instanceId"].asString(), jsonLayer["frame"].asUInt(), false, &geometry))); |
48 } | |
49 else if (jsonLayer["type"].asString() == "mask") | |
50 { | |
51 if (dicomLayer == NULL) | |
52 { | |
53 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); // we always assumed the dicom layer was read before the mask | |
54 } | |
55 ReadLayerGeometry(geometry, jsonLayer); | |
56 | |
57 float foreground = jsonLayer["foreground"].asFloat(); | |
58 std::vector<MaskPoint> corners; | |
59 for (size_t i = 0; i < jsonLayer["corners"].size(); i++) | |
60 { | |
61 MaskPoint corner(jsonLayer["corners"][(int)i]["x"].asUInt(), | |
62 jsonLayer["corners"][(int)i]["y"].asUInt()); | |
63 corners.push_back(corner); | |
64 } | |
65 | |
66 scene_.LoadMask(corners, *dicomLayer, foreground, &geometry); | |
47 } | 67 } |
48 else if (jsonLayer["type"].asString() == "text") | 68 else if (jsonLayer["type"].asString() == "text") |
49 { | 69 { |
50 if (fontRegistry_ == NULL || fontRegistry_->GetSize() == 0) | 70 if (fontRegistry_ == NULL || fontRegistry_->GetSize() == 0) |
51 { | 71 { |