Mercurial > hg > orthanc
changeset 2124:2b1520efa282
cleaning up
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 07 Nov 2016 12:11:34 +0100 |
parents | 1cf093cbdad8 |
children | b9bd52c72ba2 |
files | OrthancServer/OrthancFindRequestHandler.cpp OrthancServer/OrthancMoveRequestHandler.cpp OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp OrthancServer/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Scheduler/CallSystemCommand.cpp OrthancServer/Scheduler/StorePeerCommand.cpp OrthancServer/Scheduler/StoreScuCommand.cpp OrthancServer/ServerContext.cpp OrthancServer/ServerContext.h Plugins/Engine/OrthancPlugins.cpp |
diffstat | 10 files changed, 31 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/OrthancFindRequestHandler.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/OrthancFindRequestHandler.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -121,7 +121,7 @@ it = instances.begin(); it != instances.end(); ++it) { Json::Value dicom; - context.ReadJson(dicom, *it); + context.ReadDicomAsJson(dicom, *it); if (dicom.isMember(formatted)) { @@ -660,7 +660,7 @@ for (size_t i = 0; i < instances.size(); i++) { Json::Value dicom; - context_.ReadJson(dicom, instances[i]); + context_.ReadDicomAsJson(dicom, instances[i]); if (finder.IsMatch(dicom)) {
--- a/OrthancServer/OrthancMoveRequestHandler.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/OrthancMoveRequestHandler.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -93,7 +93,7 @@ const std::string& id = instances_[position_++]; std::string dicom; - context_.ReadFile(dicom, id, FileContentType_Dicom); + context_.ReadDicom(dicom, id); { ReusableDicomUserConnection::Locker locker
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -674,7 +674,7 @@ throw OrthancException(ErrorCode_InternalError); } - context.ReadJson(siblingTags, siblingInstances.front()); + context.ReadDicomAsJson(siblingTags, siblingInstances.front()); }
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -187,7 +187,7 @@ std::string publicId = call.GetUriComponent("id", ""); std::string dicom; - context.ReadFile(dicom, publicId, FileContentType_Dicom); + context.ReadDicom(dicom, publicId); std::string target; call.BodyToString(target); @@ -207,7 +207,7 @@ if (simplify) { Json::Value full; - context.ReadJson(full, publicId); + context.ReadDicomAsJson(full, publicId); Json::Value simplified; ServerToolbox::SimplifyTags(simplified, full, DicomToJsonFormat_Human); @@ -380,7 +380,7 @@ { // TODO create a cache of file std::string dicomContent; - context.ReadFile(dicomContent, publicId, FileContentType_Dicom); + context.ReadDicom(dicomContent, publicId); decoded.reset(context.GetPlugins().DecodeUnsafe(dicomContent.c_str(), dicomContent.size(), frame)); /** @@ -450,7 +450,7 @@ std::string publicId = call.GetUriComponent("id", ""); std::string dicomContent; - context.ReadFile(dicomContent, publicId, FileContentType_Dicom); + context.ReadDicom(dicomContent, publicId); #if ORTHANC_PLUGINS_ENABLED == 1 IDicomImageDecoder& decoder = context.GetPlugins(); @@ -871,7 +871,7 @@ try { - context.ReadJson(tags, *it); + context.ReadDicomAsJson(tags, *it); } catch (OrthancException&) { @@ -989,7 +989,7 @@ publicId = instances.front(); } - context.ReadJson(tags, publicId); + context.ReadDicomAsJson(tags, publicId); // Filter the tags of the instance according to the module Json::Value result = Json::objectValue; @@ -1206,7 +1206,7 @@ it != instances.end(); ++it) { Json::Value full; - context.ReadJson(full, *it); + context.ReadDicomAsJson(full, *it); if (simplify) { @@ -1295,7 +1295,7 @@ bool simplify = call.HasArgument("simplify"); std::string dicomContent; - context.ReadFile(dicomContent, publicId, FileContentType_Dicom); + context.ReadDicom(dicomContent, publicId); // TODO Consider using "DicomMap::ParseDicomMetaInformation()" to // speed up things here
--- a/OrthancServer/Scheduler/CallSystemCommand.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/Scheduler/CallSystemCommand.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -59,7 +59,7 @@ try { std::string dicom; - context_.ReadFile(dicom, *it, FileContentType_Dicom); + context_.ReadDicom(dicom, *it); Toolbox::TemporaryFile tmp; tmp.Write(dicom);
--- a/OrthancServer/Scheduler/StorePeerCommand.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/Scheduler/StorePeerCommand.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -62,7 +62,7 @@ try { - context_.ReadFile(client.GetBody(), *it, FileContentType_Dicom); + context_.ReadDicom(client.GetBody(), *it); std::string answer; if (!client.Apply(answer))
--- a/OrthancServer/Scheduler/StoreScuCommand.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/Scheduler/StoreScuCommand.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -64,7 +64,7 @@ try { std::string dicom; - context_.ReadFile(dicom, *it, FileContentType_Dicom); + context_.ReadDicom(dicom, *it); locker.GetConnection().Store(dicom, moveOriginatorID_);
--- a/OrthancServer/ServerContext.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/ServerContext.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -368,11 +368,11 @@ } - void ServerContext::ReadJson(Json::Value& result, - const std::string& instancePublicId) + void ServerContext::ReadDicomAsJson(Json::Value& result, + const std::string& instancePublicId) { std::string s; - ReadFile(s, instancePublicId, FileContentType_DicomAsJson); + ReadFile(s, instancePublicId, FileContentType_DicomAsJson, true /* decompress if needed */); Json::Reader reader; if (!reader.parse(s, result)) @@ -418,7 +418,7 @@ IDynamicObject* ServerContext::DicomCacheProvider::Provide(const std::string& instancePublicId) { std::string content; - context_.ReadFile(content, instancePublicId, FileContentType_Dicom); + context_.ReadDicom(content, instancePublicId); return new ParsedDicomFile(content); } @@ -567,7 +567,7 @@ for (size_t i = 0; i < instances.size(); i++) { Json::Value dicom; - ReadJson(dicom, instances[i]); + ReadDicomAsJson(dicom, instances[i]); if (lookup.IsMatch(dicom)) {
--- a/OrthancServer/ServerContext.h Mon Nov 07 11:51:40 2016 +0100 +++ b/OrthancServer/ServerContext.h Mon Nov 07 12:11:34 2016 +0100 @@ -191,14 +191,20 @@ FileContentType attachmentType, CompressionType compression); - void ReadJson(Json::Value& result, - const std::string& instancePublicId); + void ReadDicomAsJson(Json::Value& result, + const std::string& instancePublicId); + void ReadDicom(std::string& dicom, + const std::string& instancePublicId) + { + ReadFile(dicom, instancePublicId, FileContentType_Dicom, true); + } + // TODO CACHING MECHANISM AT THIS POINT void ReadFile(std::string& result, const std::string& instancePublicId, FileContentType content, - bool uncompressIfNeeded = true); + bool uncompressIfNeeded); void ReadFile(std::string& result, const FileInfo& file);
--- a/Plugins/Engine/OrthancPlugins.cpp Mon Nov 07 11:51:40 2016 +0100 +++ b/Plugins/Engine/OrthancPlugins.cpp Mon Nov 07 12:11:34 2016 +0100 @@ -1278,7 +1278,7 @@ { PImpl::ServerContextLock lock(*pimpl_); - lock.GetContext().ReadFile(dicom, p.instanceId, FileContentType_Dicom); + lock.GetContext().ReadDicom(dicom, p.instanceId); } CopyToMemoryBuffer(*p.target, dicom); @@ -1948,7 +1948,7 @@ { PImpl::ServerContextLock lock(*pimpl_); - lock.GetContext().ReadFile(content, p.instanceId, FileContentType_Dicom); + lock.GetContext().ReadDicom(content, p.instanceId); } dicom.reset(new ParsedDicomFile(content));