Mercurial > hg > orthanc
changeset 2987:96089d1aba4d
New "DicomDiskSize" and "DicomUncompressedSize" fields in statistics about resources
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 10 Dec 2018 10:33:58 +0100 |
parents | b1ba0a8311b5 |
children | 9cc3d40e389b |
files | NEWS OrthancServer/ServerIndex.cpp OrthancServer/ServerIndex.h |
diffstat | 3 files changed, 38 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Mon Dec 10 10:03:41 2018 +0100 +++ b/NEWS Mon Dec 10 10:33:58 2018 +0100 @@ -32,6 +32,7 @@ - "/queries/.../answers/.../query-instances" to C-FIND child instances - "/queries/.../answers/.../query-series" to C-FIND child series - "/queries/.../answers/.../query-studies" to C-FIND child studies +* New "DicomDiskSize" and "DicomUncompressedSize" fields in statistics about resources Plugins -------
--- a/OrthancServer/ServerIndex.cpp Mon Dec 10 10:03:41 2018 +0100 +++ b/OrthancServer/ServerIndex.cpp Mon Dec 10 10:33:58 2018 +0100 @@ -1779,11 +1779,13 @@ } - void ServerIndex::GetStatisticsInternal(/* out */ uint64_t& compressedSize, + void ServerIndex::GetStatisticsInternal(/* out */ uint64_t& diskSize, /* out */ uint64_t& uncompressedSize, /* out */ unsigned int& countStudies, /* out */ unsigned int& countSeries, /* out */ unsigned int& countInstances, + /* out */ uint64_t& dicomDiskSize, + /* out */ uint64_t& dicomUncompressedSize, /* in */ int64_t id, /* in */ ResourceType type) { @@ -1793,8 +1795,10 @@ countInstances = 0; countSeries = 0; countStudies = 0; - compressedSize = 0; + diskSize = 0; uncompressedSize = 0; + dicomDiskSize = 0; + dicomUncompressedSize = 0; while (!toExplore.empty()) { @@ -1813,7 +1817,13 @@ FileInfo attachment; if (db_.LookupAttachment(attachment, resource, *it)) { - compressedSize += attachment.GetCompressedSize(); + if (attachment.GetContentType() == FileContentType_Dicom) + { + dicomDiskSize += attachment.GetCompressedSize(); + dicomUncompressedSize += attachment.GetUncompressedSize(); + } + + diskSize += attachment.GetCompressedSize(); uncompressedSize += attachment.GetUncompressedSize(); } } @@ -1875,19 +1885,26 @@ } uint64_t uncompressedSize; - uint64_t compressedSize; + uint64_t diskSize; + uint64_t dicomUncompressedSize; + uint64_t dicomDiskSize; unsigned int countStudies; unsigned int countSeries; unsigned int countInstances; - GetStatisticsInternal(compressedSize, uncompressedSize, countStudies, - countSeries, countInstances, top, type); + GetStatisticsInternal(diskSize, uncompressedSize, countStudies, + countSeries, countInstances, dicomDiskSize, dicomUncompressedSize, top, type); target = Json::objectValue; - target["DiskSize"] = boost::lexical_cast<std::string>(compressedSize); - target["DiskSizeMB"] = static_cast<unsigned int>(compressedSize / MEGA_BYTES); + target["DiskSize"] = boost::lexical_cast<std::string>(diskSize); + target["DiskSizeMB"] = static_cast<unsigned int>(diskSize / MEGA_BYTES); target["UncompressedSize"] = boost::lexical_cast<std::string>(uncompressedSize); target["UncompressedSizeMB"] = static_cast<unsigned int>(uncompressedSize / MEGA_BYTES); + target["DicomDiskSize"] = boost::lexical_cast<std::string>(dicomDiskSize); + target["DicomDiskSizeMB"] = static_cast<unsigned int>(dicomDiskSize / MEGA_BYTES); + target["DicomUncompressedSize"] = boost::lexical_cast<std::string>(dicomUncompressedSize); + target["DicomUncompressedSizeMB"] = static_cast<unsigned int>(dicomUncompressedSize / MEGA_BYTES); + switch (type) { // Do NOT add "break" below this point! @@ -1907,11 +1924,13 @@ } - void ServerIndex::GetStatistics(/* out */ uint64_t& compressedSize, + void ServerIndex::GetStatistics(/* out */ uint64_t& diskSize, /* out */ uint64_t& uncompressedSize, /* out */ unsigned int& countStudies, /* out */ unsigned int& countSeries, /* out */ unsigned int& countInstances, + /* out */ uint64_t& dicomDiskSize, + /* out */ uint64_t& dicomUncompressedSize, const std::string& publicId) { boost::mutex::scoped_lock lock(mutex_); @@ -1923,8 +1942,9 @@ throw OrthancException(ErrorCode_UnknownResource); } - GetStatisticsInternal(compressedSize, uncompressedSize, countStudies, - countSeries, countInstances, top, type); + GetStatisticsInternal(diskSize, uncompressedSize, countStudies, + countSeries, countInstances, dicomDiskSize, + dicomUncompressedSize, top, type); }
--- a/OrthancServer/ServerIndex.h Mon Dec 10 10:03:41 2018 +0100 +++ b/OrthancServer/ServerIndex.h Mon Dec 10 10:33:58 2018 +0100 @@ -97,11 +97,13 @@ Orthanc::ResourceType type, const std::string& publicId); - void GetStatisticsInternal(/* out */ uint64_t& compressedSize, + void GetStatisticsInternal(/* out */ uint64_t& diskSize, /* out */ uint64_t& uncompressedSize, /* out */ unsigned int& countStudies, /* out */ unsigned int& countSeries, /* out */ unsigned int& countInstances, + /* out */ uint64_t& dicomDiskSize, + /* out */ uint64_t& dicomUncompressedSize, /* in */ int64_t id, /* in */ ResourceType type); @@ -239,11 +241,13 @@ void GetStatistics(Json::Value& target, const std::string& publicId); - void GetStatistics(/* out */ uint64_t& compressedSize, + void GetStatistics(/* out */ uint64_t& diskSize, /* out */ uint64_t& uncompressedSize, /* out */ unsigned int& countStudies, /* out */ unsigned int& countSeries, /* out */ unsigned int& countInstances, + /* out */ uint64_t& dicomDiskSize, + /* out */ uint64_t& dicomUncompressedSize, const std::string& publicId); void LookupIdentifierExact(std::list<std::string>& result,