diff OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 2804:d88970f1ffbf

fix ordering of non-parallel slices + /tools/reconstruct
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 29 Aug 2018 13:24:28 +0200
parents d4e81e0a8324
children 7133ad478eea
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Tue Aug 28 15:14:33 2018 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Wed Aug 29 13:24:28 2018 +0200
@@ -1549,6 +1549,23 @@
   }
 
 
+  static void ReconstructAllResources(RestApiPostCall& call)
+  {
+    ServerContext& context = OrthancRestApi::GetContext(call);
+
+    std::list<std::string> studies;
+    context.GetIndex().GetAllUuids(studies, ResourceType_Study);
+
+    for (std::list<std::string>::const_iterator 
+           study = studies.begin(); study != studies.end(); ++study)
+    {
+      ServerToolbox::ReconstructResource(context, *study);
+    }
+    
+    call.GetOutput().AnswerBuffer("", "text/plain");
+  }
+
+
   void OrthancRestApi::RegisterResources()
   {
     Register("/instances", ListResources<ResourceType_Instance>);
@@ -1654,5 +1671,6 @@
     Register("/studies/{id}/reconstruct", ReconstructResource<ResourceType_Study>);
     Register("/series/{id}/reconstruct", ReconstructResource<ResourceType_Series>);
     Register("/instances/{id}/reconstruct", ReconstructResource<ResourceType_Instance>);
+    Register("/tools/reconstruct", ReconstructAllResources);
   }
 }