diff Framework/Inputs/OpenSlideLibrary.h @ 278:169f168ba07a

retrieval of properties from openslide
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jul 2023 17:12:10 +0200
parents 20a730889ae2
children 7020852a8fa9
line wrap: on
line diff
--- a/Framework/Inputs/OpenSlideLibrary.h	Mon Jul 10 16:22:14 2023 +0200
+++ b/Framework/Inputs/OpenSlideLibrary.h	Wed Jul 12 17:12:10 2023 +0200
@@ -25,6 +25,7 @@
 #include <Images/ImageAccessor.h>
 #include <SharedLibrary.h>
 
+#include <map>
 #include <vector>
 
 namespace OrthancWSI
@@ -39,6 +40,10 @@
     typedef void*   (*FunctionOpen) (const char*);
     typedef void    (*FunctionReadRegion) (void*, uint32_t*, int64_t, int64_t, int32_t, int64_t, int64_t);
 
+    // New in WSI 2.0
+    typedef const char* const* (*FunctionGetPropertyNames) (void*);
+    typedef const char*        (*FunctionGetPropertyValue) (void*, const char*);
+
     Orthanc::SharedLibrary      library_;
     FunctionClose               close_;
     FunctionGetLevelCount       getLevelCount_;
@@ -46,6 +51,8 @@
     FunctionGetLevelDownsample  getLevelDownsample_;
     FunctionOpen                open_;
     FunctionReadRegion          readRegion_;
+    FunctionGetPropertyNames    getPropertyNames_;
+    FunctionGetPropertyValue    getPropertyValue_;
 
   public:
     explicit OpenSlideLibrary(const std::string& path);
@@ -72,9 +79,10 @@
               double downsample);
       };
 
-      OpenSlideLibrary&   that_;
-      void*               handle_;
-      std::vector<Level>  levels_;
+      OpenSlideLibrary&                   that_;
+      void*                               handle_;
+      std::vector<Level>                  levels_;
+      std::map<std::string, std::string>  properties_;
 
       void Initialize(const std::string& path);
 
@@ -109,6 +117,9 @@
                                          uint64_t y,
                                          unsigned int width,
                                          unsigned int height);
+
+      bool LookupProperty(std::string& value,
+                          const std::string& property) const;
     };
   };
 }