MeVisLab Toolbox Reference
mlDICOMTreeModificationTools.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 <ThirdPartyWarningsDisable.h>
16 #include <string>
17 #include <vector>
18 #include <ThirdPartyWarningsRestore.h>
19 
20 #include <mlUtilsSystem.h>
21 
22 // DICOM Tree prototypes.
23 #include <DCMTree_Lib.h>
24 
25 ML_START_NAMESPACE
26 
27 //----------------------------------------------------------------------------------
29 //----------------------------------------------------------------------------------
30 namespace DICOMTagTools {
31 
37  DCMTree::TagId tagId);
38 
48  unsigned char tagIdLowerEightBits,
49  const std::string &privateCreatorString);
50 
57  const std::string &privateCreatorString);
58 
63  bool alsoRemovePrivateCreator);
64 
73  bool removeAllPrivateTags=false,
74  const std::string &privateCreatorString="");
75 
81 
83 typedef struct {
85  const char *name;
86 }
89 
95  const DcmTagIdToRemove srcTagsToRemove[]);
96 
103  MLuint32 idVal,
104  MLuint32 idMask);
105 
108  const std::vector<DCMTree::TagId> &listOfIdsToRemove);
109 
114 
120 
125 
145  const DCMTree::TagId &tagId,
146  bool remove = true,
147  const std::string &newVal = "",
148  size_t *numGoodManips = nullptr,
149  size_t *numBadManips = nullptr,
150  size_t recursionLevel = 0);
151 
155 
160 
170 
175 
184 
190 MLDICOMTags_EXPORT std::vector<DCMTree::RawTagId> removeLargeTags(DCMTree::TreePtr treePtr,
191  size_t tagSizeToRemove=0x00040000);
192 
204  size_t itemIdx);
205 
220 };
221 
224 
227 
236  OtherTagModificationModes modificationMode,
237  const std::string &modStrVal);
238 
244  size_t from,
245  size_t to,
246  std::string &errStr);
247 
252  MLint numEntries,
253  std::string &errStr);
254 
255 };
256 
257 ML_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.
Definition: DCMTree_TagId.h:40
unsigned int MLuint32
Definition: mlTypeDefs.h:191
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578
boost::shared_ptr< Tag > TagPtr
shared-pointer to tag
Definition: DCMTree_Lib.h:59
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:70
MLDICOMTags_EXPORT DCMTree::TreePtr getSequenceItemTree(DCMTree::TagPtr tagPtr, size_t itemIdx)
Returns the DCMTree of the sequence item itemIdx of the DICOM tag given by tagPtr.
MLDICOMTags_EXPORT void removePrivateTagGroup(DCMTree::TreePtr dcmTree, bool removeAllPrivateTags=false, const std::string &privateCreatorString="")
Removes all tags from dcmTree which belong to a PrivateCreator privateCreatorString.
MLDICOMTags_EXPORT bool removeREGDataTag(DCMTree::TreePtr treePtr)
Removes the first found REG modality VectorGridData tag (0x7fe1, 0x1010) from treePtr which is search...
MLDICOMTags_EXPORT std::vector< DCMTree::RawTagId > removeLargeTags(DCMTree::TreePtr treePtr, size_t tagSizeToRemove=0x00040000)
Removes all top-level tags from the tree which are larger than the given tag size and return a vector...
MLDICOMTags_EXPORT const char *const OtherTagModificationModesStrings[NumOtherTagModificationModes]
String versions for OtherTagModificationModes.
MLDICOMTags_EXPORT void recursiveTagManipulate(DCMTree::TreePtr treePtr, const DCMTree::TagId &tagId, bool remove=true, const std::string &newVal="", size_t *numGoodManips=nullptr, size_t *numBadManips=nullptr, size_t recursionLevel=0)
Scans the DICOM tree given with treePtr and replaces all values of the tags with id tagId with newVal...
MLDICOMTags_EXPORT void removePrivateMultiFrameTag(DCMTree::TreePtr &treePtr)
If the passed tree contains a private MeVis sequence tag with DICOM frame information then the tag wi...
MLDICOMTags_EXPORT void removeTags(DCMTree::TreePtr resultTree, const DcmTagIdToRemove srcTagsToRemove[])
Remove the top level tags given by srcTagsToRemove from tree.
MLDICOMTags_EXPORT bool removeAllTypesPixelDataTags(DCMTree::TreePtr treePtr)
Removes all top level pixel data data tags from treePtr if there are any by using the functions remov...
MLDICOMTags_EXPORT void manipulateType2Or3Tags(DCMTree::TreePtr dcmTree, OtherTagModificationModes modificationMode, const std::string &modStrVal)
On top level of dcmTree apply dropping of sequence entries, or replace or remove operations on type 2...
MLDICOMTags_EXPORT void removeType3Tags(DCMTree::TreePtr dcmTree)
Removes all type 3 (sequence and non-sequence) tags from dcmTree as far as such tags are known as onl...
MLDICOMTags_EXPORT void recursiveRemoveTags(DCMTree::TreePtr &dcmTree, const std::vector< DCMTree::TagId > &listOfIdsToRemove)
Remove recursively all appearances of any tags with ids in listOfIdsToRemove from dcmTree.
struct ml::DICOMTagTools::DcmTagIdToRemove TagIdDesc
< Small structure describing a tag to be removed from a DCMTree tree with the helper function - see r...
MLDICOMTags_EXPORT void removePrivateTag(DCMTree::TreePtr dcmTree, unsigned char tagIdLowerEightBits, const std::string &privateCreatorString)
Remove the tag whose lower eight bits of its id is tagIdLowerEightBits and whose private creator has ...
MLDICOMTags_EXPORT void resizeToNumberOfSequenceEntries(DCMTree::TagPtr tag, MLint numEntries, std::string &errStr)
Resizes the sequence in tag to the number of entries given in modificationValue; any error will be ap...
MLDICOMTags_EXPORT bool removePixelDataTag(DCMTree::TreePtr treePtr)
Removes the first top level [[Double]Float]Pixel data data tag DCMTree_[[Double]Float]PixelData from ...
MLDICOMTags_EXPORT void removeTag(DCMTree::TreePtr dcmTree, DCMTree::TagId tagId)
Remove the tag with the ID tagId if it exists, otherwise do nothing; (if dcmTree is nullptr the call ...
MLDICOMTags_EXPORT void initNULLSequenceItemsToEmptyTrees(DCMTree::TagPtr tag, size_t from, size_t to, std::string &errStr)
Initialize NULL sequence entries in range [from, to[ with default trees, because many tree operations...
MLDICOMTags_EXPORT void removePrivateCreatorTag(DCMTree::TreePtr dcmTree, const std::string &privateCreatorString)
Remove the private Creator tag with string value privateCreatorString; if not found or nullptr dcmTre...
OtherTagModificationModes
Available modes for tag modifications.
@ RemoveType3Tags
All toplevel tags known as type 3 only, are removed.
@ ReplaceType2Tags
All values of toplevel non-sequence tags known as type 2 only, are replaced (if needed added) by the ...
@ OtherTagDoNotModify
No tag is not modified.
@ ReplaceType3Tags
All values of toplevel non-sequence tags known as type 3 only, are replaced (if needed added) by the ...
@ DropType3SQTagValues
Drop all toplevel sequence tags known as type 3 only.
@ DropType2SQTagValues
Drop all toplevel sequence tags known as type 2 only.
MLDICOMTags_EXPORT void recursiveSequenceTagCleanUp(DCMTree::TreePtr treePtr)
Does nothing if treePtr is nullptr, otherwise it recursively removes all entries at the end of all se...
MLDICOMTags_EXPORT void removeEmptyItemsAtEnd(DCMTree::TagPtr seqTagPtr)
As long as empty items or items with a tree with zero tags are found at the end of the sequence they ...
MLDICOMTags_EXPORT void removePrivateSMFTreeTags(DCMTree::TreePtr dcmTree, bool alsoRemovePrivateCreator)
Removes the three private tags dimensionsOffset, dimensionSequenceOffset and frameIndexOffset of priv...
MLDICOMTags_EXPORT void removeMaskedTags(DCMTree::TreePtr dcmTree, MLuint32 idVal, MLuint32 idMask)
Remove all tags from the dcmTree whose ids & idMask == idVal.
MLDICOMTags_EXPORT bool removeSpectDataTag(DCMTree::TreePtr treePtr)
Removes the first top level spectroscopy data tag (0x7fe1, 0x1010) or - if that one does not exist - ...
Small helper class describing the raw-id of the DICOM tag as well as its human readable name.
MLuint32 id
ID of tag to be described or removed.
const char * name
Human readable name of tag to be described or removed.