changeset 443:be93b666ed79

link anonymized to original resource in OrthancExplorer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 17 May 2013 16:55:30 +0200
parents 40deb6525337
children de660d1fd8f2
files OrthancExplorer/explorer.html OrthancExplorer/explorer.js OrthancServer/OrthancRestApi.cpp
diffstat 3 files changed, 36 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancExplorer/explorer.html	Fri May 17 16:06:38 2013 +0200
+++ b/OrthancExplorer/explorer.html	Fri May 17 16:55:30 2013 +0200
@@ -98,6 +98,9 @@
 
               <ul data-role="listview" data-inset="true" data-theme="d" data-divider-theme="c">
                 <li data-role="list-divider">Access</li>
+                <li data-icon="info" data-theme="e" style="display:none">
+                  <a href="#" id="patient-anonymized-from">Before anonymization</a>
+                </li>
                 <li data-icon="gear"><a href="#" id="patient-archive">Download ZIP</a></li>
               </ul>
             </div>
@@ -138,6 +141,9 @@
 
               <ul data-role="listview" data-inset="true" data-theme="d" data-divider-theme="c">
                 <li data-role="list-divider">Access</li>
+                <li data-icon="info" data-theme="e" style="display:none">
+                  <a href="#" id="study-anonymized-from">Before anonymization</a>
+                </li>
                 <li data-icon="gear"><a href="#" id="study-archive">Download ZIP</a></li>
               </ul>
             </div>
@@ -180,6 +186,9 @@
 
               <ul data-role="listview" data-inset="true" data-theme="d" data-divider-theme="c">
                 <li data-role="list-divider">Access</li>
+                <li data-icon="info" data-theme="e" style="display:none">
+                  <a href="#" id="series-anonymized-from">Before anonymization</a>
+                </li>
                 <li data-icon="search"><a href="#" id="series-preview">Preview this series</a></li>
                 <li data-icon="gear"><a href="#" id="series-archive">Download ZIP</a></li>
               </ul>
--- a/OrthancExplorer/explorer.js	Fri May 17 16:06:38 2013 +0200
+++ b/OrthancExplorer/explorer.js	Fri May 17 16:55:30 2013 +0200
@@ -356,6 +356,23 @@
 
 
 
+function SetupAnonymizedFrom(buttonSelector, resource, resourceType)
+{
+  if ('AnonymizedFrom' in resource)
+  {
+    $(buttonSelector).closest('li').show();
+    $(buttonSelector).click(function(e) {
+      window.location.assign('explorer.html#' + resourceType + '?uuid=' + resource.AnonymizedFrom);
+      window.location.reload();
+    });
+  }
+  else
+  {
+    $(buttonSelector).closest('li').hide();
+  }
+}
+
+
 $('#patient').live('pagebeforeshow', function() {
   if ($.mobile.pageData) {
     GetSingleResource('patients', $.mobile.pageData.uuid, function(patient) {
@@ -381,6 +398,8 @@
           target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID));
         }
 
+        SetupAnonymizedFrom('#patient-anonymized-from', patient, 'patient');
+
         target.listview('refresh');
 
         // Check whether this patient is protected
@@ -417,6 +436,8 @@
             .append(FormatStudy(study))
             .listview('refresh');
 
+          SetupAnonymizedFrom('#study-anonymized-from', study, 'study');
+
           var target = $('#list-series');
           $('li', target).remove();
           for (var i = 0; i < series.length; i++) {
@@ -456,6 +477,8 @@
               .append(FormatSeries(series))
               .listview('refresh');
 
+            SetupAnonymizedFrom('#series-anonymized-from', series, 'series');
+
             var target = $('#list-instances');
             $('li', target).remove();
             for (var i = 0; i < instances.length; i++) {
--- a/OrthancServer/OrthancRestApi.cpp	Fri May 17 16:06:38 2013 +0200
+++ b/OrthancServer/OrthancRestApi.cpp	Fri May 17 16:55:30 2013 +0200
@@ -1319,7 +1319,7 @@
 
 
       /**
-       * Record metadata information (AnonimizedFrom/ModifiedFrom).
+       * Record metadata information (AnonymizedFrom/ModifiedFrom).
        **/
 
       DicomInstanceHasher modifiedHasher = modified->GetHasher();
@@ -1348,6 +1348,9 @@
 
       if (isFirst)
       {
+        context.GetIndex().SetMetadata(modifiedHasher.HashPatient(), 
+                                       metadataType, originalHasher.HashPatient());
+
         std::string newId;
 
         switch (resourceType)