Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi.cpp @ 187:8e673a65564d
refactoring of storing new instances
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 12 Nov 2012 17:29:11 +0100 |
parents | 93e1b0e3b83a |
children | b6cef9d45cc3 |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp Mon Nov 12 15:29:07 2012 +0100 +++ b/OrthancServer/OrthancRestApi.cpp Mon Nov 12 17:29:11 2012 +0100 @@ -133,30 +133,30 @@ { DicomMap dicomSummary; FromDcmtkBridge::Convert(dicomSummary, *dicomFile.getDataset()); - + + DicomInstanceHasher hasher(dicomSummary); + Json::Value dicomJson; FromDcmtkBridge::ToJson(dicomJson, *dicomFile.getDataset()); - std::string instanceUuid; StoreStatus status = StoreStatus_Failure; if (postData.size() > 0) { status = index_.Store - (instanceUuid, storage_, reinterpret_cast<const char*>(&postData[0]), + (storage_, reinterpret_cast<const char*>(&postData[0]), postData.size(), dicomSummary, dicomJson, ""); } + result["ID"] = hasher.HashInstance(); + result["Path"] = "/instances/" + hasher.HashInstance(); + switch (status) { case StoreStatus_Success: - result["ID"] = instanceUuid; - result["Path"] = "/instances/" + instanceUuid; result["Status"] = "Success"; return true; case StoreStatus_AlreadyStored: - result["ID"] = instanceUuid; - result["Path"] = "/instances/" + instanceUuid; result["Status"] = "AlreadyStored"; return true; @@ -427,6 +427,8 @@ result = Json::Value(Json::objectValue); result["Version"] = ORTHANC_VERSION; result["Name"] = GetGlobalStringParameter("Name", ""); + result["TotalCompressedSize"] = boost::lexical_cast<std::string>(index_.GetTotalCompressedSize()); + result["TotalUncompressedSize"] = boost::lexical_cast<std::string>(index_.GetTotalUncompressedSize()); existingResource = true; } else