Mercurial > hg > orthanc-wsi
diff Resources/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 82:5b127ab0080b
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 14 Dec 2016 17:01:34 +0100 |
parents | d529d9ce3c7e |
children | 319b8c45c231 |
line wrap: on
line diff
--- a/Resources/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Tue Nov 29 13:31:23 2016 +0100 +++ b/Resources/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Wed Dec 14 17:01:34 2016 +0100 @@ -50,6 +50,17 @@ #endif +#if (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER >= 2 || \ + (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == 1 && \ + ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER >= 2)) +// The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0 +# define HAS_ORTHANC_PLUGIN_FIND_MATCHER 1 +#else +# define HAS_ORTHANC_PLUGIN_FIND_MATCHER 0 +#endif + + + namespace OrthancPlugins { @@ -172,6 +183,13 @@ OrthancPluginCreateDicomFlags flags); void ReadFile(const std::string& path); + + void GetDicomQuery(const OrthancPluginWorklistQuery* query); + + void DicomToJson(Json::Value& target, + OrthancPluginDicomToJsonFormat format, + OrthancPluginDicomToJsonFlags flags, + uint32_t maxStringLength); }; @@ -181,16 +199,23 @@ OrthancPluginContext* context_; char* str_; + void Clear(); + public: - OrthancString(OrthancPluginContext* context, - char* str); + OrthancString(OrthancPluginContext* context) : + context_(context), + str_(NULL) + { + } ~OrthancString() { Clear(); } - void Clear(); + // This transfers ownership, warning: The string must have been + // allocated by the Orthanc core + void Assign(char* str); const char* GetContent() const { @@ -262,7 +287,7 @@ float defaultValue) const; }; - class OrthancImage + class OrthancImage : public boost::noncopyable { private: OrthancPluginContext* context_; @@ -320,6 +345,48 @@ }; +#if HAS_ORTHANC_PLUGIN_FIND_MATCHER == 1 + class FindMatcher : public boost::noncopyable + { + private: + OrthancPluginContext* context_; + OrthancPluginFindMatcher* matcher_; + const OrthancPluginWorklistQuery* worklist_; + + void SetupDicom(OrthancPluginContext* context, + const void* query, + uint32_t size); + + public: + FindMatcher(OrthancPluginContext* context, + const OrthancPluginWorklistQuery* worklist); + + FindMatcher(OrthancPluginContext* context, + const void* query, + uint32_t size) + { + SetupDicom(context, query, size); + } + + FindMatcher(OrthancPluginContext* context, + const MemoryBuffer& dicom) + { + SetupDicom(context, dicom.GetData(), dicom.GetSize()); + } + + ~FindMatcher(); + + bool IsMatch(const void* dicom, + uint32_t size) const; + + bool IsMatch(const MemoryBuffer& dicom) const + { + return IsMatch(dicom.GetData(), dicom.GetSize()); + } + }; +#endif + + bool RestApiGet(Json::Value& result, OrthancPluginContext* context, const std::string& uri,