diff Resources/Graveyard/Hello.cpp @ 63:3252fbf149e3

test
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Nov 2016 18:23:09 +0100
parents
children d529d9ce3c7e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Graveyard/Hello.cpp	Fri Nov 25 18:23:09 2016 +0100
@@ -0,0 +1,85 @@
+
+#include <stdint.h>
+#include <boost/noncopyable.hpp>
+#include <string>
+#include <vector>
+#include <json/reader.h>
+#include <json/value.h>
+#include <boost/thread/mutex.hpp>
+
+#include "../../Framework/Inputs/DicomPyramid.h"
+#include "../../Applications/ApplicationToolbox.h"
+#include "../../Resources/Orthanc/Plugins/Samples/Common/OrthancHttpConnection.h"
+#include "../../Resources/Orthanc/Plugins/Samples/Common/DicomDatasetReader.h"
+#include "../../Resources/Orthanc/Plugins/Samples/Common/FullOrthancDataset.h"
+#include "../../Resources/Orthanc/Plugins/Samples/Common/SimplifiedOrthancDataset.h"
+
+#include <stdio.h>
+
+namespace OrthancPlugins
+{
+  void Run()
+  {
+    OrthancHttpConnection orthanc;
+
+#if 0
+    //DicomDatasetReader reader(new SimplifiedOrthancDataset(orthanc, "/instances/2791b060-6ff103b3-8078bed0-5abbd75a-a5c675f7/tags?simplify"));
+    DicomDatasetReader reader(new FullOrthancDataset(orthanc, "/instances/2791b060-6ff103b3-8078bed0-5abbd75a-a5c675f7/tags"));
+
+    std::cout << reader.GetIntegerValue(DICOM_TAG_TOTAL_PIXEL_MATRIX_COLUMNS) << "x"
+              << reader.GetIntegerValue(DICOM_TAG_TOTAL_PIXEL_MATRIX_ROWS) << std::endl;
+    
+    std::string s;
+    printf("%d ", reader.GetDataset().GetStringValue(s, DICOM_TAG_SOP_CLASS_UID));
+    printf("[%s]\n", s.c_str());
+
+    size_t c;
+
+    {
+      DicomPath p(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE);
+      printf("%d ", reader.GetDataset().GetSequenceSize(c, p));
+      printf("%d\n", c);    
+    }
+
+    for (size_t i = 0; i < c; i++)
+    {
+      /*DicomPath p(DICOM_TAG_COLUMN_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX);
+        p.AddToPrefix(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE, i);
+        p.AddToPrefix(DICOM_TAG_PLANE_POSITION_SLIDE_SEQUENCE, 0);
+
+        std::string x, y;
+        printf("%d %d ", i, reader.GetDataset().GetStringValue(x, p));
+        p.SetFinalTag(DICOM_TAG_ROW_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX);
+        printf("%d ", reader.GetDataset().GetStringValue(y, p));
+        printf("[%s,%s]\n", x.c_str(), y.c_str());*/
+      
+      std::cout << i << ": [" 
+                << reader.GetMandatoryStringValue(
+                  DicomPath(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE, i,
+                            DICOM_TAG_PLANE_POSITION_SLIDE_SEQUENCE, 0,
+                            DICOM_TAG_COLUMN_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX)) << ","
+                << reader.GetMandatoryStringValue(
+                  DicomPath(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE, i,
+                            DICOM_TAG_PLANE_POSITION_SLIDE_SEQUENCE, 0,
+                            DICOM_TAG_ROW_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX))
+                << "]" << std::endl;
+    }
+
+#else
+    OrthancWSI::DicomPyramid pyramid(orthanc, "68bc53a6-8bd5b470-05072b43-af144cf8-665c54fd");
+    //OrthancWSI::DicomPyramid pyramid(orthanc, "4fdff9b9-8b81bc8f-04a3f903-4d44bd57-cc3bf42c");
+#endif
+  }
+
+}
+
+
+
+
+int main()
+{
+  OrthancWSI::ApplicationToolbox::GlobalInitialize();
+  OrthancPlugins::Run();
+  OrthancWSI::ApplicationToolbox::GlobalFinalize();
+  return 0;
+}