changeset 1054:1701dcb6f554

Access patient module at the study level to cope with PatientID collisions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Jul 2014 17:10:08 +0200
parents ee5cbe6e48d3
children 6f923d52a46c
files NEWS OrthancServer/OrthancRestApi/OrthancRestResources.cpp
diffstat 2 files changed, 40 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Jul 23 16:52:03 2014 +0200
+++ b/NEWS	Wed Jul 23 17:10:08 2014 +0200
@@ -1,10 +1,19 @@
 Pending changes in the mainline
 ===============================
 
+
+General
+-------
+
+* Access patient module at the study level to cope with PatientID collisions
+* On-the-fly conversion of JSON to XML according to the HTTP Accept header
+* C-Echo SCU in the REST API
+
+Plugins
+-------
+
 * Lookup for DICOM UIDs in the plugin SDK
 * Plugins have access to the HTTP headers and can answer with HTTP status codes
-* On-the-fly conversion of JSON to XML according to the HTTP Accept header
-* C-Echo SCU in the REST API
 
 
 Version 0.8.0 (2014/07/10)
@@ -43,7 +52,7 @@
 * Creation of DICOM instances using the REST API
 * Embedding of images within DICOM instances
 * Adding/removal/modification of remote modalities/peers through REST
-* Reuse of the previous SCU connection to avoid unecessary handshakes
+* Reuse of the previous SCU connection to avoid unnecessary handshakes
 * Fix problems with anonymization and modification
 * Fix missing licensing terms about reuse of some code from DCMTK
 * Various code refactorings
@@ -172,7 +181,7 @@
 ==========================
 
 * "Bulk" Store-SCU (send several DICOM instances with the same
-  DICOM connexion)
+  DICOM connection)
 * Store-SCU for patients and studies in Orthanc Explorer
 * Filtering of incoming DICOM instances (through Lua scripting)
 * Filtering of incoming HTTP requests (through Lua scripting)
@@ -197,7 +206,7 @@
 -------------
 
 * Download of modified or anonymized DICOM instances
-* Inplace modification and anymization of DICOM series, studies and patients
+* Inplace modification and anonymization of DICOM series, studies and patients
 
 Minor changes
 -------------
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Wed Jul 23 16:52:03 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Wed Jul 23 17:10:08 2014 +0200
@@ -705,16 +705,23 @@
   }
 
 
-  template <enum ResourceType resourceType>
-  static void GetModule(RestApiGetCall& call)
+  static void GetModuleInternal(RestApiGetCall& call,
+                                ResourceType resourceType,
+                                ResourceType queryLevel)
   {
+    if (resourceType != queryLevel &&
+        !(resourceType == ResourceType_Study && queryLevel == ResourceType_Patient))
+    {
+      throw OrthancException(ErrorCode_NotImplemented);
+    }
+
     ServerContext& context = OrthancRestApi::GetContext(call);
     std::string publicId = call.GetUriComponent("id", "");
     bool simplify = call.HasArgument("simplify");
 
     typedef std::set<DicomTag> Module;
     Module module;
-    DicomTag::GetTagsForModule(module, resourceType);
+    DicomTag::GetTagsForModule(module, queryLevel);
 
     Json::Value tags;
 
@@ -756,7 +763,21 @@
     else
     {
       call.GetOutput().AnswerJson(result);
-    }
+    }    
+  }
+    
+
+
+  template <enum ResourceType resourceType>
+  static void GetModule(RestApiGetCall& call)
+  {
+    GetModuleInternal(call, resourceType, resourceType);
+  }
+
+
+  static void GetPatientModuleForStudy(RestApiGetCall& call)
+  {
+    GetModuleInternal(call, ResourceType_Study, ResourceType_Patient);
   }
 
 
@@ -789,6 +810,7 @@
     Register("/patients/{id}/module", GetModule<ResourceType_Patient>);
     Register("/series/{id}/module", GetModule<ResourceType_Series>);
     Register("/studies/{id}/module", GetModule<ResourceType_Study>);
+    Register("/studies/{id}/module-patient", GetPatientModuleForStudy);
 
     Register("/instances/{id}/file", GetInstanceFile);
     Register("/instances/{id}/export", ExportInstanceFile);