comparison OrthancServer/ServerToolbox.cpp @ 1673:0bbcfd9695e5 db-changes

UpgradeDatabase in the sample plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Oct 2015 13:26:05 +0200
parents a412ad57f0f9
children 2ad22b2970a2
comparison
equal deleted inserted replaced
1672:4c5a85c3ff43 1673:0bbcfd9695e5
31 31
32 32
33 #include "PrecompiledHeadersServer.h" 33 #include "PrecompiledHeadersServer.h"
34 #include "ServerToolbox.h" 34 #include "ServerToolbox.h"
35 35
36 #include "../Core/DicomFormat/DicomArray.h"
37 #include "../Core/FileStorage/StorageAccessor.h"
36 #include "../Core/Logging.h" 38 #include "../Core/Logging.h"
37 #include "../Core/OrthancException.h" 39 #include "../Core/OrthancException.h"
38 #include "../Core/DicomFormat/DicomArray.h"
39 #include "ParsedDicomFile.h" 40 #include "ParsedDicomFile.h"
40 41
41 #include <cassert> 42 #include <cassert>
42 43
43 namespace Orthanc 44 namespace Orthanc
284 { 285 {
285 throw OrthancException(ErrorCode_InternalError); 286 throw OrthancException(ErrorCode_InternalError);
286 } 287 }
287 288
288 // Read and parse the content of the DICOM file 289 // Read and parse the content of the DICOM file
290 StorageAccessor accessor(storageArea);
291
289 std::string content; 292 std::string content;
290 storageArea.Read(content, attachment.GetUuid(), FileContentType_Dicom); 293 accessor.Read(content, attachment);
291 294
292 ParsedDicomFile dicom(content); 295 ParsedDicomFile dicom(content);
293 296
294 // Update the tags of this resource 297 // Update the tags of this resource
295 DicomMap dicomSummary; 298 DicomMap dicomSummary;
304 break; 307 break;
305 308
306 case ResourceType_Study: 309 case ResourceType_Study:
307 Toolbox::SetMainDicomTags(database, resource, ResourceType_Study, dicomSummary, true); 310 Toolbox::SetMainDicomTags(database, resource, ResourceType_Study, dicomSummary, true);
308 311
309 // Duplicate the patient tags at the study level 312 // Duplicate the patient tags at the study level (new in Orthanc 0.9.5 - db v6)
310 Toolbox::SetMainDicomTags(database, resource, ResourceType_Patient, dicomSummary, false); 313 Toolbox::SetMainDicomTags(database, resource, ResourceType_Patient, dicomSummary, false);
311 break; 314 break;
312 315
313 case ResourceType_Series: 316 case ResourceType_Series:
314 Toolbox::SetMainDicomTags(database, resource, ResourceType_Series, dicomSummary, true); 317 Toolbox::SetMainDicomTags(database, resource, ResourceType_Series, dicomSummary, true);