comparison Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 2848:dd3914a44b87

added accessors in C++ wrappers
author am@osimis.io
date Mon, 01 Oct 2018 11:35:01 +0200
parents 807169f85ba9
children c67b5d80b758 9f949922d603
comparison
equal deleted inserted replaced
2847:2da68edacab6 2848:dd3914a44b87
229 std::string s = writer.write(tags); 229 std::string s = writer.write(tags);
230 230
231 Check(OrthancPluginCreateDicom(context_, &buffer_, s.c_str(), NULL, flags)); 231 Check(OrthancPluginCreateDicom(context_, &buffer_, s.c_str(), NULL, flags));
232 } 232 }
233 233
234 void MemoreyBuffer::CreateDicom(const Json::Value& tags,
235 const OrthancPluginImage& pixelData,
236 OrthancPluginCreateDicomFlags flags)
237 {
238 Clear();
239
240 Json::FastWriter writer;
241 std::string s = writer.write(tags);
242
243 Check(OrthancPluginCreateDicom(context_, &buffer_, s.c_str(), pixelData.GetObject(), flags));
244 }
245
234 246
235 void MemoryBuffer::ReadFile(const std::string& path) 247 void MemoryBuffer::ReadFile(const std::string& path)
236 { 248 {
237 Clear(); 249 Clear();
238 Check(OrthancPluginReadFile(context_, &buffer_, path.c_str())); 250 Check(OrthancPluginReadFile(context_, &buffer_, path.c_str()));
883 { 895 {
884 image_ = OrthancPluginCreateImage(context, format, width, height); 896 image_ = OrthancPluginCreateImage(context, format, width, height);
885 } 897 }
886 } 898 }
887 899
900 OrthancImage::OrthancImage(OrthancPluginContext* context,
901 OrthancPluginPixelFormat format,
902 uint32_t width,
903 uint32_t height,
904 uint32_t pitch,
905 void* buffer) :
906 context_(context)
907 {
908 if (context == NULL)
909 {
910 ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
911 }
912 else
913 {
914 image_ = OrthancPluginCreateImageAccessor(context, format, width, height, pitch, buffer);
915 }
916 }
888 917
889 void OrthancImage::UncompressPngImage(const void* data, 918 void OrthancImage::UncompressPngImage(const void* data,
890 size_t size) 919 size_t size)
891 { 920 {
892 Clear(); 921 Clear();