Mercurial > hg > orthanc
diff OrthancServer/ServerToolbox.cpp @ 2209:e3fd5bc429a2
URI to reconstruct the main DICOM tags, the JSON summary and the metadata
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Dec 2016 17:20:21 +0100 |
parents | 0c09d1af22f3 |
children | a3a65de1840f |
line wrap: on
line diff
--- a/OrthancServer/ServerToolbox.cpp Fri Dec 09 14:48:31 2016 +0100 +++ b/OrthancServer/ServerToolbox.cpp Fri Dec 09 17:20:21 2016 +0100 @@ -37,7 +37,6 @@ #include "../Core/FileStorage/StorageAccessor.h" #include "../Core/Logging.h" #include "../Core/OrthancException.h" -#include "ParsedDicomFile.h" #include <cassert> @@ -406,7 +405,7 @@ // Update the tags of this resource DicomMap dicomSummary; - dicom.Convert(dicomSummary); + dicom.ExtractDicomSummary(dicomSummary); database.ClearMainDicomTags(resource); StoreMainDicomTags(database, resource, level, dicomSummary); @@ -497,5 +496,29 @@ return false; } + + + void ReconstructResource(ServerContext& context, + const std::string& resource) + { + LOG(WARNING) << "Reconstructing resource " << resource; + + std::list<std::string> instances; + context.GetIndex().GetChildInstances(instances, resource); + + for (std::list<std::string>::const_iterator + it = instances.begin(); it != instances.end(); ++it) + { + ServerContext::DicomCacheLocker locker(context, *it); + + Json::Value dicomAsJson; + locker.GetDicom().ExtractDicomAsJson(dicomAsJson); + + std::string s = dicomAsJson.toStyledString(); + context.AddAttachment(*it, FileContentType_DicomAsJson, s.c_str(), s.size()); + + context.GetIndex().ReconstructInstance(locker.GetDicom()); + } + } } }