annotate OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h @ 4188:a2f1c97002fe

removed bad include for win32
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 14 Sep 2020 20:34:47 +0200
parents bf7b9edf6b81
children fbc49a65340a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
4 * Department, University Hospital of Liege, Belgium
3640
94f4a18a79cc upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4110
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4110
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4110
diff changeset
10 * the License, or (at your option) any later version.
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4110
diff changeset
15 * Lesser General Public License for more details.
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4110
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4110
diff changeset
18 * License along with this program. If not, see
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4110
diff changeset
19 * <http://www.gnu.org/licenses/>.
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "DicomMap.h"
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 namespace Orthanc
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 {
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 /**
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * This class implements the hashing mechanism that is used to
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 * convert DICOM unique identifiers to Orthanc identifiers. Any
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 * Orthanc identifier for a DICOM resource corresponds to the SHA-1
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 * hash of the DICOM identifiers.
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 * \note SHA-1 hash is used because it is less sensitive to
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 * collision attacks than MD5. <a
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 * href="http://en.wikipedia.org/wiki/SHA-256#Comparison_of_SHA_functions">[Reference]</a>
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 **/
4110
d99739cbe94c make DicomInstanceHasher and ParsedDicomDir public classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
39 class ORTHANC_PUBLIC DicomInstanceHasher
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 private:
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 std::string patientId_;
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
43 std::string studyUid_;
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 std::string seriesUid_;
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
45 std::string instanceUid_;
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
46
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
47 std::string patientHash_;
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
48 std::string studyHash_;
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
49 std::string seriesHash_;
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
50 std::string instanceHash_;
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
315
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
52 void Setup(const std::string& patientId,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
53 const std::string& studyUid,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
54 const std::string& seriesUid,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
55 const std::string& instanceUid);
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
56
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 public:
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 DicomInstanceHasher(const DicomMap& instance);
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
315
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
60 DicomInstanceHasher(const std::string& patientId,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
61 const std::string& studyUid,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
62 const std::string& seriesUid,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
63 const std::string& instanceUid)
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
64 {
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
65 Setup(patientId, studyUid, seriesUid, instanceUid);
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
66 }
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 179
diff changeset
67
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 const std::string& GetPatientId() const
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return patientId_;
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
73 const std::string& GetStudyUid() const
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 {
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
75 return studyUid_;
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 }
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 const std::string& GetSeriesUid() const
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 {
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 return seriesUid_;
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 }
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
83 const std::string& GetInstanceUid() const
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
85 return instanceUid_;
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
88 const std::string& HashPatient();
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
90 const std::string& HashStudy();
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
92 const std::string& HashSeries();
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
179
78e28d0098d9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
94 const std::string& HashInstance();
178
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 };
5739b4d10a4b hashing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }