comparison OrthancServer/Sources/ServerToolbox.cpp @ 4140:0ddc5297a8ab

centralization of default parameters for JSON/DicomMap conversions from DCMTK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Aug 2020 10:46:50 +0200
parents a4f28efdfccf
children d9473bd5ed43
comparison
equal deleted inserted replaced
4139:a4f28efdfccf 4140:0ddc5297a8ab
39 #include "../../OrthancFramework/Sources/FileStorage/StorageAccessor.h" 39 #include "../../OrthancFramework/Sources/FileStorage/StorageAccessor.h"
40 #include "../../OrthancFramework/Sources/Logging.h" 40 #include "../../OrthancFramework/Sources/Logging.h"
41 #include "../../OrthancFramework/Sources/OrthancException.h" 41 #include "../../OrthancFramework/Sources/OrthancException.h"
42 #include "Database/IDatabaseWrapper.h" 42 #include "Database/IDatabaseWrapper.h"
43 #include "Database/ResourcesContent.h" 43 #include "Database/ResourcesContent.h"
44 #include "OrthancConfiguration.h"
44 #include "ServerContext.h" 45 #include "ServerContext.h"
45 46
46 #include <cassert> 47 #include <cassert>
47 48
48 namespace Orthanc 49 namespace Orthanc
267 268
268 ParsedDicomFile dicom(content); 269 ParsedDicomFile dicom(content);
269 270
270 // Update the tags of this resource 271 // Update the tags of this resource
271 DicomMap dicomSummary; 272 DicomMap dicomSummary;
272 dicom.ExtractDicomSummary(dicomSummary, ORTHANC_MAXIMUM_TAG_LENGTH); 273 OrthancConfiguration::DefaultExtractDicomSummary(dicomSummary, dicom);
273 274
274 database.ClearMainDicomTags(resource); 275 database.ClearMainDicomTags(resource);
275 276
276 ResourcesContent tags; 277 ResourcesContent tags;
277 tags.AddResource(resource, level, dicomSummary); 278 tags.AddResource(resource, level, dicomSummary);
377 it = instances.begin(); it != instances.end(); ++it) 378 it = instances.begin(); it != instances.end(); ++it)
378 { 379 {
379 ServerContext::DicomCacheLocker locker(context, *it); 380 ServerContext::DicomCacheLocker locker(context, *it);
380 381
381 Json::Value dicomAsJson; 382 Json::Value dicomAsJson;
382 locker.GetDicom().DatasetToJson(dicomAsJson); 383 OrthancConfiguration::DefaultDicomDatasetToJson(dicomAsJson, locker.GetDicom());
383 384
384 std::string s = dicomAsJson.toStyledString(); 385 std::string s = dicomAsJson.toStyledString();
385 context.AddAttachment(*it, FileContentType_DicomAsJson, s.c_str(), s.size()); 386 context.AddAttachment(*it, FileContentType_DicomAsJson, s.c_str(), s.size());
386 387
387 context.GetIndex().ReconstructInstance(locker.GetDicom()); 388 context.GetIndex().ReconstructInstance(locker.GetDicom());