Mercurial > hg > orthanc
comparison PalantirServer/FromDcmtkBridge.h @ 0:3959d33612cc
initial commit
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Jul 2012 14:32:22 +0200 |
parents | |
children | c1097a676eca |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3959d33612cc |
---|---|
1 /** | |
2 * Palantir - A Lightweight, RESTful DICOM Store | |
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 | |
27 namespace Palantir | |
28 { | |
29 class FromDcmtkBridge | |
30 { | |
31 public: | |
32 static void Convert(DicomMap& target, DcmDataset& dataset); | |
33 | |
34 static DicomTag GetTag(const DcmElement& element); | |
35 | |
36 static DicomValue* ConvertLeafElement(DcmElement& element); | |
37 | |
38 static void ToJson(Json::Value& target, | |
39 DcmDataset& dataset, | |
40 unsigned int maxStringLength = 256); | |
41 | |
42 static void ToJson(Json::Value& target, | |
43 const std::string& path, | |
44 unsigned int maxStringLength = 256); | |
45 | |
46 static void ExtractNormalizedImage(std::string& result, | |
47 DcmDataset& dataset); | |
48 | |
49 static void ExtractNormalizedImage(std::string& result, | |
50 const std::string& dicomContent); | |
51 | |
52 static std::string GetName(const DicomTag& tag); | |
53 | |
54 static DicomTag FindTag(const char* name); | |
55 | |
56 static DicomTag FindTag(const std::string& name) | |
57 { | |
58 return FindTag(name.c_str()); | |
59 } | |
60 | |
61 static bool HasTag(const DicomMap& fields, | |
62 const std::string& tagName) | |
63 { | |
64 return fields.HasTag(FindTag(tagName)); | |
65 } | |
66 | |
67 static const DicomValue& GetValue(const DicomMap& fields, | |
68 const std::string& tagName) | |
69 { | |
70 return fields.GetValue(FindTag(tagName)); | |
71 } | |
72 | |
73 static void SetValue(DicomMap& target, | |
74 const std::string& tagName, | |
75 DicomValue* value) | |
76 { | |
77 target.SetValue(FindTag(tagName), value); | |
78 } | |
79 | |
80 static void Print(FILE* fp, | |
81 const DicomMap& m); | |
82 | |
83 static void ToJson(Json::Value& result, | |
84 const DicomMap& values); | |
85 }; | |
86 } |