# HG changeset patch # User Sebastien Jodogne # Date 1589191593 -7200 # Node ID cce89307af288155410c1372902c13adeadd63a4 # Parent 967ae255a58f1637242eda3fcfe2f7d37e8eceba replacing GdcmDecoder/OrthancImageWrapper.h by OrthancPluginCppWrapper.h diff -r 967ae255a58f -r cce89307af28 CMakeLists.txt --- a/CMakeLists.txt Mon May 11 11:52:46 2020 +0200 +++ b/CMakeLists.txt Mon May 11 12:06:33 2020 +0200 @@ -143,6 +143,7 @@ ${CORE_SOURCES} ${AUTOGENERATED_SOURCES} ${CMAKE_SOURCE_DIR}/Plugin/Plugin.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp # The following files depend on GDCM ${CMAKE_SOURCE_DIR}/Plugin/DecodedImageAdapter.cpp diff -r 967ae255a58f -r cce89307af28 Plugin/DecodedImageAdapter.cpp --- a/Plugin/DecodedImageAdapter.cpp Mon May 11 11:52:46 2020 +0200 +++ b/Plugin/DecodedImageAdapter.cpp Mon May 11 12:06:33 2020 +0200 @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -150,9 +149,9 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); } - std::unique_ptr image( - new OrthancImageWrapper(context_, OrthancPluginDecodeDicomImage( - context_, dicom.c_str(), dicom.size(), frameIndex))); + std::unique_ptr image( + new OrthancImage(OrthancPluginDecodeDicomImage( + context_, dicom.c_str(), dicom.size(), frameIndex))); Json::Value json; if (GetCornerstoneMetadata(json, tags, *image)) @@ -191,14 +190,14 @@ bool DecodedImageAdapter::GetCornerstoneMetadata(Json::Value& result, const Json::Value& tags, - OrthancImageWrapper& image) + OrthancImage& image) { using namespace Orthanc; float windowCenter, windowWidth; Orthanc::ImageAccessor accessor; - accessor.AssignReadOnly(OrthancPlugins::Convert(image.GetFormat()), image.GetWidth(), + accessor.AssignReadOnly(OrthancPlugins::Convert(image.GetPixelFormat()), image.GetWidth(), image.GetHeight(), image.GetPitch(), image.GetBuffer()); switch (accessor.GetFormat()) @@ -311,10 +310,10 @@ bool DecodedImageAdapter::EncodeUsingDeflate(Json::Value& result, - OrthancImageWrapper& image) + OrthancImage& image) { Orthanc::ImageAccessor accessor; - accessor.AssignReadOnly(OrthancPlugins::Convert(image.GetFormat()), image.GetWidth(), + accessor.AssignReadOnly(OrthancPlugins::Convert(image.GetPixelFormat()), image.GetWidth(), image.GetHeight(), image.GetPitch(), image.GetBuffer()); std::unique_ptr buffer; @@ -363,7 +362,7 @@ result["sizeInBytes"] = converted.GetSize(); std::string z; - CompressUsingDeflate(z, image.GetContext(), converted.GetConstBuffer(), converted.GetSize()); + CompressUsingDeflate(z, GetGlobalContext(), converted.GetConstBuffer(), converted.GetSize()); std::string s; Orthanc::Toolbox::EncodeBase64(s, z); @@ -422,11 +421,11 @@ bool DecodedImageAdapter::EncodeUsingJpeg(Json::Value& result, - OrthancImageWrapper& image, + OrthancImage& image, uint8_t quality /* between 0 and 100 */) { Orthanc::ImageAccessor accessor; - accessor.AssignReadOnly(OrthancPlugins::Convert(image.GetFormat()), image.GetWidth(), + accessor.AssignReadOnly(OrthancPlugins::Convert(image.GetPixelFormat()), image.GetWidth(), image.GetHeight(), image.GetPitch(), image.GetBuffer()); std::unique_ptr buffer; @@ -485,7 +484,7 @@ result["sizeInBytes"] = converted.GetSize(); std::string jpeg; - WriteJpegToMemory(jpeg, image.GetContext(), converted, quality); + WriteJpegToMemory(jpeg, GetGlobalContext(), converted, quality); std::string s; Orthanc::Toolbox::EncodeBase64(s, jpeg); diff -r 967ae255a58f -r cce89307af28 Plugin/DecodedImageAdapter.h --- a/Plugin/DecodedImageAdapter.h Mon May 11 11:52:46 2020 +0200 +++ b/Plugin/DecodedImageAdapter.h Mon May 11 12:06:33 2020 +0200 @@ -27,7 +27,7 @@ #include #include -#include +#include namespace OrthancPlugins @@ -49,13 +49,13 @@ static bool GetCornerstoneMetadata(Json::Value& result, const Json::Value& tags, - OrthancImageWrapper& image); + OrthancImage& image); static bool EncodeUsingDeflate(Json::Value& result, - OrthancImageWrapper& image); + OrthancImage& image); static bool EncodeUsingJpeg(Json::Value& result, - OrthancImageWrapper& image, + OrthancImage& image, uint8_t quality /* between 0 and 100 */); OrthancPluginContext* context_; diff -r 967ae255a58f -r cce89307af28 Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Mon May 11 11:52:46 2020 +0200 +++ b/Plugin/Plugin.cpp Mon May 11 12:06:33 2020 +0200 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -568,6 +569,7 @@ { using namespace OrthancPlugins; + OrthancPlugins::SetGlobalContext(context); context_ = context; assert(DisplayPerformanceWarning()); OrthancPluginLogWarning(context_, "Initializing the Web viewer");