comparison OrthancServer/FromDcmtkBridge.h @ 784:efd0215736d9

start of anonymization refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 May 2014 15:06:31 +0200
parents 2d0a347e8cfc
children 7ebe4bf87196
comparison
equal deleted inserted replaced
782:a60040857ce6 784:efd0215736d9
54 enum DicomReplaceMode 54 enum DicomReplaceMode
55 { 55 {
56 DicomReplaceMode_InsertIfAbsent, 56 DicomReplaceMode_InsertIfAbsent,
57 DicomReplaceMode_ThrowIfAbsent, 57 DicomReplaceMode_ThrowIfAbsent,
58 DicomReplaceMode_IgnoreIfAbsent 58 DicomReplaceMode_IgnoreIfAbsent
59 };
60
61 class ParsedDicomFile : public IDynamicObject
62 {
63 private:
64 std::auto_ptr<DcmFileFormat> file_;
65
66 ParsedDicomFile(DcmFileFormat& other) :
67 file_(dynamic_cast<DcmFileFormat*>(other.clone()))
68 {
69 }
70
71 void Setup(const char* content,
72 size_t size);
73
74 public:
75 ParsedDicomFile(const char* content,
76 size_t size)
77 {
78 Setup(content, size);
79 }
80
81 ParsedDicomFile(const std::string& content)
82 {
83 if (content.size() == 0)
84 Setup(NULL, 0);
85 else
86 Setup(&content[0], content.size());
87 }
88
89 DcmFileFormat& GetDicom()
90 {
91 return *file_;
92 }
93
94 ParsedDicomFile* Clone()
95 {
96 return new ParsedDicomFile(*file_);
97 }
98
99 void SendPathValue(RestApiOutput& output,
100 const UriComponents& uri);
101
102 void Answer(RestApiOutput& output);
103
104 void Remove(const DicomTag& tag);
105
106 void Insert(const DicomTag& tag,
107 const std::string& value);
108
109 void Replace(const DicomTag& tag,
110 const std::string& value,
111 DicomReplaceMode mode);
112
113 void RemovePrivateTags();
114
115 bool GetTagValue(std::string& value,
116 const DicomTag& tag);
117
118 DicomInstanceHasher GetHasher();
119 }; 59 };
120 60
121 class FromDcmtkBridge 61 class FromDcmtkBridge
122 { 62 {
123 public: 63 public:
182 static std::string GenerateUniqueIdentifier(DicomRootLevel level); 122 static std::string GenerateUniqueIdentifier(DicomRootLevel level);
183 123
184 static bool SaveToMemoryBuffer(std::string& buffer, 124 static bool SaveToMemoryBuffer(std::string& buffer,
185 DcmDataset* dataSet); 125 DcmDataset* dataSet);
186 }; 126 };
127
128 class ParsedDicomFile : public IDynamicObject
129 {
130 private:
131 std::auto_ptr<DcmFileFormat> file_;
132
133 ParsedDicomFile(DcmFileFormat& other) :
134 file_(dynamic_cast<DcmFileFormat*>(other.clone()))
135 {
136 }
137
138 void Setup(const char* content,
139 size_t size);
140
141 public:
142 ParsedDicomFile(); // Create a minimal DICOM instance
143
144 ParsedDicomFile(const char* content,
145 size_t size)
146 {
147 Setup(content, size);
148 }
149
150 ParsedDicomFile(const std::string& content)
151 {
152 if (content.size() == 0)
153 Setup(NULL, 0);
154 else
155 Setup(&content[0], content.size());
156 }
157
158 DcmFileFormat& GetDicom()
159 {
160 return *file_;
161 }
162
163 ParsedDicomFile* Clone()
164 {
165 return new ParsedDicomFile(*file_);
166 }
167
168 void SendPathValue(RestApiOutput& output,
169 const UriComponents& uri);
170
171 void Answer(RestApiOutput& output);
172
173 void Remove(const DicomTag& tag);
174
175 void Insert(const DicomTag& tag,
176 const std::string& value);
177
178 void Replace(const DicomTag& tag,
179 const std::string& value,
180 DicomReplaceMode mode = DicomReplaceMode_InsertIfAbsent);
181
182 void RemovePrivateTags();
183
184 bool GetTagValue(std::string& value,
185 const DicomTag& tag);
186
187 DicomInstanceHasher GetHasher();
188
189 void SaveToMemoryBuffer(std::string& buffer)
190 {
191 FromDcmtkBridge::SaveToMemoryBuffer(buffer, file_->getDataset());
192 }
193
194 void SaveToFile(const std::string& path);
195 };
196
187 } 197 }