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