Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerToolbox.cpp @ 5558:c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Fri, 19 Apr 2024 11:27:39 +0200 |
parents | 48b8dae6dc77 |
children | f7adfb22e20e |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerToolbox.cpp Fri Apr 19 10:52:44 2024 +0200 +++ b/OrthancServer/Sources/ServerToolbox.cpp Fri Apr 19 11:27:39 2024 +0200 @@ -280,32 +280,43 @@ void ReconstructResource(ServerContext& context, const std::string& resource, - bool reconstructFiles) + bool reconstructFiles, + bool limitToThisLevelDicomTags, + ResourceType limitToLevel) { 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) + + if (limitToThisLevelDicomTags && instances.size() > 0) // in this case, we only need to rebuild one instance ! { - ServerContext::DicomCacheLocker locker(context, *it); + ServerContext::DicomCacheLocker locker(context, instances.front()); + context.GetIndex().ReconstructInstance(locker.GetDicom(), true, limitToLevel); + } + else + { + for (std::list<std::string>::const_iterator + it = instances.begin(); it != instances.end(); ++it) + { + ServerContext::DicomCacheLocker locker(context, *it); - // Delay the reconstruction of DICOM-as-JSON to its next access through "ServerContext" - context.GetIndex().DeleteAttachment(*it, FileContentType_DicomAsJson, false /* no revision */, - -1 /* dummy revision */, "" /* dummy MD5 */); - - context.GetIndex().ReconstructInstance(locker.GetDicom()); + // Delay the reconstruction of DICOM-as-JSON to its next access through "ServerContext" + context.GetIndex().DeleteAttachment(*it, FileContentType_DicomAsJson, false /* no revision */, + -1 /* dummy revision */, "" /* dummy MD5 */); + + context.GetIndex().ReconstructInstance(locker.GetDicom(), false, ResourceType_Instance /* dummy */); - if (reconstructFiles) - { - std::string resultPublicId; // ignored - std::unique_ptr<DicomInstanceToStore> dicomInstancetoStore(DicomInstanceToStore::CreateFromParsedDicomFile(locker.GetDicom())); + if (reconstructFiles) + { + std::string resultPublicId; // ignored + std::unique_ptr<DicomInstanceToStore> dicomInstancetoStore(DicomInstanceToStore::CreateFromParsedDicomFile(locker.GetDicom())); - // TODO: TranscodeAndStore and specifically ServerIndex::Store have been "poluted" by the isReconstruct parameter - // we should very likely refactor it - context.TranscodeAndStore(resultPublicId, dicomInstancetoStore.get(), StoreInstanceMode_OverwriteDuplicate, true); + // TODO: TranscodeAndStore and specifically ServerIndex::Store have been "poluted" by the isReconstruct parameter + // we should very likely refactor it + context.TranscodeAndStore(resultPublicId, dicomInstancetoStore.get(), StoreInstanceMode_OverwriteDuplicate, true); + } } } }