# HG changeset patch # User Sebastien Jodogne # Date 1448443974 -3600 # Node ID 0ef4e6e66b560880360e6e0eefe506602ce39a82 # Parent 9ed9458aa44fcd28b5fb07825e6ceeea6db62fb6 "Origin" metadata for the instances diff -r 9ed9458aa44f -r 0ef4e6e66b56 Core/Enumerations.cpp --- a/Core/Enumerations.cpp Wed Nov 25 10:06:50 2015 +0100 +++ b/Core/Enumerations.cpp Wed Nov 25 10:32:54 2015 +0100 @@ -681,8 +681,8 @@ case RequestOrigin_DicomProtocol: return "DicomProtocol"; - case RequestOrigin_Http: - return "Http"; + case RequestOrigin_RestApi: + return "RestApi"; case RequestOrigin_Plugins: return "Plugins"; diff -r 9ed9458aa44f -r 0ef4e6e66b56 Core/Enumerations.h --- a/Core/Enumerations.h Wed Nov 25 10:06:50 2015 +0100 +++ b/Core/Enumerations.h Wed Nov 25 10:32:54 2015 +0100 @@ -370,7 +370,7 @@ { RequestOrigin_Unknown, RequestOrigin_DicomProtocol, - RequestOrigin_Http, + RequestOrigin_RestApi, RequestOrigin_Plugins, RequestOrigin_Lua }; diff -r 9ed9458aa44f -r 0ef4e6e66b56 Core/HttpServer/MongooseServer.cpp --- a/Core/HttpServer/MongooseServer.cpp Wed Nov 25 10:06:50 2015 +0100 +++ b/Core/HttpServer/MongooseServer.cpp Wed Nov 25 10:32:54 2015 +0100 @@ -727,7 +727,7 @@ { if (that->HasHandler()) { - found = that->GetHandler().Handle(output, RequestOrigin_Http, remoteIp, username.c_str(), + found = that->GetHandler().Handle(output, RequestOrigin_RestApi, remoteIp, username.c_str(), method, uri, headers, argumentsGET, body.c_str(), body.size()); } } diff -r 9ed9458aa44f -r 0ef4e6e66b56 NEWS --- a/NEWS Wed Nov 25 10:06:50 2015 +0100 +++ b/NEWS Wed Nov 25 10:32:54 2015 +0100 @@ -7,6 +7,23 @@ * Experimental support of DICOM C-Find SCP for modality worklists through plugins * Support of DICOM C-Find SCU for modality worklists ("/modalities/{dicom}/find-worklist") +REST API +-------- + +* New URIs: + - "/series/.../ordered-slices" to order the slices of a 2D+t or 3D series + - "/tools/shutdown" to stop Orthanc from the REST API + - ".../compress", ".../uncompress" and ".../is-compressed" for attachments + - "/tools/create-archive" to create ZIP from a set of resources + - "/tools/create-media" to create ZIP+DICOMDIR from a set of resources +* "/tools/create-dicom": + - Support of binary tags encoded using data URI scheme + - Support of hierarchical structures (creation of sequences) + - Create tags with unknown VR +* "/modify" can insert/modify sequences +* ".../preview" and ".../image-uint8" can return JPEG images if the HTTP Accept Header asks so +* "Origin" metadata for the instances + Minor ----- @@ -14,18 +31,7 @@ - "UnknownSopClassAccepted" to disable promiscuous mode (accept unknown SOP class UID) - New configuration option: "Dictionary" to declare custom DICOM tags * Add ".dcm" suffix to files in ZIP archives (cf. URI ".../archive") -* "/tools/create-dicom": - - Support of binary tags encoded using data URI scheme - - Support of hierarchical structures (creation of sequences) - - Create tags with unknown VR -* "/modify" can insert/modify sequences -* "/series/.../ordered-slices" to order the slices of a 2D+t or 3D image -* New URI "/tools/shutdown" to stop Orthanc from the REST API -* New URIs for attachments: ".../compress", ".../uncompress" and ".../is-compressed" * MIME content type can be associated to custom attachments (cf. "UserContentType") -* New URIs "/tools/create-archive" and "/tools/create-media" to create ZIP/DICOMDIR - from a set of resources -* ".../preview" and ".../image-uint8" can return JPEG images if the HTTP Accept Header asks so Plugins ------- diff -r 9ed9458aa44f -r 0ef4e6e66b56 OrthancServer/DicomInstanceToStore.cpp --- a/OrthancServer/DicomInstanceToStore.cpp Wed Nov 25 10:06:50 2015 +0100 +++ b/OrthancServer/DicomInstanceToStore.cpp Wed Nov 25 10:32:54 2015 +0100 @@ -202,7 +202,7 @@ break; } - case RequestOrigin_Http: + case RequestOrigin_RestApi: { result["RemoteIp"] = remoteIp_; result["Username"] = httpUsername_; @@ -236,7 +236,7 @@ { origin_ = call.GetRequestOrigin(); - if (origin_ == RequestOrigin_Http) + if (origin_ == RequestOrigin_RestApi) { remoteIp_ = call.GetRemoteIp(); httpUsername_ = call.GetUsername(); @@ -246,7 +246,7 @@ void DicomInstanceToStore::SetHttpOrigin(const char* remoteIp, const char* username) { - origin_ = RequestOrigin_Http; + origin_ = RequestOrigin_RestApi; remoteIp_ = remoteIp; httpUsername_ = username; } diff -r 9ed9458aa44f -r 0ef4e6e66b56 OrthancServer/ServerEnumerations.cpp --- a/OrthancServer/ServerEnumerations.cpp Wed Nov 25 10:06:50 2015 +0100 +++ b/OrthancServer/ServerEnumerations.cpp Wed Nov 25 10:32:54 2015 +0100 @@ -63,6 +63,7 @@ dictMetadataType_.Add(MetadataType_ModifiedFrom, "ModifiedFrom"); dictMetadataType_.Add(MetadataType_AnonymizedFrom, "AnonymizedFrom"); dictMetadataType_.Add(MetadataType_LastUpdate, "LastUpdate"); + dictMetadataType_.Add(MetadataType_Instance_Origin, "Origin"); dictContentType_.Add(FileContentType_Dicom, "dicom"); dictContentType_.Add(FileContentType_DicomAsJson, "dicom-as-json"); diff -r 9ed9458aa44f -r 0ef4e6e66b56 OrthancServer/ServerEnumerations.h --- a/OrthancServer/ServerEnumerations.h Wed Nov 25 10:06:50 2015 +0100 +++ b/OrthancServer/ServerEnumerations.h Wed Nov 25 10:32:54 2015 +0100 @@ -164,6 +164,7 @@ MetadataType_ModifiedFrom = 5, MetadataType_AnonymizedFrom = 6, MetadataType_LastUpdate = 7, + MetadataType_Instance_Origin = 8, // New in Orthanc 0.9.5 // Make sure that the value "65535" can be stored into this enumeration MetadataType_StartUser = 1024, diff -r 9ed9458aa44f -r 0ef4e6e66b56 OrthancServer/ServerIndex.cpp --- a/OrthancServer/ServerIndex.cpp Wed Nov 25 10:06:50 2015 +0100 +++ b/OrthancServer/ServerIndex.cpp Wed Nov 25 10:32:54 2015 +0100 @@ -771,6 +771,12 @@ db_.SetMetadata(instance, MetadataType_Instance_RemoteAet, instanceToStore.GetRemoteAet()); instanceMetadata[MetadataType_Instance_RemoteAet] = instanceToStore.GetRemoteAet(); + { + std::string s = EnumerationToString(instanceToStore.GetRequestOrigin()); + db_.SetMetadata(instance, MetadataType_Instance_Origin, s); + instanceMetadata[MetadataType_Instance_Origin] = s; + } + const DicomValue* value; if ((value = dicomSummary.TestAndGetValue(DICOM_TAG_INSTANCE_NUMBER)) != NULL || (value = dicomSummary.TestAndGetValue(DICOM_TAG_IMAGE_INDEX)) != NULL) diff -r 9ed9458aa44f -r 0ef4e6e66b56 Plugins/Engine/PluginsEnumerations.cpp --- a/Plugins/Engine/PluginsEnumerations.cpp Wed Nov 25 10:06:50 2015 +0100 +++ b/Plugins/Engine/PluginsEnumerations.cpp Wed Nov 25 10:32:54 2015 +0100 @@ -286,7 +286,7 @@ case RequestOrigin_DicomProtocol: return OrthancPluginInstanceOrigin_DicomProtocol; - case RequestOrigin_Http: + case RequestOrigin_RestApi: return OrthancPluginInstanceOrigin_RestApi; case RequestOrigin_Lua: diff -r 9ed9458aa44f -r 0ef4e6e66b56 UnitTestsSources/ServerIndexTests.cpp --- a/UnitTestsSources/ServerIndexTests.cpp Wed Nov 25 10:06:50 2015 +0100 +++ b/UnitTestsSources/ServerIndexTests.cpp Wed Nov 25 10:32:54 2015 +0100 @@ -799,7 +799,7 @@ DicomInstanceToStore toStore; toStore.SetSummary(instance); ASSERT_EQ(StoreStatus_Success, index.Store(instanceMetadata, toStore, attachments)); - ASSERT_EQ(2u, instanceMetadata.size()); + ASSERT_EQ(3u, instanceMetadata.size()); ASSERT_TRUE(instanceMetadata.find(MetadataType_Instance_RemoteAet) != instanceMetadata.end()); ASSERT_TRUE(instanceMetadata.find(MetadataType_Instance_ReceptionDate) != instanceMetadata.end());