Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Samples/Sanitizer/Plugin.cpp @ 4919:676e03e69703
added origin in OrthancPluginReceivedInstanceCallback
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Feb 2022 09:30:42 +0100 |
parents | 189ae9a37e01 |
children | 0ea402b4d901 |
comparison
equal
deleted
inserted
replaced
4917:95378de340d4 | 4919:676e03e69703 |
---|---|
31 #include <iostream> | 31 #include <iostream> |
32 | 32 |
33 | 33 |
34 | 34 |
35 | 35 |
36 OrthancPluginReceivedInstanceCallbackResult ReceivedInstanceCallback(OrthancPluginMemoryBuffer64* modifiedDicomBuffer, | 36 OrthancPluginReceivedInstanceAction ReceivedInstanceCallback(OrthancPluginMemoryBuffer64* modifiedDicomBuffer, |
37 const void* receivedDicomBuffer, | 37 const void* receivedDicomBuffer, |
38 uint64_t receivedDicomBufferSize) | 38 uint64_t receivedDicomBufferSize, |
39 OrthancPluginInstanceOrigin origin) | |
39 { | 40 { |
40 Orthanc::ParsedDicomFile dicom(receivedDicomBuffer, receivedDicomBufferSize); | 41 Orthanc::ParsedDicomFile dicom(receivedDicomBuffer, receivedDicomBufferSize); |
41 std::string institutionName = "My institution"; | 42 std::string institutionName = "My institution"; |
42 | 43 |
43 dicom.Replace(Orthanc::DICOM_TAG_INSTITUTION_NAME, institutionName, false, Orthanc::DicomReplaceMode_InsertIfAbsent, ""); | 44 dicom.Replace(Orthanc::DICOM_TAG_INSTITUTION_NAME, institutionName, false, Orthanc::DicomReplaceMode_InsertIfAbsent, ""); |
46 dicom.SaveToMemoryBuffer(modifiedDicom); | 47 dicom.SaveToMemoryBuffer(modifiedDicom); |
47 | 48 |
48 OrthancPluginCreateMemoryBuffer64(OrthancPlugins::GetGlobalContext(), modifiedDicomBuffer, modifiedDicom.size()); | 49 OrthancPluginCreateMemoryBuffer64(OrthancPlugins::GetGlobalContext(), modifiedDicomBuffer, modifiedDicom.size()); |
49 memcpy(modifiedDicomBuffer->data, modifiedDicom.c_str(), modifiedDicom.size()); | 50 memcpy(modifiedDicomBuffer->data, modifiedDicom.c_str(), modifiedDicom.size()); |
50 | 51 |
51 return OrthancPluginReceivedInstanceCallbackResult_Modify; | 52 return OrthancPluginReceivedInstanceAction_Modify; |
52 } | 53 } |
53 | 54 |
54 | 55 |
55 extern "C" | 56 extern "C" |
56 { | 57 { |
59 OrthancPlugins::SetGlobalContext(c); | 60 OrthancPlugins::SetGlobalContext(c); |
60 | 61 |
61 Orthanc::InitializeFramework("", true); | 62 Orthanc::InitializeFramework("", true); |
62 | 63 |
63 /* Check the version of the Orthanc core */ | 64 /* Check the version of the Orthanc core */ |
64 // if (OrthancPluginCheckVersion(c) == 0) | 65 if (OrthancPluginCheckVersion(c) == 0) |
65 // { | 66 { |
66 // OrthancPlugins::ReportMinimalOrthancVersion(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, | 67 OrthancPlugins::ReportMinimalOrthancVersion(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, |
67 // ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, | 68 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, |
68 // ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); | 69 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); |
69 // return -1; | 70 return -1; |
70 // } | 71 } |
71 | 72 |
72 OrthancPlugins::LogWarning("Sanitizer plugin is initializing"); | 73 OrthancPlugins::LogWarning("Sanitizer plugin is initializing"); |
73 OrthancPluginSetDescription(c, "Sample plugin to sanitize incoming DICOM instances."); | 74 OrthancPluginSetDescription(c, "Sample plugin to sanitize incoming DICOM instances."); |
74 | 75 |
75 OrthancPluginRegisterReceivedInstanceCallback(c, ReceivedInstanceCallback); | 76 OrthancPluginRegisterReceivedInstanceCallback(c, ReceivedInstanceCallback); |
76 | 77 |