changeset 7:eab054ee7537

added modal in Orthanc Explorer to choose between the OHIF viewers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 18 Jun 2023 10:37:21 +0200
parents e8e7ba4371e3
children cc4c81d08bf0
files Sources/OrthancExplorer.js Sources/Plugin.cpp
diffstat 2 files changed, 72 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Sources/OrthancExplorer.js	Sat Jun 17 17:45:05 2023 +0200
+++ b/Sources/OrthancExplorer.js	Sun Jun 18 10:37:21 2023 +0200
@@ -22,6 +22,21 @@
  **/
 
 
+function AddOhifViewer(target, name, callback) {
+  var li = $('<li>', {
+    name: name,
+  }).click(callback);
+
+  li.append($('<a>', {
+    href: '#',
+    rel: 'close',
+    text: name
+  }));
+
+  target.append(li);
+}
+
+
 $('#study').live('pagebeforeshow', function() {
   var studyId = $.mobile.pageData.uuid;
 
@@ -43,12 +58,48 @@
           .button();
       
       b.insertAfter($('#study-info'));
+      
       b.click(function() {
-        if (${USE_DICOM_WEB}) {
-          window.open('../ohif/viewer?StudyInstanceUIDs=' + studyInstanceUid);
-        } else  {
-          window.open('../ohif/viewer?url=../ohif-source/' + studyId);
-        }
+        var viewers = $('<ul>')
+            .attr('data-divider-theme', 'd')
+            .attr('data-role', 'listview');
+
+        // The list of OHIF viewers can be found at: https://docs.ohif.org/
+
+        AddOhifViewer(viewers, 'Basic viewer', function() {
+          if (${USE_DICOM_WEB}) {
+            window.open('../ohif/viewer?StudyInstanceUIDs=' + studyInstanceUid);
+          } else  {
+            window.open('../ohif/viewer?url=../ohif-source/' + studyId);
+          }
+        });
+
+        AddOhifViewer(viewers, 'Volume rendering', function() {
+          if (${USE_DICOM_WEB}) {
+            window.open('../ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&StudyInstanceUIDs=' + studyInstanceUid);
+          } else  {
+            window.open('../ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&url=../ohif-source/' + studyId);
+          }
+        });
+
+        AddOhifViewer(viewers, 'Total metabolic tumor volume', function() {
+          if (${USE_DICOM_WEB}) {
+            window.open('../ohif/tmtv?StudyInstanceUIDs=' + studyInstanceUid);
+          } else  {
+            window.open('../ohif/tmtv?url=../ohif-source/' + studyId);
+          }
+        });
+
+        // Launch the dialog
+        $('#dialog').simpledialog2({
+          mode: 'blank',
+          animate: false,
+          headerText: 'Choose OHIF viewer',
+          headerClose: true,
+          forceInput: false,
+          width: '100%',
+          blankContent: viewers
+        });
       });
     }
   });
--- a/Sources/Plugin.cpp	Sat Jun 17 17:45:05 2023 +0200
+++ b/Sources/Plugin.cpp	Sun Jun 18 10:37:21 2023 +0200
@@ -91,6 +91,11 @@
 
 static void InitializeOhifTags()
 {
+  /**
+   * Those are the tags that are found in the documentation of the
+   * "DICOM JSON" data source:
+   * https://docs.ohif.org/configuration/dataSources/dicom-json
+   **/
   ohifStudyTags_[Orthanc::DICOM_TAG_STUDY_INSTANCE_UID] = TagInformation(DataType_String, "StudyInstanceUID");
   ohifStudyTags_[Orthanc::DICOM_TAG_STUDY_DATE]         = TagInformation(DataType_String, "StudyDate");
   ohifStudyTags_[Orthanc::DICOM_TAG_STUDY_TIME]         = TagInformation(DataType_String, "StudyTime");
@@ -130,6 +135,17 @@
   ohifInstanceTags_[Orthanc::DICOM_TAG_WINDOW_WIDTH]               = TagInformation(DataType_Float, "WindowWidth");
   ohifInstanceTags_[Orthanc::DICOM_TAG_SERIES_DATE]                = TagInformation(DataType_String, "SeriesDate");
 
+  /**
+   * The items below are related to PET scans. Their list can be found
+   * by looking for "required metadata are missing" in
+   * "extensions/default/src/getPTImageIdInstanceMetadata.ts"
+   **/
+  ohifInstanceTags_[Orthanc::DICOM_TAG_SERIES_TIME]    = TagInformation(DataType_String, "SeriesTime");
+  ohifInstanceTags_[Orthanc::DicomTag(0x0010, 0x1030)] = TagInformation(DataType_Float, "PatientWeight");
+  ohifInstanceTags_[Orthanc::DicomTag(0x0028, 0x0051)] = TagInformation(DataType_ListOfStrings, "CorrectedImage");
+  ohifInstanceTags_[Orthanc::DicomTag(0x0054, 0x1001)] = TagInformation(DataType_String, "Units");
+  ohifInstanceTags_[Orthanc::DicomTag(0x0054, 0x1102)] = TagInformation(DataType_String, "DecayCorrection");
+
   for (TagsDictionary::const_iterator it = ohifStudyTags_.begin(); it != ohifStudyTags_.end(); ++it)
   {
     assert(allTags_.find(it->first) == allTags_.end() ||