Mercurial > hg > orthanc-stone
annotate Applications/Resources/Graveyard/Toolbox/DicomDataset.h @ 2087:51c8b21b81e4
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Nov 2023 18:11:13 +0100 |
parents | 07964689cb0b |
children | c23eef785569 |
rev | line source |
---|---|
39 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
2077
07964689cb0b
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
07964689cb0b
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
39 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
47 | 9 * modify it under the terms of the GNU Affero General Public License |
10 * as published by the Free Software Foundation, either version 3 of | |
11 * the License, or (at your option) any later version. | |
39 | 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 | |
47 | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Affero General Public License for more details. | |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1586
diff
changeset
|
17 * |
47 | 18 * You should have received a copy of the GNU Affero General Public License |
39 | 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "../../Resources/Orthanc/Plugins/Samples/Common/IOrthancConnection.h" | |
26 | |
27 #include <map> | |
28 #include <stdint.h> | |
29 #include <json/value.h> | |
30 | |
31 namespace OrthancStone | |
32 { | |
33 // This class is NOT thread-safe | |
34 // This is a lightweight alternative to Orthanc::DicomMap | |
35 class DicomDataset : public boost::noncopyable | |
36 { | |
37 public: | |
38 typedef std::pair<uint16_t, uint16_t> Tag; | |
39 | |
40 private: | |
41 typedef std::map<Tag, std::string> Values; | |
42 | |
43 Values values_; | |
44 | |
45 void Parse(const std::string& content); | |
46 | |
47 void Parse(const Json::Value& content); | |
48 | |
49 public: | |
50 DicomDataset(const std::string& content) | |
51 { | |
52 Parse(content); | |
53 } | |
54 | |
55 DicomDataset(const Json::Value& content) | |
56 { | |
57 Parse(content); | |
58 } | |
59 | |
60 DicomDataset(OrthancPlugins::IOrthancConnection& orthanc, | |
61 const std::string& instanceId); | |
62 | |
63 bool HasTag(const Tag& tag) const | |
64 { | |
65 return values_.find(tag) != values_.end(); | |
66 } | |
67 | |
68 std::string GetStringValue(const Tag& tag) const; | |
69 | |
70 std::string GetStringValue(const Tag& tag, | |
71 const std::string& defaultValue) const; | |
72 | |
73 float GetFloatValue(const Tag& tag) const; | |
74 | |
75 double GetDoubleValue(const Tag& tag) const; | |
76 | |
77 int GetIntegerValue(const Tag& tag) const; | |
78 | |
79 unsigned int GetUnsignedIntegerValue(const Tag& tag) const; | |
80 | |
81 void GetVectorValue(Vector& vector, | |
82 const Tag& tag, | |
83 size_t expectedSize) const; | |
84 | |
85 void GetVectorValue(Vector& vector, | |
86 const Tag& tag) const; | |
87 | |
88 void Print() const; | |
89 | |
90 bool IsGrayscale() const; | |
91 | |
92 void GetPixelSpacing(double& spacingX, | |
93 double& spacingY) const; | |
94 }; | |
95 | |
96 | |
97 static const DicomDataset::Tag DICOM_TAG_COLUMNS(0x0028, 0x0011); | |
98 static const DicomDataset::Tag DICOM_TAG_IMAGE_ORIENTATION_PATIENT(0x0020, 0x0037); | |
99 static const DicomDataset::Tag DICOM_TAG_IMAGE_POSITION_PATIENT(0x0020, 0x0032); | |
100 static const DicomDataset::Tag DICOM_TAG_NUMBER_OF_FRAMES(0x0028, 0x0008); | |
101 static const DicomDataset::Tag DICOM_TAG_PIXEL_REPRESENTATION(0x0028, 0x0103); | |
102 static const DicomDataset::Tag DICOM_TAG_PIXEL_SPACING(0x0028, 0x0030); | |
103 static const DicomDataset::Tag DICOM_TAG_RESCALE_INTERCEPT(0x0028, 0x1052); | |
104 static const DicomDataset::Tag DICOM_TAG_RESCALE_SLOPE(0x0028, 0x1053); | |
105 static const DicomDataset::Tag DICOM_TAG_ROWS(0x0028, 0x0010); | |
106 static const DicomDataset::Tag DICOM_TAG_SLICE_THICKNESS(0x0018, 0x0050); | |
107 static const DicomDataset::Tag DICOM_TAG_WINDOW_CENTER(0x0028, 0x1050); | |
108 static const DicomDataset::Tag DICOM_TAG_WINDOW_WIDTH(0x0028, 0x1051); | |
109 static const DicomDataset::Tag DICOM_TAG_PHOTOMETRIC_INTERPRETATION(0x0028, 0x0004); | |
110 } |