Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h @ 5111:7547c7dfd017
/tools/metrics-prometheus: added orthanc_last_change and orthanc_up_time_s
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 22 Nov 2022 18:01:23 +0100 |
parents | c767035fff77 |
children | 0ea402b4d901 |
rev | line source |
---|---|
178 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 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 |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
178 | 7 * |
8 * 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
|
9 * 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
|
10 * 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
|
11 * the License, or (at your option) any later version. |
178 | 12 * |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * 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
|
16 * Lesser General Public License for more details. |
178 | 17 * |
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
|
18 * 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
|
19 * 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
|
20 * <http://www.gnu.org/licenses/>. |
178 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
26 #include "DicomMap.h" | |
27 | |
28 namespace Orthanc | |
29 { | |
30 /** | |
31 * This class implements the hashing mechanism that is used to | |
32 * convert DICOM unique identifiers to Orthanc identifiers. Any | |
33 * Orthanc identifier for a DICOM resource corresponds to the SHA-1 | |
34 * hash of the DICOM identifiers. | |
35 | |
36 * \note SHA-1 hash is used because it is less sensitive to | |
37 * collision attacks than MD5. <a | |
38 * href="http://en.wikipedia.org/wiki/SHA-256#Comparison_of_SHA_functions">[Reference]</a> | |
39 **/ | |
4110
d99739cbe94c
make DicomInstanceHasher and ParsedDicomDir public classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
40 class ORTHANC_PUBLIC DicomInstanceHasher |
178 | 41 { |
42 private: | |
43 std::string patientId_; | |
179 | 44 std::string studyUid_; |
178 | 45 std::string seriesUid_; |
179 | 46 std::string instanceUid_; |
47 | |
4985 | 48 mutable std::string patientHash_; |
49 mutable std::string studyHash_; | |
50 mutable std::string seriesHash_; | |
51 mutable std::string instanceHash_; | |
178 | 52 |
315 | 53 void Setup(const std::string& patientId, |
54 const std::string& studyUid, | |
55 const std::string& seriesUid, | |
56 const std::string& instanceUid); | |
57 | |
178 | 58 public: |
4199 | 59 explicit DicomInstanceHasher(const DicomMap& instance); |
178 | 60 |
315 | 61 DicomInstanceHasher(const std::string& patientId, |
62 const std::string& studyUid, | |
63 const std::string& seriesUid, | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
64 const std::string& instanceUid); |
315 | 65 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
66 const std::string& GetPatientId() const; |
178 | 67 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
68 const std::string& GetStudyUid() const; |
178 | 69 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
70 const std::string& GetSeriesUid() const; |
178 | 71 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
72 const std::string& GetInstanceUid() const; |
178 | 73 |
4985 | 74 const std::string& HashPatient() const; |
178 | 75 |
4985 | 76 const std::string& HashStudy() const; |
178 | 77 |
4985 | 78 const std::string& HashSeries() const; |
178 | 79 |
4985 | 80 const std::string& HashInstance() const; |
178 | 81 }; |
82 } |