MeVisLab Toolbox Reference
mlDICOMTreeModificationTools.h File Reference

A collection of tools related to DICOM tags and tree removal and modifications. More...

#include "MLDICOMTagsSystem.h"
#include <FMEThirdPartyWarningsDisable.h>
#include <string>
#include <vector>
#include <FMEThirdPartyWarningsRestore.h>
#include <mlUtilsSystem.h>
#include <DCMTree_Lib.h>

Go to the source code of this file.

Classes

struct  ml::DICOMTagTools::DcmTagIdToRemove
 Small helper class describing the raw-id of the DICOM tag as well as its human readable name. More...
 

Namespaces

namespace  ml
 Main documentation file for ML users and developers.
 
namespace  ml::DICOMTagTools
 A namespace collecting tools related to DICOM tags and tree tools.
 

Typedefs

typedef struct ml::DICOMTagTools::DcmTagIdToRemove ml::DICOMTagTools::TagIdDesc
 < Small structure describing a tag to be removed from a DCMTree tree with the helper function - see removeTags.
 

Enumerations

enum  ml::DICOMTagTools::OtherTagModificationModes {
  ml::DICOMTagTools::OtherTagDoNotModify = 0 , ml::DICOMTagTools::DropType2SQTagValues , ml::DICOMTagTools::DropType3SQTagValues , ml::DICOMTagTools::ReplaceType2Tags ,
  ml::DICOMTagTools::ReplaceType3Tags , ml::DICOMTagTools::RemoveType3Tags
}
 Available modes for tag modifications. More...
 
enum  { ml::DICOMTagTools::NumOtherTagModificationModes = RemoveType3Tags+1 }
 Defines the number of available modification modes. More...
 

Functions

MLDICOMTags_EXPORT void ml::DICOMTagTools::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 is ignored).
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::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 the string privateCreatorString.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::removePrivateCreatorTag (DCMTree::TreePtr dcmTree, const std::string &privateCreatorString)
 Remove the private Creator tag with string value privateCreatorString; if not found or nullptr dcmTree, the call will be a no-op.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::removePrivateSMFTreeTags (DCMTree::TreePtr dcmTree, bool alsoRemovePrivateCreator)
 Removes the three private tags dimensionsOffset, dimensionSequenceOffset and frameIndexOffset of private creator DCMTree::StructuredMF::privateCreator; if alsoRemovePrivateCreator is true then the private creator tag itself is also removed.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::removePrivateTagGroup (DCMTree::TreePtr dcmTree, bool removeAllPrivateTags=false, const std::string &privateCreatorString="")
 Removes all tags from dcmTree which belong to a PrivateCreator privateCreatorString.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::removeType3Tags (DCMTree::TreePtr dcmTree)
 Removes all type 3 (sequence and non-sequence) tags from dcmTree as far as such tags are known as only type 3; note that the tables about valid type 3 tags may be incomplete or unsafe, therefore use this function with care; the call is ignored if dcmTree is nullptr.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::removeTags (DCMTree::TreePtr resultTree, const DcmTagIdToRemove srcTagsToRemove[])
 Remove the top level tags given by srcTagsToRemove from tree.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::removeMaskedTags (DCMTree::TreePtr dcmTree, MLuint32 idVal, MLuint32 idMask)
 Remove all tags from the dcmTree whose ids & idMask == idVal.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::recursiveRemoveTags (DCMTree::TreePtr &dcmTree, const std::vector< DCMTree::TagId > &listOfIdsToRemove)
 Remove recursively all appearances of any tags with ids in listOfIdsToRemove from dcmTree.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::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 are removed.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::recursiveSequenceTagCleanUp (DCMTree::TagPtr seqTagPtr)
 Ignores the call if tagPtr is a normal tag or nullptr; if it is a sequence tag then it calls recursiveSequenceTagCleanUp(DCMTree::TreePtr) on each of its entries, however, it does not remove any sequence items directly in seqTagPtr even if they become empty after cleanup.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::recursiveSequenceTagCleanUp (DCMTree::TreePtr treePtr)
 Does nothing if treePtr is nullptr, otherwise it recursively removes all entries at the end of all sequence tags which are empty or which have a tree with zero tags in treePtr.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::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 ml::DICOMTagTools::removePrivateMultiFrameTag (DCMTree::TreePtr &treePtr)
 If the passed tree contains a private MeVis sequence tag with DICOM frame information then the tag will be removed including all other tags of the same private slot.
 
MLDICOMTags_EXPORT bool ml::DICOMTagTools::removePixelDataTag (DCMTree::TreePtr treePtr)
 Removes the first top level [[Double]Float]Pixel data data tag DCMTree_[[Double]Float]PixelData from the treePtr if it can be found.
 
MLDICOMTags_EXPORT bool ml::DICOMTagTools::removeAllTypesPixelDataTags (DCMTree::TreePtr treePtr)
 Removes all top level pixel data data tags from treePtr if there are any by using the functions removePixelDataTag, removeSpectDataTag, and removeREGDataTag as long as no more top level tags are found.
 
MLDICOMTags_EXPORT bool ml::DICOMTagTools::removeSpectDataTag (DCMTree::TreePtr treePtr)
 Removes the first top level spectroscopy data tag (0x7fe1, 0x1010) or - if that one does not exist - the tag (0x5600, 0x0020).
 
MLDICOMTags_EXPORT bool ml::DICOMTagTools::removeREGDataTag (DCMTree::TreePtr treePtr)
 Removes the first found REG modality VectorGridData tag (0x7fe1, 0x1010) from treePtr which is searched from top level under.
 
MLDICOMTags_EXPORT std::vector< DCMTree::RawTagIdml::DICOMTagTools::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 of ids of tags which have been removed.
 
MLDICOMTags_EXPORT DCMTree::TreePtr ml::DICOMTagTools::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 ml::DICOMTagTools::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 or 3 tags as far as current tags tables have the knowledge about such tags; note that the tables about valid type 2 or 3 tags may be incomplete or unsafe, therefore use this function with care; the call is ignored if dcmTree is nullptr.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::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 expect at least empty trees but fail with NULL entries; any error will be appended as textual description to errStr which is left unchanged in case of success.
 
MLDICOMTags_EXPORT void ml::DICOMTagTools::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 appended as textual description to errStr which is left unchanged in case of success.
 

Variables

MLDICOMTags_EXPORT const char *const ml::DICOMTagTools::OtherTagModificationModesStrings [NumOtherTagModificationModes]
 String versions for OtherTagModificationModes.
 

Detailed Description

A collection of tools related to DICOM tags and tree removal and modifications.

Author
Wolf Spindler.
Date
07/2013

Definition in file mlDICOMTreeModificationTools.h.