Mercurial > hg > orthanc
comparison Core/DicomFormat/DicomInstanceHasher.cpp @ 315:fc856d175d18
modifications
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 21 Dec 2012 17:18:04 +0100 |
parents | 78e28d0098d9 |
children | bdd72233b105 |
comparison
equal
deleted
inserted
replaced
314:4f17834a50b6 | 315:fc856d175d18 |
---|---|
34 #include "../OrthancException.h" | 34 #include "../OrthancException.h" |
35 #include "../Toolbox.h" | 35 #include "../Toolbox.h" |
36 | 36 |
37 namespace Orthanc | 37 namespace Orthanc |
38 { | 38 { |
39 DicomInstanceHasher::DicomInstanceHasher(const DicomMap& instance) | 39 void DicomInstanceHasher::Setup(const std::string& patientId, |
40 const std::string& studyUid, | |
41 const std::string& seriesUid, | |
42 const std::string& instanceUid) | |
40 { | 43 { |
41 patientId_ = instance.GetValue(DICOM_TAG_PATIENT_ID).AsString(); | 44 patientId_ = patientId; |
42 studyUid_ = instance.GetValue(DICOM_TAG_STUDY_INSTANCE_UID).AsString(); | 45 studyUid_ = studyUid; |
43 seriesUid_ = instance.GetValue(DICOM_TAG_SERIES_INSTANCE_UID).AsString(); | 46 seriesUid_ = seriesUid; |
44 instanceUid_ = instance.GetValue(DICOM_TAG_SOP_INSTANCE_UID).AsString(); | 47 instanceUid_ = instanceUid; |
45 | 48 |
46 if (patientId_.size() == 0 || | 49 if (patientId_.size() == 0 || |
47 studyUid_.size() == 0 || | 50 studyUid_.size() == 0 || |
48 seriesUid_.size() == 0 || | 51 seriesUid_.size() == 0 || |
49 instanceUid_.size() == 0) | 52 instanceUid_.size() == 0) |
50 { | 53 { |
51 throw OrthancException(ErrorCode_BadFileFormat); | 54 throw OrthancException(ErrorCode_BadFileFormat); |
52 } | 55 } |
56 } | |
57 | |
58 DicomInstanceHasher::DicomInstanceHasher(const DicomMap& instance) | |
59 { | |
60 Setup(instance.GetValue(DICOM_TAG_PATIENT_ID).AsString(), | |
61 instance.GetValue(DICOM_TAG_STUDY_INSTANCE_UID).AsString(), | |
62 instance.GetValue(DICOM_TAG_SERIES_INSTANCE_UID).AsString(), | |
63 instance.GetValue(DICOM_TAG_SOP_INSTANCE_UID).AsString()); | |
53 } | 64 } |
54 | 65 |
55 const std::string& DicomInstanceHasher::HashPatient() | 66 const std::string& DicomInstanceHasher::HashPatient() |
56 { | 67 { |
57 if (patientHash_.size() == 0) | 68 if (patientHash_.size() == 0) |