Mercurial > hg > orthanc
comparison OrthancServer/ServerToolbox.cpp @ 1711:5ebd6cbb3da8 db-changes
Backed out changeset 2ad22b2970a2
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 16 Oct 2015 17:36:07 +0200 |
parents | 2ad22b2970a2 |
children | 4db9200c7f46 |
comparison
equal
deleted
inserted
replaced
1709:2ad22b2970a2 | 1711:5ebd6cbb3da8 |
---|---|
305 case ResourceType_Patient: | 305 case ResourceType_Patient: |
306 Toolbox::SetMainDicomTags(database, resource, ResourceType_Patient, dicomSummary, true); | 306 Toolbox::SetMainDicomTags(database, resource, ResourceType_Patient, dicomSummary, true); |
307 break; | 307 break; |
308 | 308 |
309 case ResourceType_Study: | 309 case ResourceType_Study: |
310 { | |
311 Toolbox::SetMainDicomTags(database, resource, ResourceType_Study, dicomSummary, true); | 310 Toolbox::SetMainDicomTags(database, resource, ResourceType_Study, dicomSummary, true); |
312 | 311 |
313 // Duplicate the patient tags at the study level (new in Orthanc 0.9.5 - db v6) | 312 // Duplicate the patient tags at the study level (new in Orthanc 0.9.5 - db v6) |
314 Toolbox::SetMainDicomTags(database, resource, ResourceType_Patient, dicomSummary, false); | 313 Toolbox::SetMainDicomTags(database, resource, ResourceType_Patient, dicomSummary, false); |
315 | |
316 DicomMap module; | |
317 Toolbox::ExtractModule(module, dicomSummary, DicomModule_Patient, true /* normalize */); | |
318 Toolbox::ExtractModule(module, dicomSummary, DicomModule_Study, true /* normalize */); | |
319 database.StoreStudyModule(resource, module); | |
320 | |
321 break; | 314 break; |
322 } | |
323 | 315 |
324 case ResourceType_Series: | 316 case ResourceType_Series: |
325 Toolbox::SetMainDicomTags(database, resource, ResourceType_Series, dicomSummary, true); | 317 Toolbox::SetMainDicomTags(database, resource, ResourceType_Series, dicomSummary, true); |
326 break; | 318 break; |
327 | 319 |
332 default: | 324 default: |
333 throw OrthancException(ErrorCode_InternalError); | 325 throw OrthancException(ErrorCode_InternalError); |
334 } | 326 } |
335 } | 327 } |
336 } | 328 } |
337 | |
338 | |
339 void ExtractModule(DicomMap& result, // WARNING: Will not be cleared! | |
340 const DicomMap& summary, | |
341 DicomModule module, | |
342 bool normalize) | |
343 { | |
344 typedef std::set<DicomTag> ModuleTags; | |
345 ModuleTags moduleTags; | |
346 DicomTag::AddTagsForModule(moduleTags, module); | |
347 | |
348 for (ModuleTags::const_iterator tag = moduleTags.begin(); tag != moduleTags.end(); ++tag) | |
349 { | |
350 const DicomValue* value = summary.TestAndGetValue(*tag); | |
351 if (value != NULL && | |
352 !value->IsNull()) | |
353 { | |
354 std::string t = value->AsString(); | |
355 | |
356 if (normalize) | |
357 { | |
358 t = StripSpaces(ConvertToAscii(t)); | |
359 ToUpperCase(t); | |
360 } | |
361 | |
362 result.SetValue(*tag, t); | |
363 } | |
364 } | |
365 } | |
366 } | 329 } |
367 } | 330 } |