comparison OrthancServer/FromDcmtkBridge.h @ 57:4bc019d2f969 orthanc-renaming

renaming
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 16 Sep 2012 09:22:48 +0200
parents PalanthirServer/FromDcmtkBridge.h@293038baf8f1
children a70bb32802ae
comparison
equal deleted inserted replaced
56:088c4f23e2c8 57:4bc019d2f969
1 /**
2 * Palanthir - 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 Palanthir
28 {
29 enum ImageExtractionMode
30 {
31 ImageExtractionMode_Preview,
32 ImageExtractionMode_UInt8,
33 ImageExtractionMode_UInt16
34 };
35
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
53 static void ExtractPngImage(std::string& result,
54 DcmDataset& dataset,
55 unsigned int frame,
56 ImageExtractionMode mode);
57
58 static void ExtractPngImage(std::string& result,
59 const std::string& dicomContent,
60 unsigned int frame,
61 ImageExtractionMode mode);
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 }