Mercurial > hg > orthanc
changeset 1599:dd1f9e81f891
fixes to image primitives
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 01 Sep 2015 11:23:41 +0200 |
parents | c6b50b803387 |
children | 7151d63e6d81 |
files | Plugins/Engine/OrthancPlugins.cpp Plugins/Include/orthanc/OrthancCDatabasePlugin.h Plugins/Include/orthanc/OrthancCPlugin.h |
diffstat | 3 files changed, 43 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Mon Aug 31 17:37:54 2015 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Sep 01 11:23:41 2015 +0200 @@ -1048,7 +1048,7 @@ void OrthancPlugins::UncompressImage(const void* parameters) { - const _OrthancPluginUncompressImage& p = reinterpret_cast<const _OrthancPluginUncompressImage&>(parameters); + const _OrthancPluginUncompressImage& p = *reinterpret_cast<const _OrthancPluginUncompressImage*>(parameters); switch (p.format) { @@ -1071,7 +1071,7 @@ void OrthancPlugins::CompressImage(const void* parameters) { - const _OrthancPluginCompressImage& p = reinterpret_cast<const _OrthancPluginCompressImage&>(parameters); + const _OrthancPluginCompressImage& p = *reinterpret_cast<const _OrthancPluginCompressImage*>(parameters); std::string compressed; @@ -1086,6 +1086,7 @@ case OrthancPluginImageFormat_Jpeg: // TODO + //writer.SetQuality(p.quality); default: throw OrthancException(ErrorCode_ParameterOutOfRange); @@ -1401,42 +1402,42 @@ case _OrthancPluginService_GetImagePixelFormat: { - const _OrthancPluginGetImageInfo& p = reinterpret_cast<const _OrthancPluginGetImageInfo&>(parameters); + const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); *(p.resultPixelFormat) = Convert(reinterpret_cast<const ImageAccessor*>(p.image)->GetFormat()); return true; } case _OrthancPluginService_GetImageWidth: { - const _OrthancPluginGetImageInfo& p = reinterpret_cast<const _OrthancPluginGetImageInfo&>(parameters); + const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetWidth(); return true; } case _OrthancPluginService_GetImageHeight: { - const _OrthancPluginGetImageInfo& p = reinterpret_cast<const _OrthancPluginGetImageInfo&>(parameters); + const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetHeight(); return true; } case _OrthancPluginService_GetImagePitch: { - const _OrthancPluginGetImageInfo& p = reinterpret_cast<const _OrthancPluginGetImageInfo&>(parameters); + const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); *(p.resultUint32) = reinterpret_cast<const ImageAccessor*>(p.image)->GetPitch(); return true; } case _OrthancPluginService_GetImageBuffer: { - const _OrthancPluginGetImageInfo& p = reinterpret_cast<const _OrthancPluginGetImageInfo&>(parameters); - *(p.resultBuffer) = reinterpret_cast<const ImageAccessor*>(p.image)->GetBuffer(); + const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); + *(p.resultBuffer) = reinterpret_cast<const ImageAccessor*>(p.image)->GetConstBuffer(); return true; } case _OrthancPluginService_FreeImage: { - const _OrthancPluginGetImageInfo& p = reinterpret_cast<const _OrthancPluginGetImageInfo&>(parameters); + const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters); delete reinterpret_cast<const ImageAccessor*>(p.image); return true; }
--- a/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Mon Aug 31 17:37:54 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Tue Sep 01 11:23:41 2015 +0200 @@ -54,7 +54,7 @@ typedef struct _OrthancPluginDatabaseContext_t OrthancPluginDatabaseContext; -//! @cond Doxygen_Suppress +/*<! @cond Doxygen_Suppress */ typedef enum { _OrthancPluginDatabaseAnswerType_None = 0, @@ -629,7 +629,7 @@ void* payload); } OrthancPluginDatabaseBackend; -//! @endcond +/*<! @endcond */ typedef struct
--- a/Plugins/Include/orthanc/OrthancCPlugin.h Mon Aug 31 17:37:54 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Tue Sep 01 11:23:41 2015 +0200 @@ -1369,7 +1369,7 @@ params.result = &result; params.argument = patientID; - if (context->InvokeService(context, _OrthancPluginService_LookupPatient, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_LookupPatient, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1403,7 +1403,7 @@ params.result = &result; params.argument = studyUID; - if (context->InvokeService(context, _OrthancPluginService_LookupStudy, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_LookupStudy, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1437,7 +1437,7 @@ params.result = &result; params.argument = accessionNumber; - if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1471,7 +1471,7 @@ params.result = &result; params.argument = seriesUID; - if (context->InvokeService(context, _OrthancPluginService_LookupSeries, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_LookupSeries, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1505,7 +1505,7 @@ params.result = &result; params.argument = sopInstanceUID; - if (context->InvokeService(context, _OrthancPluginService_LookupInstance, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_LookupInstance, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1681,7 +1681,7 @@ params.resultString = &result; params.instance = instance; - if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1713,7 +1713,7 @@ params.resultInt64 = &size; params.instance = instance; - if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return -1; @@ -1745,7 +1745,7 @@ params.resultString = &result; params.instance = instance; - if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1780,7 +1780,7 @@ params.resultStringToFree = &result; params.instance = instance; - if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1817,7 +1817,7 @@ params.resultStringToFree = &result; params.instance = instance; - if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1857,7 +1857,7 @@ params.instance = instance; params.key = metadata; - if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return -1; @@ -1894,7 +1894,7 @@ params.instance = instance; params.key = metadata; - if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1968,7 +1968,7 @@ params.result = &result; params.argument = NULL; - if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -1998,7 +1998,7 @@ params.result = &result; params.argument = NULL; - if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -2033,7 +2033,7 @@ params.result = &result; params.argument = NULL; - if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -2180,7 +2180,7 @@ params.property = property; params.value = defaultValue; - if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetGlobalProperty, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -2246,7 +2246,7 @@ memset(¶ms, 0, sizeof(params)); params.resultUint32 = &count; - if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgumentsCount, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return 0; @@ -2282,7 +2282,7 @@ params.property = (int32_t) argument; params.value = NULL; - if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetCommandLineArgument, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -2311,7 +2311,7 @@ memset(¶ms, 0, sizeof(params)); params.resultUint32 = &count; - if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetExpectedDatabaseVersion, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return 0; @@ -2343,7 +2343,7 @@ params.result = &result; params.argument = NULL; - if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, ¶ms)) + if (context->InvokeService(context, _OrthancPluginService_GetConfiguration, ¶ms) != OrthancPluginErrorCode_Success) { /* Error */ return NULL; @@ -2552,7 +2552,7 @@ params.target = &result; params.error = error; - if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, ¶ms) || + if (context->InvokeService(context, _OrthancPluginService_GetErrorDescription, ¶ms) != OrthancPluginErrorCode_Success || result == NULL) { return "Unknown error code"; @@ -2631,13 +2631,13 @@ params.image = image; params.resultPixelFormat = ⌖ - if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, image) < 0) + if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, ¶ms) != OrthancPluginErrorCode_Success) { return OrthancPluginPixelFormat_Unknown; } else { - return static_cast<OrthancPluginPixelFormat>(target); + return (OrthancPluginPixelFormat) target; } } @@ -2654,7 +2654,7 @@ params.image = image; params.resultUint32 = &width; - if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, image) < 0) + if (context->InvokeService(context, _OrthancPluginService_GetImageWidth, ¶ms) != OrthancPluginErrorCode_Success) { return 0; } @@ -2677,7 +2677,7 @@ params.image = image; params.resultUint32 = &height; - if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, image) < 0) + if (context->InvokeService(context, _OrthancPluginService_GetImageHeight, ¶ms) != OrthancPluginErrorCode_Success) { return 0; } @@ -2700,7 +2700,7 @@ params.image = image; params.resultUint32 = &pitch; - if (context->InvokeService(context, _OrthancPluginService_GetImagePixelFormat, image) < 0) + if (context->InvokeService(context, _OrthancPluginService_GetImagePitch, ¶ms) != OrthancPluginErrorCode_Success) { return 0; } @@ -2723,7 +2723,7 @@ params.resultBuffer = ⌖ params.image = image; - if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, ¶ms) < 0) + if (context->InvokeService(context, _OrthancPluginService_GetImageBuffer, ¶ms) != OrthancPluginErrorCode_Success) { return NULL; } @@ -2757,7 +2757,7 @@ params.size = size; params.format = format; - if (context->InvokeService(context, _OrthancPluginService_UncompressImage, ¶ms) < 0) + if (context->InvokeService(context, _OrthancPluginService_UncompressImage, ¶ms) != OrthancPluginErrorCode_Success) { return NULL; } @@ -2792,7 +2792,7 @@ uint32_t height; uint32_t pitch; const void* buffer; - uint32_t quality; + uint8_t quality; } _OrthancPluginCompressImage; @@ -2804,8 +2804,7 @@ uint32_t width, uint32_t height, uint32_t pitch, - const void* buffer, - uint32_t quality) + const void* buffer) { _OrthancPluginCompressImage params; memset(¶ms, 0, sizeof(params)); @@ -2816,7 +2815,7 @@ params.height = height; params.pitch = pitch; params.buffer = buffer; - params.quality = quality; + params.quality = 0; // Unused for PNG return context->InvokeService(context, _OrthancPluginService_CompressImage, ¶ms); }