comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4507:b4c58795f3a8

widening the use of DicomTransferSyntax enum
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Feb 2021 09:33:48 +0100
parents 7d1eabfac6e0
children 8f9090b137f1
comparison
equal deleted inserted replaced
4506:ac69c9f76c71 4507:b4c58795f3a8
2931 2931
2932 case _OrthancPluginService_GetInstanceJson: 2932 case _OrthancPluginService_GetInstanceJson:
2933 case _OrthancPluginService_GetInstanceSimplifiedJson: 2933 case _OrthancPluginService_GetInstanceSimplifiedJson:
2934 { 2934 {
2935 Json::Value dicomAsJson; 2935 Json::Value dicomAsJson;
2936 OrthancConfiguration::DefaultDicomDatasetToJson(dicomAsJson, instance.GetParsedDicomFile()); 2936 instance.GetDicomAsJson(dicomAsJson);
2937 2937
2938 std::string s; 2938 std::string s;
2939
2940 if (service == _OrthancPluginService_GetInstanceJson) 2939 if (service == _OrthancPluginService_GetInstanceJson)
2941 { 2940 {
2942 Toolbox::WriteStyledJson(s, dicomAsJson); 2941 Toolbox::WriteStyledJson(s, dicomAsJson);
2943 } 2942 }
2944 else 2943 else
2956 *p.resultOrigin = Plugins::Convert(instance.GetOrigin().GetRequestOrigin()); 2955 *p.resultOrigin = Plugins::Convert(instance.GetOrigin().GetRequestOrigin());
2957 return; 2956 return;
2958 2957
2959 case _OrthancPluginService_GetInstanceTransferSyntaxUid: // New in Orthanc 1.6.1 2958 case _OrthancPluginService_GetInstanceTransferSyntaxUid: // New in Orthanc 1.6.1
2960 { 2959 {
2961 std::string s; 2960 DicomTransferSyntax s;
2962 if (!instance.LookupTransferSyntax(s)) 2961 if (instance.LookupTransferSyntax(s))
2963 { 2962 {
2964 s.clear(); 2963 *p.resultStringToFree = CopyString(GetTransferSyntaxUid(s));
2964 }
2965 else
2966 {
2967 *p.resultStringToFree = CopyString("");
2965 } 2968 }
2966 2969
2967 *p.resultStringToFree = CopyString(s);
2968 return; 2970 return;
2969 } 2971 }
2970 2972
2971 case _OrthancPluginService_HasInstancePixelData: // New in Orthanc 1.6.1 2973 case _OrthancPluginService_HasInstancePixelData: // New in Orthanc 1.6.1
2972 *p.resultInt64 = instance.HasPixelData(); 2974 *p.resultInt64 = instance.HasPixelData();
2973 return; 2975 return;
2974 2976
2975 case _OrthancPluginService_GetInstanceFramesCount: // New in Orthanc 1.7.0 2977 case _OrthancPluginService_GetInstanceFramesCount: // New in Orthanc 1.7.0
2976 *p.resultInt64 = instance.GetParsedDicomFile().GetFramesCount(); 2978 *p.resultInt64 = instance.GetFramesCount();
2977 return; 2979 return;
2978 2980
2979 default: 2981 default:
2980 throw OrthancException(ErrorCode_InternalError); 2982 throw OrthancException(ErrorCode_InternalError);
2981 } 2983 }
3079 reinterpret_cast<const IDicomInstance*>(p.instance)->GetInstance(); 3081 reinterpret_cast<const IDicomInstance*>(p.instance)->GetInstance();
3080 3082
3081 switch (service) 3083 switch (service)
3082 { 3084 {
3083 case _OrthancPluginService_GetInstanceFramesCount: 3085 case _OrthancPluginService_GetInstanceFramesCount:
3084 *p.targetUint32 = instance.GetParsedDicomFile().GetFramesCount(); 3086 *p.targetUint32 = instance.GetFramesCount();
3085 return; 3087 return;
3086 3088
3087 case _OrthancPluginService_GetInstanceRawFrame: 3089 case _OrthancPluginService_GetInstanceRawFrame:
3088 { 3090 {
3089 if (p.targetBuffer == NULL) 3091 if (p.targetBuffer == NULL)
3125 throw OrthancException(ErrorCode_NullPointer); 3127 throw OrthancException(ErrorCode_NullPointer);
3126 } 3128 }
3127 3129
3128 p.targetBuffer->data = NULL; 3130 p.targetBuffer->data = NULL;
3129 p.targetBuffer->size = 0; 3131 p.targetBuffer->size = 0;
3130 3132 CopyToMemoryBuffer(*p.targetBuffer, instance.GetBufferData(), instance.GetBufferSize());
3131 std::string serialized;
3132 instance.GetParsedDicomFile().SaveToMemoryBuffer(serialized);
3133 CopyToMemoryBuffer(*p.targetBuffer, serialized);
3134 return; 3133 return;
3135 } 3134 }
3136 3135
3137 case _OrthancPluginService_GetInstanceAdvancedJson: 3136 case _OrthancPluginService_GetInstanceAdvancedJson:
3138 { 3137 {
3140 { 3139 {
3141 throw OrthancException(ErrorCode_NullPointer); 3140 throw OrthancException(ErrorCode_NullPointer);
3142 } 3141 }
3143 3142
3144 Json::Value json; 3143 Json::Value json;
3145 instance.GetParsedDicomFile().DatasetToJson( 3144 instance.DatasetToJson(json, Plugins::Convert(p.format),
3146 json, Plugins::Convert(p.format), 3145 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength);
3147 static_cast<DicomToJsonFlags>(p.flags), p.maxStringLength);
3148 3146
3149 std::string s; 3147 std::string s;
3150 Toolbox::WriteFastJson(s, json); 3148 Toolbox::WriteFastJson(s, json);
3151 *p.targetStringToFree = CopyString(s); 3149 *p.targetStringToFree = CopyString(s);
3152 return; 3150 return;