MeVisLab Toolbox Reference
mlDICOMSetAddTagTools.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
10//----------------------------------------------------------------------------------
11#pragma once
12
13#include "MLDICOMTagsSystem.h"
14
15#include <FMEThirdPartyWarningsDisable.h>
16#include <string>
17#include <FMEThirdPartyWarningsRestore.h>
18
19#include <mlLinearAlgebra.h>
20
21// DICOM Tree prototypes.
22#include <DCMTree_Lib.h>
23
24ML_START_NAMESPACE
25
26// Forwards
27class DicomMessageCollector;
28
29//----------------------------------------------------------------------------------
31//----------------------------------------------------------------------------------
32namespace DICOMTagTools {
33
43 const DCMTree::TagId &tagId,
44 unsigned int numValues=1,
45 const DCMTree::Vr *vr=nullptr,
46 unsigned int numSQValues=1);
47
53MLDICOMTags_EXPORT void setTagValue(DCMTree::TagPtr tag, unsigned int v0, unsigned int v1, unsigned int v2);
54
60MLDICOMTags_EXPORT void setTagValue(DCMTree::TagPtr tag, double v0, double v1, double v2);
61
66MLDICOMTags_EXPORT void setTagStringValue(DCMTree::TagPtr tag, const std::string &str);
67
73
79
85
103MLDICOMTags_EXPORT std::string toDblStrLimited(double val,
104 signed char maxSize);
105
111
117 const std::string &str);
118
127 const std::string &str,
128 bool ,
129 signed char );
130
143 double v0,
144 double v1,
145 bool doMultValueAdd,
146 signed char maxSize=-1);
147
157 MLint v0,
158 MLint v1,
159 MLint v2,
160 bool doMultValueAdd);
161
172 const ImageVector &vec,
173 bool doMultValueAdd);
174
187 const Vector2 &vec,
188 bool doMultValueAdd,
189 signed char maxSize=-1);
190
203 const Vector3 &vec,
204 bool doMultValueAdd,
205 signed char maxSize=-1);
206
219 const Vector6 &vec,
220 bool doMultValueAdd,
221 signed char maxSize=-1);
222
235 const Matrix4 &mat,
236 bool doMultValueAdd,
237 signed char maxSize=-1);
238
248template <typename TAG_VAL_TYPE>
250 const DCMTree::TagId &tagId,
251 const TAG_VAL_TYPE &vec,
252 bool doMultValueAdd,
253 signed char maxSize=-1)
254{
255 DCMTree::TagPtr retTag;
256 if (dcmTree){
257 retTag = addTagToTree(dcmTree, tagId);
258 setTagStringValue(retTag, vec, doMultValueAdd, maxSize);
259 }
260 return retTag;
261}
262
266template <typename TAG_VAL_TYPE>
268 const DCMTree::TagId &tagId,
269 const TAG_VAL_TYPE &vec)
270{
271 DCMTree::TagPtr retTag;
272 if (dcmTree){
273 retTag = addTagToTree(dcmTree, tagId);
274 setTagStringValue(retTag, vec);
275 }
276 return retTag;
277}
278
287template <typename TAG_VAL_TYPE>
289 const DCMTree::TagId &tagId,
290 TAG_VAL_TYPE val0,
291 TAG_VAL_TYPE val1,
292 TAG_VAL_TYPE val2)
293{
294 DCMTree::TagPtr retTag = addTagToTree(dcmTree, tagId);
295 setTagValue(retTag, val0, val1, val2);
296 return retTag;
297}
298
315 std::string *errStr,
316 DCMTree::TagId tagId,
317 const std::string &tagStrValue,
318 bool setValue,
319 MLuint32 numVals=1,
320 const DCMTree::Vr *vr=nullptr,
321 bool splitValue=false);
322
323
331
334
336extern MLDICOMTags_EXPORT const char * const ValueModifyModesStrings[NumValueModifyModes];
337
348 std::string *errStr,
349 DCMTree::TagId tagId,
350 const std::string &tagStrValue,
351 const ValueModifyModes modMode,
352 bool splitValue=false);
353
374 const std::string &privateCreatorString,
375 MLuint16 privateGroupId,
376 MLuint8 privateElementGroupId,
377 MLuint8 privateTagIdLowerByte,
378 const std::string &privateTagValue,
379 DCMTree::Vr privateVR,
380 bool splitValue);
381
387 MLint numEntries,
388 std::string &errStr);
389
394 MLint posIdx,
395 std::string &errStr);
396
397}
398
399ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDICOMTags_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Class to wrap a tag ID.
unsigned int MLuint32
Definition mlTypeDefs.h:184
unsigned char MLuint8
Definition mlTypeDefs.h:108
unsigned short MLuint16
Definition mlTypeDefs.h:141
MLint64 MLint
Definition mlTypeDefs.h:489
Vr
DICOM VR.
boost::shared_ptr< Tag > TagPtr
Shared pointer to tag.
Definition DCMTree_Lib.h:56
boost::shared_ptr< Tree > TreePtr
Shared pointer to a DCMTree::Tree.
Definition DCMTree_Lib.h:66
MLDICOMTags_EXPORT DCMTree::TagPtr addTagToTree(DCMTree::TreePtr dcmTree, const DCMTree::TagId &tagId, unsigned int numValues=1, const DCMTree::Vr *vr=nullptr, unsigned int numSQValues=1)
MLDICOMTags_EXPORT void appendSequenceEntries(DCMTree::TagPtr tag, MLint numEntries, std::string &errStr)
MLDICOMTags_EXPORT void setTagStringValue(DCMTree::TagPtr tag, const std::string &str)
ValueModifyModes
Ways how to modify a tag with with _modificationStringValue.
@ Prepend
The new value is inserted at begin of the value of the DICOM tag.
@ Append
The new value is appended to the end of the value of the DICOM tag.
@ Replace
The value of the DICOM tag is replaced by a new one.
@ DoNotModify
The value of the DICOM tag is not modified.
MLDICOMTags_EXPORT void setSplitTagStringValue(DCMTree::TagPtr tag, const std::string &str)
MLDICOMTags_EXPORT void setTagValue(DCMTree::TagPtr tag, unsigned int v0, unsigned int v1, unsigned int v2)
MLDICOMTags_EXPORT DCMTree::TagPtr addTag(DCMTree::TreePtr dcmTree, std::string *errStr, DCMTree::TagId tagId, const std::string &tagStrValue, bool setValue, MLuint32 numVals=1, const DCMTree::Vr *vr=nullptr, bool splitValue=false)
MLDICOMTags_EXPORT std::string setOrAddCreatorAndTag(DCMTree::TreePtr dcmTree, const std::string &privateCreatorString, MLuint16 privateGroupId, MLuint8 privateElementGroupId, MLuint8 privateTagIdLowerByte, const std::string &privateTagValue, DCMTree::Vr privateVR, bool splitValue)
MLDICOMTags_EXPORT std::string toDblStrLimited(double val, signed char maxSize)
DCMTree::TagPtr addStringTagToTree(DCMTree::TreePtr dcmTree, const DCMTree::TagId &tagId, const TAG_VAL_TYPE &vec, bool doMultValueAdd, signed char maxSize=-1)
MLDICOMTags_EXPORT void insertOneSequenceEntry(DCMTree::TagPtr tag, MLint posIdx, std::string &errStr)
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
Definition mlMatrix4.h:713
Tvec3< MLdouble > Vector3
A vector with three components of type double.
Definition mlVector3.h:286
Tvec6< MLdouble > Vector6
A vector with six components of type double.
Definition mlVector6.h:194
Tvec2< MLdouble > Vector2
A vector with two components of type double.
Definition mlVector2.h:159
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.