comparison Sources/Plugin.cpp @ 2:2bdb9acb7dcf

added STL viewer button at instance level too
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Jul 2023 09:41:31 +0200
parents 0f03a8a0bd6f
children 0fb06c6a6c87
comparison
equal deleted inserted replaced
1:0f03a8a0bd6f 2:2bdb9acb7dcf
1210 create[KEY_TAGS] = body[KEY_TAGS]; 1210 create[KEY_TAGS] = body[KEY_TAGS];
1211 } 1211 }
1212 else 1212 else
1213 { 1213 {
1214 std::string description; 1214 std::string description;
1215
1216 if (parsed.GetTagValue(description, Orthanc::DICOM_TAG_SERIES_DESCRIPTION))
1217 {
1218 description += ": ";
1219 }
1220 else
1221 {
1222 description.clear();
1223 }
1224
1225 bool first = true;
1215 for (std::set<std::string>::const_iterator it = roiNames.begin(); it != roiNames.end(); ++it) 1226 for (std::set<std::string>::const_iterator it = roiNames.begin(); it != roiNames.end(); ++it)
1216 { 1227 {
1217 if (!description.empty()) 1228 if (first)
1229 {
1230 first = false;
1231 }
1232 else
1218 { 1233 {
1219 description += ", "; 1234 description += ", ";
1220 } 1235 }
1221 1236
1222 description += *it; 1237 description += *it;
1277 } 1292 }
1278 1293
1279 OrthancPluginSetDescription(context, "STL plugin for Orthanc."); 1294 OrthancPluginSetDescription(context, "STL plugin for Orthanc.");
1280 1295
1281 OrthancPlugins::RegisterRestCallback<ServeFile>("/stl/app/(.*)", true); 1296 OrthancPlugins::RegisterRestCallback<ServeFile>("/stl/app/(.*)", true);
1297 OrthancPlugins::RegisterRestCallback<ListStructures>("/stl/rt-struct/([0-9a-f-]+)", true);
1298
1299 if (hasCreateDicomStl_)
1300 {
1301 OrthancPlugins::RegisterRestCallback<Encode>("/stl/encode", true);
1302 }
1282 1303
1283 // Extend the default Orthanc Explorer with custom JavaScript for STL 1304 // Extend the default Orthanc Explorer with custom JavaScript for STL
1284 std::string explorer; 1305 std::string explorer;
1285 Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); 1306
1286 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); 1307 {
1287 1308 Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER);
1288 OrthancPlugins::RegisterRestCallback<ListStructures>("/stl/rt-struct/([0-9a-f-]+)", true); 1309
1289 1310 std::map<std::string, std::string> dictionary;
1290 if (hasCreateDicomStl_) 1311 dictionary["HAS_CREATE_DICOM_STL"] = (hasCreateDicomStl_ ? "true" : "false");
1291 { 1312 explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary);
1292 OrthancPlugins::RegisterRestCallback<Encode>("/stl/encode", true); 1313
1314 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str());
1293 } 1315 }
1294 1316
1295 return 0; 1317 return 0;
1296 } 1318 }
1297 1319