Mercurial > hg > orthanc
annotate OrthancServer/FromDcmtkBridge.h @ 72:0d562da696be Orthanc-0.2.0
close
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 29 Apr 2013 12:54:39 +0200 |
parents | a70bb32802ae |
children | fe180eae201d |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
0 | 3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, |
4 * Belgium | |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 **/ | |
19 | |
20 | |
21 #pragma once | |
22 | |
23 #include "../Core/DicomFormat/DicomMap.h" | |
24 #include <dcmtk/dcmdata/dcdatset.h> | |
25 #include <json/json.h> | |
26 | |
62 | 27 namespace Orthanc |
0 | 28 { |
42
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
29 enum ImageExtractionMode |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
30 { |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
31 ImageExtractionMode_Preview, |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
32 ImageExtractionMode_UInt8, |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
33 ImageExtractionMode_UInt16 |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
34 }; |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
35 |
0 | 36 class FromDcmtkBridge |
37 { | |
38 public: | |
39 static void Convert(DicomMap& target, DcmDataset& dataset); | |
40 | |
41 static DicomTag GetTag(const DcmElement& element); | |
42 | |
43 static DicomValue* ConvertLeafElement(DcmElement& element); | |
44 | |
45 static void ToJson(Json::Value& target, | |
46 DcmDataset& dataset, | |
47 unsigned int maxStringLength = 256); | |
48 | |
49 static void ToJson(Json::Value& target, | |
50 const std::string& path, | |
51 unsigned int maxStringLength = 256); | |
52 | |
42
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
53 static void ExtractPngImage(std::string& result, |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
54 DcmDataset& dataset, |
53
293038baf8f1
access to multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
50
diff
changeset
|
55 unsigned int frame, |
42
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
56 ImageExtractionMode mode); |
0 | 57 |
42
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
58 static void ExtractPngImage(std::string& result, |
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
59 const std::string& dicomContent, |
53
293038baf8f1
access to multi-frame images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
50
diff
changeset
|
60 unsigned int frame, |
42
ea48f38afe5f
access to raw images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
41
diff
changeset
|
61 ImageExtractionMode mode); |
0 | 62 |
63 static std::string GetName(const DicomTag& tag); | |
64 | |
65 static DicomTag FindTag(const char* name); | |
66 | |
67 static DicomTag FindTag(const std::string& name) | |
68 { | |
69 return FindTag(name.c_str()); | |
70 } | |
71 | |
72 static bool HasTag(const DicomMap& fields, | |
73 const std::string& tagName) | |
74 { | |
75 return fields.HasTag(FindTag(tagName)); | |
76 } | |
77 | |
78 static const DicomValue& GetValue(const DicomMap& fields, | |
79 const std::string& tagName) | |
80 { | |
81 return fields.GetValue(FindTag(tagName)); | |
82 } | |
83 | |
84 static void SetValue(DicomMap& target, | |
85 const std::string& tagName, | |
86 DicomValue* value) | |
87 { | |
88 target.SetValue(FindTag(tagName), value); | |
89 } | |
90 | |
91 static void Print(FILE* fp, | |
92 const DicomMap& m); | |
93 | |
94 static void ToJson(Json::Value& result, | |
95 const DicomMap& values); | |
96 }; | |
97 } |