MeVisLab Toolbox Reference
ml::DICOMTagTools Namespace Reference

A namespace collecting tools related to DICOM tags and tree tools. More...

Classes

struct  DicomPaletteInfo
 DICOM palette container which is to be used for ML index image to RGB image voxel translation. More...
 
struct  DcmTagIdToRemove
 Small helper class describing the raw-id of the DICOM tag as well as its human readable name. More...
 
class  ZTUIndex
 Class managing a multi-frame Z, T, and U-dimension plus a string value. More...
 

Typedefs

typedef std::complex< float > SpectComplex
 Define a complex data type to be used for spectroscopy data. More...
 
typedef struct ml::DICOMTagTools::DcmTagIdToRemove TagIdDesc
 < Small structure describing a tag to be removed from a DCMTree tree with the helper function - see removeTags. More...
 
typedef std::vector< ZTUIndexZTUVector
 A std::vector typedef of ZTUIndexes to describe indexes of handles in the multi-frame Z, T, and U dimension with one string value. More...
 

Enumerations

enum  OrientationType {
  InvalidOrientation = 0 , Axial , Prone , Cranial ,
  Coronal , Sagittal , AlmostAxial , AlmostCoronal ,
  AlmostSagittal , LessAlmostAxial , LessAlmostCoronal , LessAlmostSagittal ,
  Oblique , OtherOrientation , NoValues , NotApplicable ,
  NumberOfOrientationTypes
}
 Enumerator for typical human readable anatomic orientations. More...
 
enum  ValueModifyModes { Replace =0 , DoNotModify , Prepend , Append }
 Ways how to modify a tag with with _modificationStringValue. More...
 
enum  { NumValueModifyModes = Append+1 }
 Number of available ValueModifyModes. More...
 
enum  OtherTagModificationModes {
  OtherTagDoNotModify = 0 , DropType2SQTagValues , DropType3SQTagValues , ReplaceType2Tags ,
  ReplaceType3Tags , RemoveType3Tags
}
 Available modes for tag modifications. More...
 
enum  { NumOtherTagModificationModes = RemoveType3Tags+1 }
 Defines the number of available modification modes. More...
 

Functions

MLDICOMOUTPUTS_EXPORT void removeTopLevelFrameOfReferenceTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Frame Of Reference Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelGeneralAnatomyOptionalMacro (DCMTree::TreePtr dcmTree)
 Removes the DICOM General Anatomy Optional Macro tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelGeneralImageTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM General Image Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelGraphicAnnotationModuleTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Graphic Annotation Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelImagePixelMacroTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Image Pixel Macro tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelImagePlaneTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Image Plane Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelModalityLUTTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Modality LUT Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelMultiFrameModuleTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Multi-frame Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelOverlayPlaneTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Overlay Plane Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelPixelPaddingValueTag (DCMTree::TreePtr dcmTree)
 Remove tags from tree which could disturb the correct interpretation of the written DICOM file. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelRetiredCurveIETags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Curve IE tags, (see http://medical.nema.org/dicom/2004/04_03PU3.PDF, retired) from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelSupplementalPaletteColorLookupTableModuleTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM Supplemental Palette Color Lookup Table Module tags from dcmTree if they are present. More...
 
MLDICOMOUTPUTS_EXPORT void removeTopLevelVOILutTags (DCMTree::TreePtr dcmTree)
 Removes the DICOM VOI LUT Module tags from dcmTree if they are present. More...
 
MLDICOMTags_EXPORT std::string createInstanceUID (bool useFMEUIDPrefix=false)
 Generate new IDs for DICOM frames, for example new SOPinstanceUIDs. More...
 
MLDICOMTags_EXPORT bool looksLikeValidDICOMUID (const std::string &uidStrToCheck)
 Returns true if uidStrToCheck looks like a plausible valid DICOM UID, otherwise false. More...
 
MLDICOMTags_EXPORT bool isValidCSVrCharacter (const char ch)
 Returns true if ch is a character valid of CS value representations, otherwise false (uppercase letters, 0-9, space, underscore, see http://dicom.nema.org/DICOM/2013/output/chtml/part05/sect_6.2.html). More...
 
MLDICOMTags_EXPORT bool looksLikeValidCSVrValue (const std::string &codedString, std::string *explanation=nullptr)
 Returns true if codedString looks like a string valid for a coded segmentation, otherwise false; if explanation is passed as non-nullptr pointer then is set to an empty string if true is returned, otherwise it is set to an explanation which describes the problem why the string does not look valid. More...
 
MLDICOMTags_EXPORT void deepSearchTags (DCMTree::Const_TreePtr treePtr, const DCMTree::TagId &tagId, const size_t numTagsToFind, std::vector< DCMTree::Const_TagPtr > &tagVector)
 Searches the first at most numTagsToFind tags with id tagId in treePtr and appends them to tagVector; the call is ignored if treePtr is nullptr. More...
 
MLDICOMTags_EXPORT void deepSearchTags (DCMTree::TreePtr treePtr, const DCMTree::TagId &tagId, const size_t numTagsToFind, std::vector< DCMTree::TagPtr > &tagVector)
 Alternative version to deepSearchTags(DCMTree::Const_TreePtr, const DCMTree::TagId, const size_t, std::vector<DCMTree::Const_TagPtr> &) for non constant trees and tags; the call is ignored if treePtr is nullptr. More...
 
MLDICOMTags_EXPORT bool deepSearchTag (DCMTree::Const_TreePtr treePtr, const DCMTree::TagId &tagId, DCMTree::Const_TagPtr &result)
 Searches a tag also in sequence tags and returns true if found, the tag is returned in result; the call is ignored if treePtr is nullptr. More...
 
MLDICOMTags_EXPORT bool deepSearchTag (DCMTree::TreePtr treePtr, const DCMTree::TagId &tagId, DCMTree::TagPtr &result)
 Alternative version to deepSearchTags(DCMTree::Const_TreePtr, const DCMTree::TagId, DCMTree::Const_TagPtr &) for non constant trees and tags. More...
 
MLDICOMTags_EXPORT bool deepSearchTag (DCMTree::Const_TreePtr treePtr, const std::string &tagIdStr, DCMTree::Const_TagPtr &result)
 Searches a tag also in sequence tags and returns true if found, the tag is returned in result. More...
 
MLDICOMTags_EXPORT bool deepSearchTag (DCMTree::TreePtr treePtr, const std::string &tagIdStr, DCMTree::TagPtr &result)
 Alternative version to deepSearchTags(DCMTree::Const_TreePtr, const std::string &, DCMTree::Const_TagPtr &) for non constant trees and tags. More...
 
MLDICOMTags_EXPORT const DCMTree::TreePtrVectorgetSequenceItemTreePtrVector (DCMTree::Const_TreePtr dcmMFTree, DCMTree::RawTagId sequenceTagId)
 If possible it returns a pointer to the vector of sequence item (trees) of the tag with id sequenceTagId, otherwise nullptr (for example a nullptr input tree of tag not found or no sequence tag). More...
 
MLDICOMTags_EXPORT std::string getTagValue (DCMTree::Const_TreePtr treePtr, DCMTree::RawTagId tagId, bool useNumericTagValueSorting)
 Return tag value of first tag with id tagId in the DICOM tree treePtr as string if it exists, otherwise or if treePtr is nullptr it returns an empty string. More...
 
MLDICOMTags_EXPORT size_t getTripleTag (DCMTree::Const_TreePtr treePtr, DCMTree::RawTagId tagId, double &ippX, double &ippY, double &ippZ, double initX, double initY, double initZ)
 Returns the given DICOM tag as three double values; all values which can not be retrieved are returned as values given by the corresponding init* values. More...
 
MLDICOMTags_EXPORT size_t getHexTag (DCMTree::Const_TreePtr treePtr, DCMTree::RawTagId tagId, double &ippX1, double &ippY1, double &ippZ1, double &ippX2, double &ippY2, double &ippZ2, double initX1, double initY1, double initZ1, double initX2, double initY2, double initZ2)
 Returns the given DICOM tag as two 3 component double vectors; all values which can not be retrieved are returned as values given by the corresponding init* values. More...
 
MLDICOMTags_EXPORT std::string isValidDICOMDate (std::string str, bool allowEmptyStrings=true, bool allowOldFormat=true)
 Checks whether str is a valid DICOM date string and returns an empty string on success or a non empty error/help string otherwise. More...
 
MLDICOMTags_EXPORT std::string isValidDICOMTime (const std::string &str, bool allowEmptyStrings=true)
 Checks whether str is a valid DICOM time string of the formats HHMM, HHMMSS, or HHMMSS.F with HH=hours, MM=minutes, SS=seconds, and F=fractional part of a second. More...
 
MLDICOMTags_EXPORT std::string getCompressionDescription (DCMTree::Const_TreePtr treePtr, bool *isRetired=nullptr)
 Returns a textual description of a compression type if it is found in the available transfer UIDs stored in this functions. More...
 
MLDICOMTags_EXPORT std::string isLossyCompressed (DCMTree::Const_TreePtr treePtr)
 Returns "Yes" if the DICOM tree has a tag indicating a lossy compression, or if the tag indicates no compression then "No" is returned. More...
 
MLDICOMTags_EXPORT bool isCompressed (DCMTree::Const_TreePtr treePtr)
 Returns true if the DICOM tree has a transfer syntax UID which indicates compression, otherwise false. More...
 
MLDICOMTags_EXPORT std::string getTransferSyntaxUIDAsString (DCMTree::Const_TreePtr treePtr, bool searchOnlyOnTopLevel=false)
 Deep search and return the value of the DICOM tag TransferSyntaxUID as string. More...
 
MLDICOMTags_EXPORT bool isJPEG2000Compressed (DCMTree::Const_TreePtr treePtr)
 Returns true if any JPEG2000 compression was used to compress the pixel data, otherwise false. More...
 
MLDICOMTags_EXPORT size_t getImagePositionPatient (DCMTree::Const_TreePtr treePtr, double &ippX, double &ippY, double &ippZ, bool replaceOnlyIfFound)
 Return the DICOM tag ImagePositionPatient as three double values; all values which can not be retrieved are returned as 0. More...
 
MLDICOMTags_EXPORT size_t getImageOrientationPatient (DCMTree::Const_TreePtr treePtr, double &iopX1, double &iopY1, double &iopZ1, double &iopX2, double &iopY2, double &iopZ2)
 Return the DICOM tag ImageOrientationPatient as two 3D vectors (iopX1, iopY1, iopZ1) and (iopX2, iopY2, iopZ2); all values which can not be retrieved are returned as from the corresponding components from (X1,Y1,Z1)=(1,0,0) and (X2,Y2,Z2)=(0,1,0). More...
 
MLDICOMTags_EXPORT std::string getHumanReadableImageOrientationPatient (DCMTree::Const_TreePtr dcmTree, int *resultOType=nullptr)
 Determine (ACR_NEMA)ImageOrientationPatient from dcmTree and create a human readable orientation from it with additional error information if necessary. More...
 
MLDICOMTags_EXPORT ScaleShiftData getRescaleSlopeInterceptAsScaleShift (DCMTree::Const_TreePtr treePtr)
 Returns a ScaleShiftData object according to rescale and slope tag values. More...
 
MLDICOMTags_EXPORT DCMTree::Const_TagPtr getAnyPixelDataTag (DCMTree::Const_TreePtr treePtr, bool searchRecursivly=false)
 Searches and returns the first pixel data pointer on top level found in treePtr, or a nil tag if not found. More...
 
MLDICOMTags_EXPORT DCMTree::PixelData getPixelDataPtrFromTree (DCMTree::Const_TreePtr treePtr, size_t *valSizeInBytes, DicomMessageCollector &dcmMsgCollector)
 Same as DICOMCachedIOTools::getPixelDataPtrFromTree(). More...
 
MLDICOMTags_EXPORT bool hasMFPixelDataTag (DCMTree::Const_TreePtr treePtr, DCMTree::Const_TagPtr &tagPtr)
 Returns true if the tree has a multi-frame pixel data tag containing many frames or false otherwise. More...
 
MLDICOMTags_EXPORT const DCMTree::MFPixelTaggetAsMFPixelPtr (DCMTree::Const_TagPtr tag)
 Returns a pointer to the correctly cast multi-frame class type of tag if it is a valid multi-frame pixel data tag; in all other cases it returns nullptr. More...
 
MLDICOMTags_EXPORT const boost::shared_array< unsigned char > getPixelDataFrame (DCMTree::Const_TagPtr pixTag, boost::uint32_t frameIdx)
 Returns a memory copy of the frame at index position frameIdx of the pixel data tag pixTag or nullptr if it is not such tag, the frameIdx is out of range or any other error. More...
 
MLDICOMTags_EXPORT bool usesNegativeNMStacking (DCMTree::Const_TreePtr treePtr)
 Returns true if the tree has tags which indicate that it is NM data and the pixel data is stacked in inverse order and has an MFPixelDataTag. More...
 
MLDICOMTags_EXPORT bool hasNegativeSliceSpacing (DCMTree::Const_TreePtr treePtr)
 Returns true if the tree has a SpacingBetweenSlices tag with a negative value. More...
 
MLDICOMTags_EXPORT bool hasAtMostOneFrameInSMFGrid (const DCMTree::StructuredMFPtr &smfTree)
 Returns true if the passed SMFTree has only one grid entry, if smfTree is nullptr or smfTree->tagTree is nullptr. More...
 
MLDICOMTags_EXPORT bool hasAtMostOneFrameInSMFGrid (const DCMTree::Const_StructuredMFPtr &smfTree)
 Returns true if the passed constant SMFTree has only one grid entry, if smfTree is nullptr or smfTree->tagTree is nullptr. More...
 
MLDICOMTags_EXPORT bool isBitImageDICOM (DCMTree::Const_TreePtr treePtr)
 Returns true if the DICOM pixel size seems to be single bit (indicated by appropriate values of BitsAllocated, Stored and highBit), otherwise false. More...
 
MLDICOMTags_EXPORT bool updateMinMaxFromDICOMTags (DCMTree::Const_TreePtr treePtr, MLdouble &minPixVal, MLdouble &maxPixVal)
 Checks for min/max DICOM tags on top level and - if both are found - updates the passed min/max values. More...
 
MLDICOMTags_EXPORT bool getDoubleFromTag (DCMTree::Const_TagPtr tagPtr, double &returnDbl)
 Converts one values of tagPtr to a double values in returnDbl. More...
 
MLDICOMTags_EXPORT bool getDoubleVectorFromTag (DCMTree::Const_TagPtr tagPtr, std::vector< double > &returnDbls)
 Converts all values of tagPtr to a std::vector of doubles in returnDbls. More...
 
MLDICOMTags_EXPORT bool getVector2FromTag (DCMTree::Const_TagPtr tagPtr, Vector2 &returnVec)
 Converts two values of tagPtr to two Vector2 values in returnVec, respectively. More...
 
MLDICOMTags_EXPORT bool getVector3FromTag (DCMTree::Const_TagPtr tagPtr, Vector3 &returnVec)
 Converts three values of tagPtr to three Vector3 values in returnVec, respectively. More...
 
MLDICOMTags_EXPORT bool getVector6FromTag (DCMTree::Const_TagPtr tagPtr, Vector6 &returnVec)
 Converts six values of tagPtr to six Vector6 values in returnVec, respectively. More...
 
MLDICOMTags_EXPORT bool get4x4DoubleMatrixFromTag (DCMTree::Const_TagPtr tagPtr, Matrix4 &returnMat)
 Converts 16 values of tagPtr to 16 double matrix values in returnMat, respectively. More...
 
MLDICOMTags_EXPORT DCMTree::TagPtr getTagIfItExists (DCMTree::TreePtr dcmTree, DCMTree::TagId tagId, std::string *errStr=nullptr)
 
MLDICOMTags_EXPORT DCMTree::TreePtr cloneDCMTree (DCMTree::Const_TreePtr dcmTree, std::string *errStr)
 Create a deep-copy of the passed dcmTree as DICOM tree to be modified. More...
 
MLDICOMTags_EXPORT unsigned int findPrivateTagGroup (DCMTree::TreePtr dcmTree, const std::string &privateCreatorString)
 Determine tag ID mask of the private creator given by privateCreatorString and return it as mask 0xGGGGPP00 where GGGG is the private creator group id and PP the lower eight bit defining the upper eight bits of added private tags. More...
 
MLDICOMTags_EXPORT unsigned int searchPrivateCreator (DCMTree::TreePtr dcmTree, const std::string &privateCreatorString="", MLuint16 desiredPrivateGroupId=0x09, MLuint8 desiredPrivateElementGroupId=0x10)
 Determine the first odd group id with private element group id. More...
 
MLDICOMTags_EXPORT DCMTree::Const_TagPtr getPrivateFMETag (DCMTree::RawTagId lowerEightBitOfElementId, DCMTree::Const_TreePtr dcmTree)
 Searches private FME tag with lower 8 bit element id lowerEightBitOfElementId with FMEPrivateTagsGroupId and FMEPrivateCreatorString in dcmTree and returns the tag if possible, otherwise (if dcmTree is nullptr, not found, no slot etc.) it returns nullptr. More...
 
MLDICOMTags_EXPORT bool getTopLevelSOPInstanceUID (DCMTree::Const_TreePtr dcmTree, std::string &sopInstanceUID)
 Get the original SOPInstanceUID from top level of dcmTree, returns the value in sopInstanceUID and return true if the value looks valid; for this purpose prefer FMEPrivateSourceSOPInstanceUIDOfDecomposedFrame since it stores the original one and not a possibly recreated one. More...
 
MLDICOMTags_EXPORT void getTagStringValuesFromSequence (DCMTree::RawTagId rawTagId, DCMTree::Const_TagPtr sequenceInWhichToSearch, std::string &tagValuesStringListToExtend, const std::string &sep, std::set< std::string > *makeUniqueSet=nullptr, bool searchAsLower8BitOfPrivateFMETag=false)
 Deep-searches all occurrences of the tag with id tagToSearch in the sequence tag sequenceInWhichToSearch and appends all string-converted values separated by sep to tagValuesStringListToExtend. More...
 
MLDICOMTags_EXPORT DCMTree::Const_TagPtr getMeVisStructuredMFDimensionSequence (DCMTree::Const_TreePtr dcmTree)
 Searches the structured multi-frame sequence tag on top-level in dcmTree or nullptr if not found or dcmTree is nullptr. More...
 
MLDICOMTags_EXPORT DCMTree::Const_TagPtr getPrivateTag (const std::string &privateCreatorString, unsigned short groupId, DCMTree::RawTagId lowerEightBitOfElementId, DCMTree::Const_TreePtr dcmTree)
 See DICOMCachedIOTools::getPrivateTag(). More...
 
MLDICOMTags_EXPORT bool isPhilips3D (DCMTree::Const_TreePtr treePtr, MLint *spatialExtent=nullptr)
 See DICOMCachedIOTools::isPhilips3D(). More...
 
MLDICOMTags_EXPORT unsigned int getNumberOfFrames (DCMTree::Const_TreePtr dcmTree, unsigned int *fromTagOnly=nullptr)
 See DICOMCachedIOTools::getNumberOfFrames(). More...
 
MLDICOMTags_EXPORT void extractTagValuesFromPerFrameAndMeVisMFSequence (DCMTree::RawTagId rawTagId, DCMTree::Const_TreePtr dcmTree, std::string &tagValuesStringListToExtend, bool alsoAddTopLevelTags, const std::string &sep, std::set< std::string > *makeUniqueSet=nullptr)
 Looks for frame-specific tags with ID rawTagId in sequences DCMTree_PerFrameFunctionalGroupsSequence and getMeVisStructuredMFDimensionSequence of dcmTree and if they are found they are appended to tagValuesStringListToExtend, separated with sep. More...
 
MLDICOMTags_EXPORT void getTagStringValuesFromSMFSequence (DCMTree::Const_TreePtr inputDcmTree, const std::vector< MLuint64 > &rawTagIds, bool appendFrameCount, bool appendCoords, std::list< std::vector< std::string > > &tagValuesListToExtend)
 Looks for frame-specific tags rawTagIds in getMeVisStructuredMFDimensionSequence of inputDcmTree and if they are found they are appended to tagValuesStringListToExtend. More...
 
MLDICOMTags_EXPORT void getTagStringValuesFromTopLevel (DCMTree::Const_TreePtr inputDcmTree, const std::vector< MLuint64 > &rawTagIds, std::vector< std::string > &rootEntries)
 Like getTagStringValuesFromSMFSequence() but retrieves tags only from top level of inputDcmTree into cleared rootEntries; coordinate entries are not appended to rootEntries. More...
 
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)
 Add a tag with id tagId to dcmTree. More...
 
MLDICOMTags_EXPORT void setTagValue (DCMTree::TagPtr tag, unsigned int v0, unsigned int v1, unsigned int v2)
 Set the three unsigned int values v0, v1, and v2 at value positions 0, 1, and 2, respectively, all other values are removed. More...
 
MLDICOMTags_EXPORT void setTagValue (DCMTree::TagPtr tag, double v0, double v1, double v2)
 Set the three double values v0, v1, and v2 at value positions 0, 1, and 2, respectively, all other values are removed. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, const std::string &str)
 Set the string value str at value position 0, all other values are removed. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, float val)
 Sets value val at value position 0, all other values are removed. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, MLuint16 val)
 Sets value val at value position 0, all other values are removed. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, int val)
 Sets value val at value position 0, all other values are removed. More...
 
MLDICOMTags_EXPORT std::string toDblStrLimited (double val, signed char maxSize)
 Printing double values can lead to the annoying problem that the fully printed double value does not fit in the allowed size of a value representation, for example a printed double value can easily lead to a value 0.999690871460849, however, the value representation DS allows only 16 bytes per value (stupid, but it is like this, who invented that in the DICOM standard???) This is a tool function which tries to limit a printed double value to a given length by reducing the number of decimal digits passed to toDblStr, which, however has its limitations. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, double val)
 Sets value val at value position 0, all other values are removed. More...
 
MLDICOMTags_EXPORT void setSplitTagStringValue (DCMTree::TagPtr tag, const std::string &str)
 If str contains "\\" then it is split at those positions such that multiple values are created. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, const std::string &str, bool, signed char)
 Set the string value str at value position 0, all other values are removed. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, double v0, double v1, bool doMultValueAdd, signed char maxSize=-1)
 Set the value of tag as string whose components are v0 and v1 as strings separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, MLint v0, MLint v1, MLint v2, bool doMultValueAdd)
 Set the value of tag as string whose components are v0, v1, and v2 as strings separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, const ImageVector &vec, bool doMultValueAdd)
 Set the value of tag as string whose six vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, const Vector2 &vec, bool doMultValueAdd, signed char maxSize=-1)
 Set the value of tag as string whose two vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, const Vector3 &vec, bool doMultValueAdd, signed char maxSize=-1)
 Set the value of tag as string whose three vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, const Vector6 &vec, bool doMultValueAdd, signed char maxSize=-1)
 Set the value of tag as string whose six vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string. More...
 
MLDICOMTags_EXPORT void setTagStringValue (DCMTree::TagPtr tag, const Matrix4 &mat, bool doMultValueAdd, signed char maxSize=-1)
 Set the value of tag as string whose sixteen matrix components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string. More...
 
template<typename TAG_VAL_TYPE >
DCMTree::TagPtr addStringTagToTree (DCMTree::TreePtr dcmTree, const DCMTree::TagId &tagId, const TAG_VAL_TYPE &vec, bool doMultValueAdd, signed char maxSize=-1)
 A template function which adds a new tag to dcmTree which has the value representation vr and the id tagId. More...
 
template<typename TAG_VAL_TYPE >
DCMTree::TagPtr addStringTagToTree (DCMTree::TreePtr dcmTree, const DCMTree::TagId &tagId, const TAG_VAL_TYPE &vec)
 Same as addStringTagToTree(DCMTree::TreePtr, DCMTree::TagId, const TAG_VAL_TYPE &, bool doMultiValueAdd) without doMultiValue add which only works a single string argument. More...
 
template<typename TAG_VAL_TYPE >
DCMTree::TagPtr addTagToTree (DCMTree::TreePtr dcmTree, const DCMTree::TagId &tagId, TAG_VAL_TYPE val0, TAG_VAL_TYPE val1, TAG_VAL_TYPE val2)
 A template function which adds a new tag with id tagId to dcmTree. More...
 
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)
 Add the tag with ID _tagId to tree dcmTree and value _modificationStringValue; requires a valid non nullptr dcmTree. More...
 
MLDICOMTags_EXPORT void setTagValue (DCMTree::TreePtr dcmTree, std::string *errStr, DCMTree::TagId tagId, const std::string &tagStrValue, const ValueModifyModes modMode, bool splitValue=false)
 Sets the value of the tag with id tagId in dcmTree with the new value tagStrValue. More...
 
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)
 Add and/or replace the private creator and add/replace the private tags in dcmTree. More...
 
MLDICOMTags_EXPORT void appendSequenceEntries (DCMTree::TagPtr tag, MLint numEntries, std::string &errStr)
 Append a number of entries to the sequence in tag and initialize it with an empty DCMTree; the number of appended entries is given in modificationValue, and any error will be appended as textual description to errStr which is left unchanged in case of success. More...
 
MLDICOMTags_EXPORT void insertOneSequenceEntry (DCMTree::TagPtr tag, MLint posIdx, std::string &errStr)
 Inserts one entry in the sequence in tag at the position given in modificationValue; any error will be appended as textual description to errStr which is left unchanged in case of success. More...
 
MLDICOMTags_EXPORT std::string getModalityTagValue (DCMTree::Const_TreePtr treePtr) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns a string with value of the modality tag if it can be determined from the passed tree or an empty string otherwise. More...
 
MLDICOMTags_EXPORT std::string getSOPClassUIDTagValue (DCMTree::Const_TreePtr treePtr) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns a string with value of the SOPClassUID tag if it can be determined from the passed tree or an empty string otherwise. More...
 
MLDICOMTags_EXPORT bool hasTrueModality (DCMTree::Const_TreePtr treePtr, const std::string &modality) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if the value of the modality tag is of the given modality, the tree is not a secondary capture, and a SOPClassUIDTag exists. More...
 
MLDICOMTags_EXPORT bool hasSOPClassUID (DCMTree::Const_TreePtr dcmTree, const std::string &sopClassUID, bool doDeepSearch=false) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if dcmTree is valid and has the SOPClassUID tag with the given sopClassUID value. More...
 
MLDICOMTags_EXPORT bool hasNMSOPClassUID (DCMTree::Const_TreePtr dcmTree) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if dcmTree is valid and has the SOPClassUID tag with the value "1.2.840.10008.5.1.4.1.1.20" or "1.2.840.10008.5.1.4.1.1.5" which stands for the NM modality, otherwise false is returned. More...
 
MLDICOMTags_EXPORT bool hasStandardMRSpectroscopyClassUID (DCMTree::Const_TreePtr dcmTree) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if dcmTree is valid and has the SOPClassUID tag with the value "1.2.840.10008.5.1.4.1.1.4.2" which stands for the standard DICOM MR Spectroscopy modality, otherwise false is returned. More...
 
MLDICOMTags_EXPORT bool hasRetiredPETCurveStorageSOPClassUID (DCMTree::Const_TreePtr dcmTree) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if dcmTree is of the retired Positron Emission Tomography Curve Storage type with SOPClassUID 1.2.840.10008.5.1.4.1.1.128. More...
 
MLDICOMTags_EXPORT bool hasSCSOPClassUID (DCMTree::Const_TreePtr dcmTree) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if dcmTree is valid and has a SOPClassUID tag value matching a secondary capture SOPClassUID (which does not have a specific Modality value). More...
 
MLDICOMTags_EXPORT bool hasParametricMapSOPClassUID (DCMTree::Const_TreePtr dcmTree) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if dcmTree is valid and has a Parametric Map SOPClassUID (which does not have a specific Modality value). More...
 
MLDICOMTags_EXPORT bool hasSOPClassUIDOfModality (DCMTree::Const_TreePtr dcmTree, const std::string &modality) ML_RETURN_VALUE_SHOULD_BE_USED
 EXPERIMENTAL FUNCTION: Returns true if dcmTree is valid and has the SOPClassUID tag which corresponds to the given modality. More...
 
MLDICOMTags_EXPORT bool isKnownRetiredModality (const std::string &modality) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if modality is a known retired one, otherwise false. More...
 
MLDICOMTags_EXPORT bool isKnownModality (const std::string &modality, bool includeRetired) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if modality is a known one, otherwise false; if includeRetired is true the also retired modalities are considered as known ones, otherwise not. More...
 
MLDICOMTags_EXPORT std::string getModalityForSOPClassUID (const std::string &sopClassUID) ML_RETURN_VALUE_SHOULD_BE_USED
 EXPERIMENTAL FUNCTION: If its is known then return the modality corresponding to sopClassUID; if not known or unclear then an empty string is returned. More...
 
MLDICOMTags_EXPORT bool isMultiFrameSOPClassUID (const std::string &SOPClassUID) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if the pass UID is a multi-frame SOPClassUID, otherwise false. More...
 
MLDICOMTags_EXPORT bool isEnhancedSOPClassUID (const std::string &enhancedSOPClassUID) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if the pass UID is an enhanced Image Storage SOPClassUID, otherwise false. More...
 
MLDICOMTags_EXPORT bool hasSharedOrPerFrameFunctionalGroupSequences (DCMTree::Const_TreePtr dcmTree) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if the Shared- or the PerFrameFunctionalGroupSequences are on root level, otherwise false. More...
 
MLDICOMTags_EXPORT bool hasMultiFrameModule (DCMTree::Const_TreePtr dcmTree) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if dcmTree contains has Number of Frames (0028,0008) and Frame Increment Pointer (0028,0009) tags, otherwise false. More...
 
MLDICOMTags_EXPORT std::string translateToSingleFrameSOPClassUID (const std::string &enhancedSOPClassUID) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns a single frame SOPClassUID corresponding to enhancedSOPClassUID. More...
 
MLDICOMTags_EXPORT void setUpSingleFrameImageStorageSOPClassUIDDerivedFromEnhancedOne (DCMTree::Const_TreePtr dcmMFTree, DCMTree::TreePtr singleFrame)
 Takes the SOPClassUID from dcmMFTree, and writes the corresponding single frame one into singlFrame. More...
 
MLDICOMTags_EXPORT bool hasValidTagIdRange (MLint val)
 Returns true if the MLint argument val has a valid uint32 range, otherwise false is returned. More...
 
MLDICOMTags_EXPORT bool hasValidTagIdRange (size_t val)
 Returns true if the size_t argument val has a valid uint32 range, otherwise false is returned. More...
 
MLDICOMTags_EXPORT std::string checkForOneOf (DCMTree::TagId id, DCMTree::Const_TreePtr dcmTree, const char *const valueList[], size_t numValues, bool requiresExistingTag=true, bool requiresTextStringValue=true)
 Checks whether the tag has any of the values in valueList - if yes then an empty string is returned, otherwise a textual error description; dcmTree and valueList must be non-nullptr. More...
 
MLDICOMTags_EXPORT std::string validatePrivateCreators (DCMTree::Const_TreePtr dcmTree, std::vector< unsigned int > &privateCreators, std::vector< unsigned int > *badPrivateCreators=nullptr)
 Applies some consistency checks on private creators and returns an empty string if no issues are found, otherwise a text description of the problem(s). More...
 
MLDICOMTags_EXPORT std::string validatePrivateTagIds (DCMTree::Const_TreePtr dcmTree, std::vector< unsigned int > privateIds, std::vector< unsigned int > privateCreators)
 Applies some consistency checks on private creators and private tags and returns an empty string if no issues are found, otherwise a text description of the problem(s). More...
 
MLDICOMTags_EXPORT std::string printTagId (DCMTree::TagId id, DCMTree::Const_DictPtr dict, bool printValue=false, DCMTree::Const_TreePtr dcmTree=DCMTree::Const_TreePtr(), const std::string &valueIntro=" with value '", const std::string &valueExtro="'", size_t abbreviateAfter=15u)
 Convert a tag name with its id and optionally the tag value to a string by
using the DicomTree dictionary. More...
 
MLDICOMTags_EXPORT MLint parseUserTagIdStringVal (std::string tagIdStrVal, bool replaceXsByZeros=false)
 Parses the given string tagIdStrVal and returns it as positive unsigned integer value if the parsed value looks like a valid raw tag id. More...
 
MLDICOMTags_EXPORT std::string replaceTagIdPlaceholder (DCMTree::Const_TreePtr dcmTree, std::string strToReplace, bool correctTagValues=false, const std::string &defaultTagContent="")
 Replaces all substrings of the format "$(TAGID(ABCD,EFGH))" by the values of the first occurrence values of the corresponding DICOM tag ids in dcmTree; syntactically correct placeholders will be replaced by found tags values or defaultTagContent, syntactically incorrect placeholders will not be replaced. More...
 
MLDICOMTags_EXPORT void determinePaletteInformation (DCMTree::Const_TreePtr dcmTree, DicomPaletteInfo &info)
 Gets the palette information from dcmTree into a DicomPaletteInfo structure. More...
 
MLDICOMTags_EXPORT bool hasMrsASCIITag (DCMTree::Const_TreePtr treePtr)
 Returns true if the spectroscopy ASCII tags (0x0029, 0x1120) or (0x0029, 0x1220) are available in treePtr, otherwise false is returned. More...
 
MLDICOMTags_EXPORT const SpectComplexgetSpectDataPtrFromTree (DCMTree::Const_TreePtr treePtr, size_t *valSizeInBytes=nullptr)
 Returns the pointer to the data value in the tag (0x7fe1, 0x1010) or - if that one does not exist - from the tag (0x5600, 0x0020). More...
 
MLDICOMTags_EXPORT void getComplexSpectDataCopy (DCMTree::Const_TreePtr treePtr, size_t &chunkSize, SpectComplex *&cplxChunk)
 Tries to get a copy of the complex spectroscopy data chunk form the DCMree. More...
 
MLDICOMTags_EXPORT bool doTagsEqual (DCMTree::Const_TagPtr tag1, DCMTree::Const_TagPtr tag2, bool compareMultiplicity=false, bool compareMultiFrameData=true)
 Compare the given two tags and their contents for equality. More...
 
MLDICOMTags_EXPORT void compareDCMTrees (DCMTree::Const_TreePtr inputTree1, DCMTree::Const_TreePtr inputTree2, const std::vector< DCMTree::TagId > &idsExcludedFromChanged, DCMTree::TreePtr &unchangedTags, DCMTree::TreePtr &addedTags, DCMTree::TreePtr &removedTags, DCMTree::TreePtr &changedTags, bool alsoExcludeFromAdded=false, bool alsoExcludeFromRemoved=false, bool compareRecursively=false, bool cleanupEmptyTrailingSequenceTreesInAddedTags=false, bool cleanupEmptyTrailingSequenceTreesInRemovedTags=false, bool compareMultiplicity=false, bool cleanupEmptyTrailingSequenceTreesInChangedTags=true, bool compareMultiFrameData=true)
 Compare the given two trees and update the result pointers. More...
 
MLDICOMTags_EXPORT std::string dumpDCMTreeToReadableString (DCMTree::Const_TreePtr treePtr, const std::string &prefix="", MLint maxNum=50000, bool decodePrivateTags=false, unsigned int numBinDumpEntries=8, bool annotate=false, const std::string &regExLineFilter="", bool showNumOfTagValues=true, bool hideNULLItems=false)
 Creates a string from the DicomTree tags and updates the information field. More...
 
MLDICOMTags_EXPORT void appendHexDumpToString (const unsigned char *dataPtr, const unsigned int numDataBytes, std::string &resultValStr, bool printSpaces)
 Appends hexadecimal dump of numDataBytes bytes to tagValStr. More...
 
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 is ignored). More...
 
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 the string privateCreatorString. More...
 
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 dcmTree, the call will be a no-op. More...
 
MLDICOMTags_EXPORT void 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. More...
 
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. More...
 
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 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. More...
 
MLDICOMTags_EXPORT void removeTags (DCMTree::TreePtr resultTree, const DcmTagIdToRemove srcTagsToRemove[])
 Remove the top level tags given by srcTagsToRemove from tree. More...
 
MLDICOMTags_EXPORT void removeMaskedTags (DCMTree::TreePtr dcmTree, MLuint32 idVal, MLuint32 idMask)
 Remove all tags from the dcmTree whose ids & idMask == idVal. More...
 
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. More...
 
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 are removed. More...
 
MLDICOMTags_EXPORT void 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. More...
 
MLDICOMTags_EXPORT void 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. More...
 
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. More...
 
MLDICOMTags_EXPORT void 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. More...
 
MLDICOMTags_EXPORT bool 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. More...
 
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 removePixelDataTag, removeSpectDataTag, and removeREGDataTag as long as no more top level tags are found. More...
 
MLDICOMTags_EXPORT bool 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). More...
 
MLDICOMTags_EXPORT bool removeREGDataTag (DCMTree::TreePtr treePtr)
 Removes the first found REG modality VectorGridData tag (0x7fe1, 0x1010) from treePtr which is searched from top level under. More...
 
MLDICOMTags_EXPORT std::vector< DCMTree::RawTagIdremoveLargeTags (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. More...
 
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. More...
 
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 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. More...
 
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 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. More...
 
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 appended as textual description to errStr which is left unchanged in case of success. More...
 
MLDICOMTags_EXPORT void getSMFTreeZTUExtent (const DCMTree::StructuredMFPtr smfTree, ZTUIndex &ztu)
 Get extent of the MeVis Structured Multi Frame set of the smfTree in ztu. More...
 
MLDICOMTags_EXPORT void getSMFTreeZTUExtent (const DCMTree::Const_StructuredMFPtr smfTree, ZTUIndex &ztu)
 Get extent of the constanVis Structured Multi Frame set of the constant smfTree in ztu. More...
 
MLDICOMTags_EXPORT void getSMFTreeZTUExtent (DCMTree::TreePtr dcmTree, ZTUIndex &ztu)
 Get extent of the MeVis Structured Multi Frame set of the dcmTree in ztu. More...
 
MLDICOMTags_EXPORT void getSMFTreeZTUExtent (DCMTree::Const_TreePtr dcmTree, ZTUIndex &ztu)
 Get extent of the MeVis Structured Multi Frame set of the constant dcmTree in ztu. More...
 
MLDICOMTags_EXPORT DCMTree::Const_StructuredMFPtr convertDCMToSMFTree (DCMTree::Const_TreePtr dcmTree)
 Convert dcmTree to the returned StructuredSMFTree if possible or throws and DCMtree::Exception. More...
 
MLDICOMTags_EXPORT void extractAllSMFFramesAsDeepCopies (DCMTree::Const_StructuredMFPtr inputSMFTree, std::vector< DCMTree::Const_TreePtr > &frameSet)
 Retrieves all frame trees of the input SMFTree as deep-copies and returns their pointers in frameSet. More...
 
MLDICOMTags_EXPORT DCMTree::TreePtr getSMFTreeFrameTreeAtZTU (DCMTree::Const_StructuredMFPtr smfTree, const ZTUIndex &ztu)
 Returns a deep-copy of DCMTree at frame position (z,t,u) from constant smfTree if it exists or nullptr if not; constant version for non-copied returned tree is not supported in DCMTree::StructuredMF class and is therefore not available here, see also extractAllSMFFramesAsDeepCopy();. More...
 
MLDICOMTags_EXPORT DCMTree::TreePtr getSMFTreeFrameTreeAtZTU (DCMTree::StructuredMFPtr smfTree, const ZTUIndex &ztu)
 Returns the DCMTree at frame position (z,t,u) from non-constant smfTree if it exists or nullptr if not; constant version for non-deep-copied returned tree is not supported in DCMTree::StructuredMF class and is therefore not available here, see also extractAllSMFFramesAsDeepCopy(). More...
 
MLDICOMTags_EXPORT DCMTree::TreePtr getSMFTreeFrameTreeAtZTU (DCMTree::TreePtr dcmTree, const ZTUIndex &ztu)
 Returns the DCMTree at frame position (z,t,u) from non-constant dcmTree if it exists or nullptr if not; constant version is not supported in DCMTree::StructuredMF class and is therefore not available here. More...
 
MLDICOMTags_EXPORT std::vector< DCMTree::TreePtrgetIndexedNormalSequenceSubTrees (const DCMTree::TreePtr &parentTree, const std::string &tagIdString, const std::string &sequenceEntriesString, DICOMTagTools::ZTUVector *ztuIndexes=nullptr, bool alsoGetNULLTrees=false)
 Returns a vector of all DCMTree::TreePtrs indexed by sequenceEntriesString and taken from the sequence tag defined by tagIdString. More...
 
MLDICOMTags_EXPORT std::vector< DCMTree::TreePtrgetSMFSubTreeFramesAtZTUTriplePositions (const DCMTree::TreePtr &parentTree, const std::vector< MLuint32 > &ztuTriples, DICOMTagTools::ZTUVector *ztuIndexes=nullptr)
 Builds ztuTriples.size()/3 triples from the indexes in the ztuTriples and returns a vector of all DCMTree::TreePtrs at the triple positions of the MeVis SMF subtrees of parentTree if there is any. More...
 
MLDICOMTags_EXPORT std::vector< DCMTree::TreePtrgetSMFSubTreeZTUFrameSlices (const DCMTree::TreePtr &parentTree, const std::string &zSlicesEntriesList, const std::string &tSlicesEntriesList, const std::string &uSlicesEntriesList, DICOMTagTools::ZTUVector *ztuIndexes=nullptr)
 Returns a vector of DCMTree::TreePtrs of all MeVis SMF subtrees which are described by the combinations of all indexes in the fields [z|t|u]SlicesEntriesList. More...
 

Variables

const char *const OrientationName [NumberOfOrientationTypes]
 String representations analog to the OrientationType, however, NumberOfOrientationTypes is out of range. More...
 
MLDICOMTags_EXPORT const char *const ValueModifyModesStrings [NumValueModifyModes]
 String versions for ModificationModes. More...
 
MLDICOMTags_EXPORT const char *const OtherTagModificationModesStrings [NumOtherTagModificationModes]
 String versions for OtherTagModificationModes. More...
 

Detailed Description

A namespace collecting tools related to DICOM tags and tree tools.

A namespace collecting tools related to DICOM tags and dictionaries.

Typedef Documentation

◆ SpectComplex

typedef std::complex<float> ml::DICOMTagTools::SpectComplex

Define a complex data type to be used for spectroscopy data.

Definition at line 32 of file mlDICOMTagSpectTools.h.

◆ TagIdDesc

< Small structure describing a tag to be removed from a DCMTree tree with the helper function - see removeTags.

Do not use, only for backward compatibility.

◆ ZTUVector

typedef std::vector<ZTUIndex> ml::DICOMTagTools::ZTUVector

A std::vector typedef of ZTUIndexes to describe indexes of handles in the multi-frame Z, T, and U dimension with one string value.

Definition at line 70 of file mlZTUIndex.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Number of available ValueModifyModes.

Enumerator
NumValueModifyModes 

Definition at line 333 of file mlDICOMSetAddTagTools.h.

◆ anonymous enum

anonymous enum

Defines the number of available modification modes.

Enumerator
NumOtherTagModificationModes 

Definition at line 223 of file mlDICOMTreeModificationTools.h.

◆ OrientationType

Enumerator for typical human readable anatomic orientations.

Enumerator
InvalidOrientation 

Something in the orientation is not standard compliant.

Axial 

axial in supine position

Prone 

axial in prone position

Cranial 

Cranial.

Coronal 

Coronal.

Sagittal 

Sagittal.

AlmostAxial 

Approximately Axial.

AlmostCoronal 

Approximately Coronal.

AlmostSagittal 

Approximately Sagittal.

LessAlmostAxial 

Less approximately Axial.

LessAlmostCoronal 

Less approximately Coronal.

LessAlmostSagittal 

Less approximately Sagittal.

Oblique 

Oblique.

OtherOrientation 

A valid orientation, but non of the upper ones.

NoValues 

No orientation values found in DICOM tree.

NotApplicable 

Orientation type makes no sense in this context.

NumberOfOrientationTypes 

Number of available orientation modes.

Definition at line 228 of file mlDICOMGetTools.h.

◆ OtherTagModificationModes

Available modes for tag modifications.

Enumerator
OtherTagDoNotModify 

No tag is not modified.

DropType2SQTagValues 

Drop all toplevel sequence tags known as type 2 only.

DropType3SQTagValues 

Drop all toplevel sequence tags known as type 3 only.

ReplaceType2Tags 

All values of toplevel non-sequence tags known as type 2 only, are replaced (if needed added) by the given string value if possible; the given value is split at "\\"s to multiple values if vr allows that (LT, ST, UT allow backslashes and have only one value after replace); values not convertible (for example text strings to numbers) will result to 0 values.

ReplaceType3Tags 

All values of toplevel non-sequence tags known as type 3 only, are replaced (if needed added) by the given string value if possible; the given value is split at "\\"s to multiple values if vr allows that (LT, ST, UT allow backslashes and have only one value after replace); values not convertible (for example text strings to numbers) will result to 0 values.

RemoveType3Tags 

All toplevel tags known as type 3 only, are removed.

Definition at line 207 of file mlDICOMTreeModificationTools.h.

◆ ValueModifyModes

Ways how to modify a tag with with _modificationStringValue.

Enumerator
Replace 

The value of the DICOM tag is replaced by a new one.

DoNotModify 

The value of the DICOM tag is not modified.

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.

Definition at line 325 of file mlDICOMSetAddTagTools.h.

Function Documentation

◆ addStringTagToTree() [1/2]

template<typename TAG_VAL_TYPE >
DCMTree::TagPtr ml::DICOMTagTools::addStringTagToTree ( DCMTree::TreePtr  dcmTree,
const DCMTree::TagId tagId,
const TAG_VAL_TYPE &  vec 
)

Same as addStringTagToTree(DCMTree::TreePtr, DCMTree::TagId, const TAG_VAL_TYPE &, bool doMultiValueAdd) without doMultiValue add which only works a single string argument.

This is only provided fopr backward compatibility. Use the version with doMultValueAdd instead.

Definition at line 267 of file mlDICOMSetAddTagTools.h.

References addTagToTree(), and setTagStringValue().

◆ addStringTagToTree() [2/2]

template<typename TAG_VAL_TYPE >
DCMTree::TagPtr ml::DICOMTagTools::addStringTagToTree ( DCMTree::TreePtr  dcmTree,
const DCMTree::TagId tagId,
const TAG_VAL_TYPE &  vec,
bool  doMultValueAdd,
signed char  maxSize = -1 
)

A template function which adds a new tag to dcmTree which has the value representation vr and the id tagId.

Its value is as string whose components are from vec and which are separated by backslashes. This function only supports TAG_VALUE_TYPE arguments for which a matching setTagStringValue function is found. If dcmTree is nullptr the call is ignored. It is expected that the value representation can decode coded strings whose components are separated by backslashes; if another vr is passed then a DCMTree::Exception is thrown.

Definition at line 249 of file mlDICOMSetAddTagTools.h.

References addTagToTree(), and setTagStringValue().

◆ addTag()

MLDICOMTags_EXPORT DCMTree::TagPtr ml::DICOMTagTools::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 
)

Add the tag with ID _tagId to tree dcmTree and value _modificationStringValue; requires a valid non nullptr dcmTree.

Parameters
dcmTreeThe DICOM tree to which the tag shall be added, must be non nullptr.
errStrIf nullptr then potential errors will be posted as ML_PRINT_ERROR, otherwise the error description will be appended to *errStr.
tagIdThe DICOM tag id of the tag to manipulate.
tagStrValueThe string value used to manipulate the tag with id tagId.
setValueIf true then the value is set from the given string, otherwise no value is set.
numValsThe number of values to add, default is 1.
vrThe value representation to use, or - if nullptr - LO for private tags and normal dictionary lookup for standard tags.
splitValueIf true then the value is decomposed at backslashes, otherwise one value is added.
Returns
A null tag pointer on failure or the pointer to the created tag. Note that in a valid tag can be returned and an error can occur, for example if adding the tag is successful, but value setting fails.

◆ addTagToTree() [1/2]

template<typename TAG_VAL_TYPE >
DCMTree::TagPtr ml::DICOMTagTools::addTagToTree ( DCMTree::TreePtr  dcmTree,
const DCMTree::TagId tagId,
TAG_VAL_TYPE  val0,
TAG_VAL_TYPE  val1,
TAG_VAL_TYPE  val2 
)

A template function which adds a new tag with id tagId to dcmTree.

The three values val0, val1, and val2 are set and if necessary the values are created in the tag. This function only supports TAG_VALUE_TYPE arguments for which a matching setTagValue function is found. If dcmTree is nullptr the call is ignored. It is expected that the value representation vr is compatible with TAG_VAL_TYPE; if another vr is passed then a DCMTree::Exception is thrown.

Definition at line 288 of file mlDICOMSetAddTagTools.h.

References setTagValue().

Referenced by addStringTagToTree().

◆ addTagToTree() [2/2]

MLDICOMTags_EXPORT DCMTree::TagPtr ml::DICOMTagTools::addTagToTree ( DCMTree::TreePtr  dcmTree,
const DCMTree::TagId tagId,
unsigned int  numValues = 1,
const DCMTree::Vr vr = nullptr,
unsigned int  numSQValues = 1 
)

Add a tag with id tagId to dcmTree.

On sequence value representations numSQValues=1 sequence items with tree is added by default, otherwise one default value. If the tag is not of type SQ numValues values are added by default. If tagId is private then LO will be used as default value representation. If vr is non nullptr then *vr is used as vr instead of version from dictionary. The call is ignored if dcmTree is nullptr. Throws a DCMTree::Exception if tagId is not found in dictionary.

◆ appendHexDumpToString()

MLDICOMTags_EXPORT void ml::DICOMTagTools::appendHexDumpToString ( const unsigned char *  dataPtr,
const unsigned int  numDataBytes,
std::string &  resultValStr,
bool  printSpaces 
)

Appends hexadecimal dump of numDataBytes bytes to tagValStr.

Parameters
dataPtrAvailable content is appended as hex dump to resultValStr, may be nullptr.
numDataBytesThe actual number of bytes from dataPtr to be dumped, dataPtr must contain then if not nullptr.
resultValStrThe string to which the dump is appended.
printSpacesIf true then hexadecimal values are separated with spaces, otherwise not.
Returns
See resultValStr.

◆ appendSequenceEntries()

MLDICOMTags_EXPORT void ml::DICOMTagTools::appendSequenceEntries ( DCMTree::TagPtr  tag,
MLint  numEntries,
std::string &  errStr 
)

Append a number of entries to the sequence in tag and initialize it with an empty DCMTree; the number of appended entries is given in modificationValue, and any error will be appended as textual description to errStr which is left unchanged in case of success.

◆ checkForOneOf()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::checkForOneOf ( DCMTree::TagId  id,
DCMTree::Const_TreePtr  dcmTree,
const char *const  valueList[],
size_t  numValues,
bool  requiresExistingTag = true,
bool  requiresTextStringValue = true 
)

Checks whether the tag has any of the values in valueList - if yes then an empty string is returned, otherwise a textual error description; dcmTree and valueList must be non-nullptr.

Parameters
idId of the tag whose value shall be searched in valueList.
dcmTreeThe non-nullptr tree in which the tag with id shall be searched and compared.
valueListThe non-nullptr list of strings the tag value shall be compared with.
numValuesThe exact number of entries in valueList.
requiresExistingTagIf true (the default) tag must be non nullptr, otherwise the returned value string will be a non empty string; as error message; if false the return will be empty if tag is nullptr.
requiresTextStringValueIf true (the default) tag must be non nullptr and have a non empty string value, otherwise the returned value string will be a non empty error message; if false the return will be empty on empty tag values.

◆ cloneDCMTree()

MLDICOMTags_EXPORT DCMTree::TreePtr ml::DICOMTagTools::cloneDCMTree ( DCMTree::Const_TreePtr  dcmTree,
std::string *  errStr 
)

Create a deep-copy of the passed dcmTree as DICOM tree to be modified.

Parameters
dcmTreeThe DICOM tree to be duplicated.
errStrIf non-null a potential error description is appended, otherwise occurring errors will be posted with ML_PRINT_ERROR.
Returns
The duplicate of dcmTree; on error always a DCMTree::TreePtr() is returned; if dcmTree is nullptr then DCMTree::TreePtr() is returned without error.

◆ compareDCMTrees()

MLDICOMTags_EXPORT void ml::DICOMTagTools::compareDCMTrees ( DCMTree::Const_TreePtr  inputTree1,
DCMTree::Const_TreePtr  inputTree2,
const std::vector< DCMTree::TagId > &  idsExcludedFromChanged,
DCMTree::TreePtr unchangedTags,
DCMTree::TreePtr addedTags,
DCMTree::TreePtr removedTags,
DCMTree::TreePtr changedTags,
bool  alsoExcludeFromAdded = false,
bool  alsoExcludeFromRemoved = false,
bool  compareRecursively = false,
bool  cleanupEmptyTrailingSequenceTreesInAddedTags = false,
bool  cleanupEmptyTrailingSequenceTreesInRemovedTags = false,
bool  compareMultiplicity = false,
bool  cleanupEmptyTrailingSequenceTreesInChangedTags = true,
bool  compareMultiFrameData = true 
)

Compare the given two trees and update the result pointers.

The comparison is done basically on top level tags for addition, removal and changes.

Parameters
inputTree1The tree whose differences to inputTree2 shall be calculated.
inputTree2The tree whose differences to inputTree1 shall be calculated.
idsExcludedFromChangedThese ids are not added to changedTags even if they differ.
unchangedTagsA tree containing all tags which do not differ between inputTree1 and inputTree2.
addedTagsA tree containing all tags which do not exist in inputTree1 but in inputTree2.
removedTagsA tree containing all tags which exist in inputTree1 but not in inputTree2.
changedTagsA tree containing all tags which differ between inputTree1 and inputTree2.
alsoExcludeFromAddedIf true then added tags with ids found in idsExcludedFromChanged are also ignored.
alsoExcludeFromRemovedIf true then removed tags with ids found in idsExcludedFromChanged are also ignored.
compareRecursivelyIf true then the trees are compared recursively tag by tag, if false then on top level the sequence tags are compared as single tags.
cleanupEmptyTrailingSequenceTreesInAddedTagsIf enabled and alsoExcludeFromAdded is enabled then trailing empty sequence item trees of added sequence tags will be removed from the comparison result; this is often wanted if result trees are empty after ignoring added tags with alsoExcludeFromAdded in idsExcludedFromChanges.
cleanupEmptyTrailingSequenceTreesInRemovedTagsIf enabled and alsoExcludeFromRemoved is enabled then trailing empty sequence item trees of removed tags will be removed from the comparison result; this is often wanted if result trees are empty after ignoring removed tags with alsoExcludeFromRemoved in idsExcludedFromChanges.
compareMultiplicityIf enabled then the multiplicity of existing tags is compared, otherwise not.
cleanupEmptyTrailingSequenceTreesInChangedTagsIf enabled then trailing empty sequence item trees of changed tags will be removed from the comparison result. In tree comparisons these trailing empty sequences often are useless information and help less than they bother, thus it the default is true.
compareMultiFrameDataSince a comparison of large multi-frame data is time consuming, it can be disabled with false, otherwise the data is compared (which is the default).
Returns
The trees unchangedTags, addedTags, removedTags, changedTags.

◆ convertDCMToSMFTree()

MLDICOMTags_EXPORT DCMTree::Const_StructuredMFPtr ml::DICOMTagTools::convertDCMToSMFTree ( DCMTree::Const_TreePtr  dcmTree)

Convert dcmTree to the returned StructuredSMFTree if possible or throws and DCMtree::Exception.

◆ createInstanceUID()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::createInstanceUID ( bool  useFMEUIDPrefix = false)

Generate new IDs for DICOM frames, for example new SOPinstanceUIDs.

Parameters
useFMEUIDPrefixif true then the FME prefix is used, otherwise the MMS prefix.
Returns
the DICOM compatible UID.

◆ deepSearchTag() [1/4]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::deepSearchTag ( DCMTree::Const_TreePtr  treePtr,
const DCMTree::TagId tagId,
DCMTree::Const_TagPtr result 
)

Searches a tag also in sequence tags and returns true if found, the tag is returned in result; the call is ignored if treePtr is nullptr.

Parameters
treePtrThe DCMTree in which the tag is searched.
tagIdThe tag to be searched for as a an id.
resultThe pointer to the found tag or a nullptr pointer otherwise.
Returns
true if the tag has been found, false otherwise.

◆ deepSearchTag() [2/4]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::deepSearchTag ( DCMTree::Const_TreePtr  treePtr,
const std::string &  tagIdStr,
DCMTree::Const_TagPtr result 
)

Searches a tag also in sequence tags and returns true if found, the tag is returned in result.

Parameters
treePtrThe DCMTree in which the tag is searched.
tagIdStrThe tag to be searched for as a name string.
resultThe pointer to the found tag or a nullptr pointer otherwise.
Returns
true if the tag has been found, false otherwise.

◆ deepSearchTag() [3/4]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::deepSearchTag ( DCMTree::TreePtr  treePtr,
const DCMTree::TagId tagId,
DCMTree::TagPtr result 
)

Alternative version to deepSearchTags(DCMTree::Const_TreePtr, const DCMTree::TagId, DCMTree::Const_TagPtr &) for non constant trees and tags.

◆ deepSearchTag() [4/4]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::deepSearchTag ( DCMTree::TreePtr  treePtr,
const std::string &  tagIdStr,
DCMTree::TagPtr result 
)

Alternative version to deepSearchTags(DCMTree::Const_TreePtr, const std::string &, DCMTree::Const_TagPtr &) for non constant trees and tags.

◆ deepSearchTags() [1/2]

MLDICOMTags_EXPORT void ml::DICOMTagTools::deepSearchTags ( DCMTree::Const_TreePtr  treePtr,
const DCMTree::TagId tagId,
const size_t  numTagsToFind,
std::vector< DCMTree::Const_TagPtr > &  tagVector 
)

Searches the first at most numTagsToFind tags with id tagId in treePtr and appends them to tagVector; the call is ignored if treePtr is nullptr.

Parameters
treePtrThe DCMTree in which the tags are to be searched.
tagIdThe id of the tag to be searched.
numTagsToFindThe maximum number of tags to be searched/added.
tagVectorA vector to which at most numTags pointers to DICOM tags are appended.

◆ deepSearchTags() [2/2]

MLDICOMTags_EXPORT void ml::DICOMTagTools::deepSearchTags ( DCMTree::TreePtr  treePtr,
const DCMTree::TagId tagId,
const size_t  numTagsToFind,
std::vector< DCMTree::TagPtr > &  tagVector 
)

Alternative version to deepSearchTags(DCMTree::Const_TreePtr, const DCMTree::TagId, const size_t, std::vector<DCMTree::Const_TagPtr> &) for non constant trees and tags; the call is ignored if treePtr is nullptr.

◆ determinePaletteInformation()

MLDICOMTags_EXPORT void ml::DICOMTagTools::determinePaletteInformation ( DCMTree::Const_TreePtr  dcmTree,
DicomPaletteInfo info 
)

Gets the palette information from dcmTree into a DicomPaletteInfo structure.

On successful decoding of the DICOM tags the voxDataType will be a valid one; otherwise it will be set to ML_INVALID_DATA_TYPE.

◆ doTagsEqual()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::doTagsEqual ( DCMTree::Const_TagPtr  tag1,
DCMTree::Const_TagPtr  tag2,
bool  compareMultiplicity = false,
bool  compareMultiFrameData = true 
)

Compare the given two tags and their contents for equality.

Returns false

  • if exactly one of both tags is nullptr
  • if their ids differ
  • if their number of values/frames differ
  • if any value content or size differs
  • if compareMultiplicity is true and tags have a different multiplicity. Returns true
  • if both tags are nullptr or
  • if they have same number of values/frames and same
    sized content in their corresponding values/frames, and compareMultiplicity is false or both multiplicities are equal.
  • Value data of multi-frame pixels is compared if compareMultiFrameData is true, otherwise it is always considered equal.

◆ dumpDCMTreeToReadableString()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::dumpDCMTreeToReadableString ( DCMTree::Const_TreePtr  treePtr,
const std::string &  prefix = "",
MLint  maxNum = 50000,
bool  decodePrivateTags = false,
unsigned int  numBinDumpEntries = 8,
bool  annotate = false,
const std::string &  regExLineFilter = "",
bool  showNumOfTagValues = true,
bool  hideNULLItems = false 
)

Creates a string from the DicomTree tags and updates the information field.

Parameters
treePtrThe DCMTree to be dumped into the returned string.
prefixThe string added before each line of the dumped tree.
maxNumIs the maximum size of the created result string.
decodePrivateTagsIf true then also binary private tag values are decoded and dumped if decoders for them are available, otherwise only basic binary infos are listed.
numBinDumpEntriesMaximum number of shown elements of binary tags.
annotateIf true then additional descriptive information is dumped together with the tag listing.
regExLineFilterA regular expression applied to each line of the tag dump; only lines with matching expressions are listed; all others are skipped. An empty string disables filtering.
showNumOfTagValuesIf true then tag dump also displays the number of values of each tag; otherwise this is not displays.
hideNULLItemsIf true then sequence items with a nullptr tree pointer are not listed; if false then a string such as "Sequence item IDX:\n" is appended. Note that true also reduces the number of entries shown from a sequence tags: A sequence with five items where two items are NULL will be displayed as a sequence with three items. Although this is not purely correct it is sometimes very helpful for displaying dumps where sequences with content and empty entries must be counted differently.
Returns
The DCMTree treePtr dumped as a readable string.

◆ extractAllSMFFramesAsDeepCopies()

MLDICOMTags_EXPORT void ml::DICOMTagTools::extractAllSMFFramesAsDeepCopies ( DCMTree::Const_StructuredMFPtr  inputSMFTree,
std::vector< DCMTree::Const_TreePtr > &  frameSet 
)

Retrieves all frame trees of the input SMFTree as deep-copies and returns their pointers in frameSet.

◆ extractTagValuesFromPerFrameAndMeVisMFSequence()

MLDICOMTags_EXPORT void ml::DICOMTagTools::extractTagValuesFromPerFrameAndMeVisMFSequence ( DCMTree::RawTagId  rawTagId,
DCMTree::Const_TreePtr  dcmTree,
std::string &  tagValuesStringListToExtend,
bool  alsoAddTopLevelTags,
const std::string &  sep,
std::set< std::string > *  makeUniqueSet = nullptr 
)

Looks for frame-specific tags with ID rawTagId in sequences DCMTree_PerFrameFunctionalGroupsSequence and getMeVisStructuredMFDimensionSequence of dcmTree and if they are found they are appended to tagValuesStringListToExtend, separated with sep.

If alsoAddTopLevelTags is true the also root tag values are appended if found.

Parameters
rawTagIdThe ID of tag whose value is to be searched in the sequences. If rawTagId is DCMTree_SOPInstanceUID, then also private ones are used which are coded under FMEPrivateSourceSOPInstanceUIDOfDecomposedFrame id.
dcmTreeThe DICOM tree in which the sequences are searched.
tagValuesStringListToExtendThe string at whose end the found values are concatenated (if necessary separated with sep).
alsoAddTopLevelTagsIf true the also tag value(s) found in the root of dcmTree are appended at the end.
sepThe string separator to be inserted between elements appended to tagValuesStringListToExtend.
makeUniqueSetIf nullptr then all found values are appended regardless of duplicate values; if passed non-nullptr then all values already in *makeUniqueSet are not appended any more; all others are inserted into *makeUniqueSet and appended normally.

◆ findPrivateTagGroup()

MLDICOMTags_EXPORT unsigned int ml::DICOMTagTools::findPrivateTagGroup ( DCMTree::TreePtr  dcmTree,
const std::string &  privateCreatorString 
)

Determine tag ID mask of the private creator given by privateCreatorString and return it as mask 0xGGGGPP00 where GGGG is the private creator group id and PP the lower eight bit defining the upper eight bits of added private tags.

If not found or failure 0x00000000 is returned.

Parameters
dcmTreeTree from which all tags of a private creator shall be removed.
privateCreatorStringIf removeAllPrivateCreators is false then this is the string description of the private creator which must match exactly the tag string; otherwise not used.

◆ get4x4DoubleMatrixFromTag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::get4x4DoubleMatrixFromTag ( DCMTree::Const_TagPtr  tagPtr,
Matrix4 returnMat 
)

Converts 16 values of tagPtr to 16 double matrix values in returnMat, respectively.

Parameters
tagPtrThe tag whose values are to be converted.
returnMatThe matrix whose values are filled with values from the tag value. Unchanged if anything in conversion failed.
Returns
true in the case of a complete conversion success, false in the case that tagPtr was nullptr or the tag value did not have exactly 16 double-convertible values, or any DCMTree::Exception occurred (all exceptions are caught).

◆ getAnyPixelDataTag()

MLDICOMTags_EXPORT DCMTree::Const_TagPtr ml::DICOMTagTools::getAnyPixelDataTag ( DCMTree::Const_TreePtr  treePtr,
bool  searchRecursivly = false 
)

Searches and returns the first pixel data pointer on top level found in treePtr, or a nil tag if not found.

It is checked for (0x7fe0, 0x0010) = DCMTree_PixelData, (0x7fe0, 0x0008) = DCMTree_FloatPixelData, (0x7fe0, 0x0009) = DCMTree_DoubleFloatPixelData, (0x5600, 0x0020) = DICOM2007 spectroscopy data tag, and (0x7fe1, 0x1010) = old spectroscopy data tag, in this order. If searchRecursivly is true and no pixel data tag is found on root level of the tree then also a deepSearch is performed for the first pixeldata-like tag.

◆ getAsMFPixelPtr()

MLDICOMTags_EXPORT const DCMTree::MFPixelTag* ml::DICOMTagTools::getAsMFPixelPtr ( DCMTree::Const_TagPtr  tag)

Returns a pointer to the correctly cast multi-frame class type of tag if it is a valid multi-frame pixel data tag; in all other cases it returns nullptr.

◆ getComplexSpectDataCopy()

MLDICOMTags_EXPORT void ml::DICOMTagTools::getComplexSpectDataCopy ( DCMTree::Const_TreePtr  treePtr,
size_t &  chunkSize,
SpectComplex *&  cplxChunk 
)

Tries to get a copy of the complex spectroscopy data chunk form the DCMree.

The returned data must be deleted by caller with delete[]. On success chunkSize returns the number of read complex values and cplxChunk the pointer to it, otherwise chunkSize is 0 and cplxChunk is set to nullptr. This function does not handle multi-frame pixel tags.

◆ getCompressionDescription()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::getCompressionDescription ( DCMTree::Const_TreePtr  treePtr,
bool *  isRetired = nullptr 
)

Returns a textual description of a compression type if it is found in the available transfer UIDs stored in this functions.

If isRetired is nullptr it is ignored. If isRetired is non nullptr then *isRetired is set true if the compression is known to be retired otherwise to false.

◆ getDoubleFromTag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::getDoubleFromTag ( DCMTree::Const_TagPtr  tagPtr,
double &  returnDbl 
)

Converts one values of tagPtr to a double values in returnDbl.

Parameters
tagPtrThe tag whose values are to be converted.
returnDblThe double whose value is filled with the value from the tag value. Unchanged if anything in conversion failed.
Returns
true in the case of a complete conversion success, false in the case that tagPtr was nullptr or the tag value did not have exactly one double-convertible value, or any DCMTree::Exception occurred (all exceptions are caught).

◆ getDoubleVectorFromTag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::getDoubleVectorFromTag ( DCMTree::Const_TagPtr  tagPtr,
std::vector< double > &  returnDbls 
)

Converts all values of tagPtr to a std::vector of doubles in returnDbls.

Parameters
tagPtrThe tag whose values are to be converted.
returnDblsThe double vector which is filled with the values from the tag value in case of success, otherwise left with undefined content. In case of zero values in tagPtr true is returned with empty returnDbls.
Returns
true in the case of a complete conversion success, false in the case that tagPtr was nullptr or the tag value did not have any double-convertible values, or any DCMTree::Exception occurred (all exceptions are caught).

◆ getHexTag()

MLDICOMTags_EXPORT size_t ml::DICOMTagTools::getHexTag ( DCMTree::Const_TreePtr  treePtr,
DCMTree::RawTagId  tagId,
double &  ippX1,
double &  ippY1,
double &  ippZ1,
double &  ippX2,
double &  ippY2,
double &  ippZ2,
double  initX1,
double  initY1,
double  initZ1,
double  initX2,
double  initY2,
double  initZ2 
)

Returns the given DICOM tag as two 3 component double vectors; all values which can not be retrieved are returned as values given by the corresponding init* values.

The number of valid coordinates is returned, or 0 if no value is found or if the tag itself is not found or if treePtr is nullptr.

◆ getHumanReadableImageOrientationPatient()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::getHumanReadableImageOrientationPatient ( DCMTree::Const_TreePtr  dcmTree,
int *  resultOType = nullptr 
)

Determine (ACR_NEMA)ImageOrientationPatient from dcmTree and create a human readable orientation from it with additional error information if necessary.

Parameters
dcmTreeThe DICOM tree from which the values shall be extracted.
resultOTypeIgnored if nullptr, otherwise *resultOType will be set to the OrientationType enumerator of the determined orientation.
Returns
A string containing a string representation describing the orientation. If no dcmTree is available then a "n/a" is returned.

◆ getImageOrientationPatient()

MLDICOMTags_EXPORT size_t ml::DICOMTagTools::getImageOrientationPatient ( DCMTree::Const_TreePtr  treePtr,
double &  iopX1,
double &  iopY1,
double &  iopZ1,
double &  iopX2,
double &  iopY2,
double &  iopZ2 
)

Return the DICOM tag ImageOrientationPatient as two 3D vectors (iopX1, iopY1, iopZ1) and (iopX2, iopY2, iopZ2); all values which can not be retrieved are returned as from the corresponding components from (X1,Y1,Z1)=(1,0,0) and (X2,Y2,Z2)=(0,1,0).

The number of valid coordinates is returned, and 0 if no value is found or the tag itself is not found.

◆ getImagePositionPatient()

MLDICOMTags_EXPORT size_t ml::DICOMTagTools::getImagePositionPatient ( DCMTree::Const_TreePtr  treePtr,
double &  ippX,
double &  ippY,
double &  ippZ,
bool  replaceOnlyIfFound 
)

Return the DICOM tag ImagePositionPatient as three double values; all values which can not be retrieved are returned as 0.

The number of valid coordinates is returned, and 0 if no value is found or the tag itself is not found. All not found extents are filled with 0 if replaceOnlyIfFound==false, otherwise they are only set if they are found.

◆ getIndexedNormalSequenceSubTrees()

MLDICOMTags_EXPORT std::vector<DCMTree::TreePtr> ml::DICOMTagTools::getIndexedNormalSequenceSubTrees ( const DCMTree::TreePtr parentTree,
const std::string &  tagIdString,
const std::string &  sequenceEntriesString,
DICOMTagTools::ZTUVector ztuIndexes = nullptr,
bool  alsoGetNULLTrees = false 
)

Returns a vector of all DCMTree::TreePtrs indexed by sequenceEntriesString and taken from the sequence tag defined by tagIdString.

If ztuIndexes is non nullptr then for each entry in the returned vector the corresponding ZTUIndex position is appended to *ztuIndexes where z is the index to the sequence item and t and u are set to 0; ignored if nullptr.

◆ getMeVisStructuredMFDimensionSequence()

MLDICOMTags_EXPORT DCMTree::Const_TagPtr ml::DICOMTagTools::getMeVisStructuredMFDimensionSequence ( DCMTree::Const_TreePtr  dcmTree)

Searches the structured multi-frame sequence tag on top-level in dcmTree or nullptr if not found or dcmTree is nullptr.

◆ getModalityForSOPClassUID()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::getModalityForSOPClassUID ( const std::string &  sopClassUID)

EXPERIMENTAL FUNCTION: If its is known then return the modality corresponding to sopClassUID; if not known or unclear then an empty string is returned.

See http://medical.nema.org/medical/dicom/current/output/pdf/part04.pdf.

◆ getModalityTagValue()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::getModalityTagValue ( DCMTree::Const_TreePtr  treePtr)

Returns a string with value of the modality tag if it can be determined from the passed tree or an empty string otherwise.

Note that this may differ from the equipment that originally acquired the data. For a safer check for the equipment use either hasTrueModality(), hasSOPClassUID(), or hasSOPClassUIDOfModality().

◆ getNumberOfFrames()

MLDICOMTags_EXPORT unsigned int ml::DICOMTagTools::getNumberOfFrames ( DCMTree::Const_TreePtr  dcmTree,
unsigned int *  fromTagOnly = nullptr 
)

◆ getPixelDataFrame()

MLDICOMTags_EXPORT const boost::shared_array<unsigned char> ml::DICOMTagTools::getPixelDataFrame ( DCMTree::Const_TagPtr  pixTag,
boost::uint32_t  frameIdx 
)

Returns a memory copy of the frame at index position frameIdx of the pixel data tag pixTag or nullptr if it is not such tag, the frameIdx is out of range or any other error.

Note that normal dcmTree loaders do not load pixel data, because they are only loaded when really displayed to save performance. Thus values are often not available although the pixel tag exists. Use getPixelDataPtrFromTree() to really load pixel data.

◆ getPixelDataPtrFromTree()

MLDICOMTags_EXPORT DCMTree::PixelData ml::DICOMTagTools::getPixelDataPtrFromTree ( DCMTree::Const_TreePtr  treePtr,
size_t *  valSizeInBytes,
DicomMessageCollector dcmMsgCollector 
)

◆ getPrivateFMETag()

MLDICOMTags_EXPORT DCMTree::Const_TagPtr ml::DICOMTagTools::getPrivateFMETag ( DCMTree::RawTagId  lowerEightBitOfElementId,
DCMTree::Const_TreePtr  dcmTree 
)

Searches private FME tag with lower 8 bit element id lowerEightBitOfElementId with FMEPrivateTagsGroupId and FMEPrivateCreatorString in dcmTree and returns the tag if possible, otherwise (if dcmTree is nullptr, not found, no slot etc.) it returns nullptr.

◆ getPrivateTag()

MLDICOMTags_EXPORT DCMTree::Const_TagPtr ml::DICOMTagTools::getPrivateTag ( const std::string &  privateCreatorString,
unsigned short  groupId,
DCMTree::RawTagId  lowerEightBitOfElementId,
DCMTree::Const_TreePtr  dcmTree 
)

◆ getRescaleSlopeInterceptAsScaleShift()

MLDICOMTags_EXPORT ScaleShiftData ml::DICOMTagTools::getRescaleSlopeInterceptAsScaleShift ( DCMTree::Const_TreePtr  treePtr)

Returns a ScaleShiftData object according to rescale and slope tag values.

If both or any of these tags cannot be determined for any reason then the corresponding ScaleShiftData parameter is left on its default value.

◆ getSequenceItemTree()

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.

If tagPtr is nullptr or if it has another value representation than SQ then nullptr is returned. If itemIdx is std::string::npos then itemIdx is updated such that one new entry is appended, otherwise if itemIdx is out of range then as many items are added as needed such that it is a valid entry and can be returned. If an added entry or returned entry does not contain a valid tree, then a new, empty one is created and set as new tree in the sequence entry.

Parameters
tagPtrThe pointer to the tag whose itemIdx'th sequence item shall be returned.
itemIdxThe index of the sequence item to be returned.

◆ getSequenceItemTreePtrVector()

MLDICOMTags_EXPORT const DCMTree::TreePtrVector* ml::DICOMTagTools::getSequenceItemTreePtrVector ( DCMTree::Const_TreePtr  dcmMFTree,
DCMTree::RawTagId  sequenceTagId 
)

If possible it returns a pointer to the vector of sequence item (trees) of the tag with id sequenceTagId, otherwise nullptr (for example a nullptr input tree of tag not found or no sequence tag).

◆ getSMFSubTreeFramesAtZTUTriplePositions()

MLDICOMTags_EXPORT std::vector<DCMTree::TreePtr> ml::DICOMTagTools::getSMFSubTreeFramesAtZTUTriplePositions ( const DCMTree::TreePtr parentTree,
const std::vector< MLuint32 > &  ztuTriples,
DICOMTagTools::ZTUVector ztuIndexes = nullptr 
)

Builds ztuTriples.size()/3 triples from the indexes in the ztuTriples and returns a vector of all DCMTree::TreePtrs at the triple positions of the MeVis SMF subtrees of parentTree if there is any.

One or two superfluous indexes in ztuTriples which are not enough to build their own triple are ignored. If ztuIndexes is non nullptr then for each entry in the returned vector the corresponding ZTUIndex position is appended to *ztuIndexes; ignored if nullptr.

◆ getSMFSubTreeZTUFrameSlices()

MLDICOMTags_EXPORT std::vector<DCMTree::TreePtr> ml::DICOMTagTools::getSMFSubTreeZTUFrameSlices ( const DCMTree::TreePtr parentTree,
const std::string &  zSlicesEntriesList,
const std::string &  tSlicesEntriesList,
const std::string &  uSlicesEntriesList,
DICOMTagTools::ZTUVector ztuIndexes = nullptr 
)

Returns a vector of DCMTree::TreePtrs of all MeVis SMF subtrees which are described by the combinations of all indexes in the fields [z|t|u]SlicesEntriesList.

If ztuIndexes is non nullptr then for each entry in the returned vector the corresponding ZTUIndex position is appended to *ztuIndexes; ignored if nullptr. Example: getSMFSubTreeZTUFrameSlices(tree, "0-2", "0-1", "0-3",...) checks all combinations of indexes [0,1,2] x [0,1], [0,1,2,3,4], i.e. 30 index triples. Note that too large ranges (e.g. 0-5) will be considered invalid if range of trees in the corresponding dimension is only from 0-3 or so. Best specifiy ranges "0-", "0-", "0-" which covers all ranges in z,t,u available in parentTree.

◆ getSMFTreeFrameTreeAtZTU() [1/3]

MLDICOMTags_EXPORT DCMTree::TreePtr ml::DICOMTagTools::getSMFTreeFrameTreeAtZTU ( DCMTree::Const_StructuredMFPtr  smfTree,
const ZTUIndex ztu 
)

Returns a deep-copy of DCMTree at frame position (z,t,u) from constant smfTree if it exists or nullptr if not; constant version for non-copied returned tree is not supported in DCMTree::StructuredMF class and is therefore not available here, see also extractAllSMFFramesAsDeepCopy();.

◆ getSMFTreeFrameTreeAtZTU() [2/3]

MLDICOMTags_EXPORT DCMTree::TreePtr ml::DICOMTagTools::getSMFTreeFrameTreeAtZTU ( DCMTree::StructuredMFPtr  smfTree,
const ZTUIndex ztu 
)

Returns the DCMTree at frame position (z,t,u) from non-constant smfTree if it exists or nullptr if not; constant version for non-deep-copied returned tree is not supported in DCMTree::StructuredMF class and is therefore not available here, see also extractAllSMFFramesAsDeepCopy().

◆ getSMFTreeFrameTreeAtZTU() [3/3]

MLDICOMTags_EXPORT DCMTree::TreePtr ml::DICOMTagTools::getSMFTreeFrameTreeAtZTU ( DCMTree::TreePtr  dcmTree,
const ZTUIndex ztu 
)

Returns the DCMTree at frame position (z,t,u) from non-constant dcmTree if it exists or nullptr if not; constant version is not supported in DCMTree::StructuredMF class and is therefore not available here.

◆ getSMFTreeZTUExtent() [1/4]

MLDICOMTags_EXPORT void ml::DICOMTagTools::getSMFTreeZTUExtent ( const DCMTree::Const_StructuredMFPtr  smfTree,
ZTUIndex ztu 
)

Get extent of the constanVis Structured Multi Frame set of the constant smfTree in ztu.

Returns 0,0,0,"" if it cannot be determined or input tree is not a valid smf tree (pointer).

◆ getSMFTreeZTUExtent() [2/4]

MLDICOMTags_EXPORT void ml::DICOMTagTools::getSMFTreeZTUExtent ( const DCMTree::StructuredMFPtr  smfTree,
ZTUIndex ztu 
)

Get extent of the MeVis Structured Multi Frame set of the smfTree in ztu.

Returns 0,0,0,"" if it cannot be determined or input tree is not a valid smf tree (pointer).

◆ getSMFTreeZTUExtent() [3/4]

MLDICOMTags_EXPORT void ml::DICOMTagTools::getSMFTreeZTUExtent ( DCMTree::Const_TreePtr  dcmTree,
ZTUIndex ztu 
)

Get extent of the MeVis Structured Multi Frame set of the constant dcmTree in ztu.

Returns 0,0,0,"" if it cannot be determined or input tree is not a valid scm tree (pointer).

◆ getSMFTreeZTUExtent() [4/4]

MLDICOMTags_EXPORT void ml::DICOMTagTools::getSMFTreeZTUExtent ( DCMTree::TreePtr  dcmTree,
ZTUIndex ztu 
)

Get extent of the MeVis Structured Multi Frame set of the dcmTree in ztu.

Returns 0,0,0,"" if it cannot be determined or input tree is not a valid dcm tree (pointer).

◆ getSOPClassUIDTagValue()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::getSOPClassUIDTagValue ( DCMTree::Const_TreePtr  treePtr)

Returns a string with value of the SOPClassUID tag if it can be determined from the passed tree or an empty string otherwise.

◆ getSpectDataPtrFromTree()

MLDICOMTags_EXPORT const SpectComplex* ml::DICOMTagTools::getSpectDataPtrFromTree ( DCMTree::Const_TreePtr  treePtr,
size_t *  valSizeInBytes = nullptr 
)

Returns the pointer to the data value in the tag (0x7fe1, 0x1010) or - if that one does not exist - from the tag (0x5600, 0x0020).

If not data is found nullptr is returned. If valSizeInBytes is non nullptr the *valSizeInBytes is set to the size of the data chunk in bytes. This function does not handle multi frame pixel tags, nullptr is returned in that case.

◆ getTagIfItExists()

MLDICOMTags_EXPORT DCMTree::TagPtr ml::DICOMTagTools::getTagIfItExists ( DCMTree::TreePtr  dcmTree,
DCMTree::TagId  tagId,
std::string *  errStr = nullptr 
)
Parameters
dcmTreeThe DCMTree in which the tag shall be searched; must be non nullptr.
tagIdThe id of the tag to be searched.
errStrIf nullptr then potential errors will be posted as ML_PRINT_ERROR, otherwise the error description will be appended to *errStr.
Returns
the tag with the given id if it exists, otherwise return nullptr without considering this as an error; requires a valid non nullptr dcmTree.

◆ getTagStringValuesFromSequence()

MLDICOMTags_EXPORT void ml::DICOMTagTools::getTagStringValuesFromSequence ( DCMTree::RawTagId  rawTagId,
DCMTree::Const_TagPtr  sequenceInWhichToSearch,
std::string &  tagValuesStringListToExtend,
const std::string &  sep,
std::set< std::string > *  makeUniqueSet = nullptr,
bool  searchAsLower8BitOfPrivateFMETag = false 
)

Deep-searches all occurrences of the tag with id tagToSearch in the sequence tag sequenceInWhichToSearch and appends all string-converted values separated by sep to tagValuesStringListToExtend.

If sequenceInWhichToSearch is nullptr or no sequence then nothing is done. Entries not convertible to string are ignored.

Parameters
rawTagIdThe ID of tag whose value is to be searched in the sequence with tag id sequenceInWhichToSearch.
sequenceInWhichToSearchThe sequence in which all occurrences of tags with id tagToSearch shall be searched.
tagValuesStringListToExtendA string to which all string values of tagToSearch appearances are appended, separated by sep.
sepThe string to be used as separator between appended values.
makeUniqueSetIf true then multiple occurrences of the same value are stored in the set and only added once; otherwise each one is appended in the order of finding.
searchAsLower8BitOfPrivateFMETagIf false then tagToSearch is considered a normal tag id, if true then it is interpreted as lower eight bit of a FME private tag with FMEPrivateTagsGroupId and FMEPrivateCreatorString and only a normal top level search is performed.

◆ getTagStringValuesFromSMFSequence()

MLDICOMTags_EXPORT void ml::DICOMTagTools::getTagStringValuesFromSMFSequence ( DCMTree::Const_TreePtr  inputDcmTree,
const std::vector< MLuint64 > &  rawTagIds,
bool  appendFrameCount,
bool  appendCoords,
std::list< std::vector< std::string > > &  tagValuesListToExtend 
)

Looks for frame-specific tags rawTagIds in getMeVisStructuredMFDimensionSequence of inputDcmTree and if they are found they are appended to tagValuesStringListToExtend.

Parameters
inputDcmTreeThe DICOM tree in which the tags are searched in the SMF tree frames.
rawTagIdsThe tags Id to appended or an empty string is appended if not found; if an entry is smaller than 2^32 bit range then it is taken as normal RawTagId, otherwise it is cast to lower eight bits of a private FME tag id.
appendFrameCountIf true then the counter (starting at "1") for frames are appended.
appendCoordsIf true then the z and t coordinates of the frame are added as first two components.
tagValuesListToExtendFor each frame SMF frame and entry is pushed back and for each rawTagId the entry is filled with the corresponding string-converted tag value if possible or otherwise with an empty string; if addCoords is true then two additional string converted numbers with z and t position of the frame in the SMF tree structure are appended.

◆ getTagStringValuesFromTopLevel()

MLDICOMTags_EXPORT void ml::DICOMTagTools::getTagStringValuesFromTopLevel ( DCMTree::Const_TreePtr  inputDcmTree,
const std::vector< MLuint64 > &  rawTagIds,
std::vector< std::string > &  rootEntries 
)

Like getTagStringValuesFromSMFSequence() but retrieves tags only from top level of inputDcmTree into cleared rootEntries; coordinate entries are not appended to rootEntries.

◆ getTagValue()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::getTagValue ( DCMTree::Const_TreePtr  treePtr,
DCMTree::RawTagId  tagId,
bool  useNumericTagValueSorting 
)

Return tag value of first tag with id tagId in the DICOM tree treePtr as string if it exists, otherwise or if treePtr is nullptr it returns an empty string.

If useNumericalTagValueSorting is true and we have a non empty numerical number string then pad the first value with spaces to up to eight digits including sign which then often can better be sorted in table fields. Padding is performed only on the first value and only for VRs DS, IS, SL, SS, UL, US.

◆ getTopLevelSOPInstanceUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::getTopLevelSOPInstanceUID ( DCMTree::Const_TreePtr  dcmTree,
std::string &  sopInstanceUID 
)

Get the original SOPInstanceUID from top level of dcmTree, returns the value in sopInstanceUID and return true if the value looks valid; for this purpose prefer FMEPrivateSourceSOPInstanceUIDOfDecomposedFrame since it stores the original one and not a possibly recreated one.

If no SOPInstanceUID could be found or determined or if it does not look valid then false is returned and sopInstanceUID is undefined.

◆ getTransferSyntaxUIDAsString()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::getTransferSyntaxUIDAsString ( DCMTree::Const_TreePtr  treePtr,
bool  searchOnlyOnTopLevel = false 
)

Deep search and return the value of the DICOM tag TransferSyntaxUID as string.

On error or if not available an empty string is returned. For example: "1.2.840.10008.1.2.4.90" means lossless JPEG2000 and "1.2.840.10008.1.2.4.91" means lossy JPEG2000. If searchOnlyOnTopLevel is true then the TransferSyntaxUID is only searched on root of DCMTree, otherwise the tree is searched recursively.

◆ getTripleTag()

MLDICOMTags_EXPORT size_t ml::DICOMTagTools::getTripleTag ( DCMTree::Const_TreePtr  treePtr,
DCMTree::RawTagId  tagId,
double &  ippX,
double &  ippY,
double &  ippZ,
double  initX,
double  initY,
double  initZ 
)

Returns the given DICOM tag as three double values; all values which can not be retrieved are returned as values given by the corresponding init* values.

The number of valid coordinates is returned, or 0 if no value is found or if the tag itself is not found or if treePtr is nullptr.

◆ getVector2FromTag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::getVector2FromTag ( DCMTree::Const_TagPtr  tagPtr,
Vector2 returnVec 
)

Converts two values of tagPtr to two Vector2 values in returnVec, respectively.

Parameters
tagPtrThe tag whose values are to be converted.
returnVecThe Vector2 whose values are filled with values from the tag value. Unchanged if anything in conversion failed.
Returns
true in the case of a complete conversion success, false in the case that tagPtr was nullptr or the tag value did not have exactly 2 double-convertible values, or any DCMTree::Exception occurred (all exceptions are caught).

◆ getVector3FromTag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::getVector3FromTag ( DCMTree::Const_TagPtr  tagPtr,
Vector3 returnVec 
)

Converts three values of tagPtr to three Vector3 values in returnVec, respectively.

Parameters
tagPtrThe tag whose values are to be converted.
returnVecThe Vector3 whose values are filled with values from the tag value. Unchanged if anything in conversion failed.
Returns
true in the case of a complete conversion success, false in the case that tagPtr was nullptr or the tag value did not have exactly 3 double-convertible values, or any DCMTree::Exception occurred (all exceptions are caught).

◆ getVector6FromTag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::getVector6FromTag ( DCMTree::Const_TagPtr  tagPtr,
Vector6 returnVec 
)

Converts six values of tagPtr to six Vector6 values in returnVec, respectively.

Parameters
tagPtrThe tag whose values are to be converted.
returnVecThe Vector6 whose values are filled with values from the tag value. Unchanged if anything in conversion failed.
Returns
true in the case of a complete conversion success, false in the case that tagPtr was nullptr or the tag value did not have exactly 6 double-convertible values, or any DCMTree::Exception occurred (all exceptions are caught).

◆ hasAtMostOneFrameInSMFGrid() [1/2]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasAtMostOneFrameInSMFGrid ( const DCMTree::Const_StructuredMFPtr smfTree)

Returns true if the passed constant SMFTree has only one grid entry, if smfTree is nullptr or smfTree->tagTree is nullptr.

Otherwise false is returned.

◆ hasAtMostOneFrameInSMFGrid() [2/2]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasAtMostOneFrameInSMFGrid ( const DCMTree::StructuredMFPtr smfTree)

Returns true if the passed SMFTree has only one grid entry, if smfTree is nullptr or smfTree->tagTree is nullptr.

Otherwise false is returned.

◆ hasMFPixelDataTag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasMFPixelDataTag ( DCMTree::Const_TreePtr  treePtr,
DCMTree::Const_TagPtr tagPtr 
)

Returns true if the tree has a multi-frame pixel data tag containing many frames or false otherwise.

In case of true tagPtr is set to the tag which then can be cast to a MLPixelTag, otherwise the tag is reset and must not be cast.

◆ hasMrsASCIITag()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasMrsASCIITag ( DCMTree::Const_TreePtr  treePtr)

Returns true if the spectroscopy ASCII tags (0x0029, 0x1120) or (0x0029, 0x1220) are available in treePtr, otherwise false is returned.

◆ hasMultiFrameModule()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasMultiFrameModule ( DCMTree::Const_TreePtr  dcmTree)

Returns true if dcmTree contains has Number of Frames (0028,0008) and Frame Increment Pointer (0028,0009) tags, otherwise false.

Note: Even if not enhanced multi-frame, but with multiple frames, some IODs do not necessarily have a multi-frame module. For example MR Resonance Image IOD does not have Multiframe module.

◆ hasNegativeSliceSpacing()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasNegativeSliceSpacing ( DCMTree::Const_TreePtr  treePtr)

Returns true if the tree has a SpacingBetweenSlices tag with a negative value.

◆ hasNMSOPClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasNMSOPClassUID ( DCMTree::Const_TreePtr  dcmTree)

Returns true if dcmTree is valid and has the SOPClassUID tag with the value "1.2.840.10008.5.1.4.1.1.20" or "1.2.840.10008.5.1.4.1.1.5" which stands for the NM modality, otherwise false is returned.

◆ hasParametricMapSOPClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasParametricMapSOPClassUID ( DCMTree::Const_TreePtr  dcmTree)

Returns true if dcmTree is valid and has a Parametric Map SOPClassUID (which does not have a specific Modality value).

◆ hasRetiredPETCurveStorageSOPClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasRetiredPETCurveStorageSOPClassUID ( DCMTree::Const_TreePtr  dcmTree)

Returns true if dcmTree is of the retired Positron Emission Tomography Curve Storage type with SOPClassUID 1.2.840.10008.5.1.4.1.1.128.

This is especially useful to know, because it describes NumberOfSlices as "The maximum number of Slices that may exist in this Series" which opens a back door to use less frames than specified in NumberOfSlices tag which actually happens in many PT modality files.

◆ hasSCSOPClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasSCSOPClassUID ( DCMTree::Const_TreePtr  dcmTree)

Returns true if dcmTree is valid and has a SOPClassUID tag value matching a secondary capture SOPClassUID (which does not have a specific Modality value).

◆ hasSharedOrPerFrameFunctionalGroupSequences()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasSharedOrPerFrameFunctionalGroupSequences ( DCMTree::Const_TreePtr  dcmTree)

Returns true if the Shared- or the PerFrameFunctionalGroupSequences are on root level, otherwise false.

◆ hasSOPClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasSOPClassUID ( DCMTree::Const_TreePtr  dcmTree,
const std::string &  sopClassUID,
bool  doDeepSearch = false 
)

Returns true if dcmTree is valid and has the SOPClassUID tag with the given sopClassUID value.

If doDeepSearch is true then the entire tree is scanned for the first appearance of the tag, otherwise only top-level SOPClassUIDs are considered.

◆ hasSOPClassUIDOfModality()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasSOPClassUIDOfModality ( DCMTree::Const_TreePtr  dcmTree,
const std::string &  modality 
)

EXPERIMENTAL FUNCTION: Returns true if dcmTree is valid and has the SOPClassUID tag which corresponds to the given modality.

If the modality is still not supported then false is returned. Currently supported modalities (including subclasses, retired, and enhanced versions): AU, CR, CT, DX, ECG, EPS, FID, HD, IO, MG, MR, NM, OP, PR, PT, REG, RF, RTIMAGE, RTDOSE, RTSTRUCT, RTPLAN, RTRECORD, SEG, SM, SMR, SR, US, XA. See http://medical.nema.org/medical/dicom/current/output/pdf/part04.pdf.

◆ hasStandardMRSpectroscopyClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasStandardMRSpectroscopyClassUID ( DCMTree::Const_TreePtr  dcmTree)

Returns true if dcmTree is valid and has the SOPClassUID tag with the value "1.2.840.10008.5.1.4.1.1.4.2" which stands for the standard DICOM MR Spectroscopy modality, otherwise false is returned.

Note that this SOP class ist currently handled as some special case when it is imported in the DirectDicomImport.

◆ hasTrueModality()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasTrueModality ( DCMTree::Const_TreePtr  treePtr,
const std::string &  modality 
)

Returns true if the value of the modality tag is of the given modality, the tree is not a secondary capture, and a SOPClassUIDTag exists.

◆ hasValidTagIdRange() [1/2]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasValidTagIdRange ( MLint  val)

Returns true if the MLint argument val has a valid uint32 range, otherwise false is returned.

◆ hasValidTagIdRange() [2/2]

MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasValidTagIdRange ( size_t  val)

Returns true if the size_t argument val has a valid uint32 range, otherwise false is returned.

◆ initNULLSequenceItemsToEmptyTrees()

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.

◆ insertOneSequenceEntry()

MLDICOMTags_EXPORT void ml::DICOMTagTools::insertOneSequenceEntry ( DCMTree::TagPtr  tag,
MLint  posIdx,
std::string &  errStr 
)

Inserts one entry in the sequence in tag at the position given in modificationValue; any error will be appended as textual description to errStr which is left unchanged in case of success.

◆ isBitImageDICOM()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isBitImageDICOM ( DCMTree::Const_TreePtr  treePtr)

Returns true if the DICOM pixel size seems to be single bit (indicated by appropriate values of BitsAllocated, Stored and highBit), otherwise false.

No check on any pixelData is performed.

◆ isCompressed()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isCompressed ( DCMTree::Const_TreePtr  treePtr)

Returns true if the DICOM tree has a transfer syntax UID which indicates compression, otherwise false.

This does not give any information about whether a lossy or losssless one was used.

◆ isEnhancedSOPClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isEnhancedSOPClassUID ( const std::string &  enhancedSOPClassUID)

Returns true if the pass UID is an enhanced Image Storage SOPClassUID, otherwise false.

◆ isJPEG2000Compressed()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isJPEG2000Compressed ( DCMTree::Const_TreePtr  treePtr)

Returns true if any JPEG2000 compression was used to compress the pixel data, otherwise false.

This does not give any information about lossy or lossless compression.

◆ isKnownModality()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isKnownModality ( const std::string &  modality,
bool  includeRetired 
)

Returns true if modality is a known one, otherwise false; if includeRetired is true the also retired modalities are considered as known ones, otherwise not.

◆ isKnownRetiredModality()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isKnownRetiredModality ( const std::string &  modality)

Returns true if modality is a known retired one, otherwise false.

◆ isLossyCompressed()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::isLossyCompressed ( DCMTree::Const_TreePtr  treePtr)

Returns "Yes" if the DICOM tree has a tag indicating a lossy compression, or if the tag indicates no compression then "No" is returned.

If the information cannot be retrieved for any reason (for example tag or tree not available) then an empty string is returned. The return values exactly have capital/lower letters as shown above.

◆ isMultiFrameSOPClassUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isMultiFrameSOPClassUID ( const std::string &  SOPClassUID)

Returns true if the pass UID is a multi-frame SOPClassUID, otherwise false.

Currently checks for

  • Multiframe Single Bit Secondary Capture Image Storage
  • Multiframe Grayscale Byte Secondary Capture Image Storage
  • Multiframe Grayscale Word Secondary Capture Image Storage
  • Multiframe True Color Secondary Capture Image Storage
  • Ultrasound Multiframe Image Storage
  • Retired: VL Multiframe Image Storage
  • Retired: Ultrasound Multiframe Image Storage

◆ isPhilips3D()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isPhilips3D ( DCMTree::Const_TreePtr  treePtr,
MLint spatialExtent = nullptr 
)

◆ isValidCSVrCharacter()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::isValidCSVrCharacter ( const char  ch)

Returns true if ch is a character valid of CS value representations, otherwise false (uppercase letters, 0-9, space, underscore, see http://dicom.nema.org/DICOM/2013/output/chtml/part05/sect_6.2.html).

◆ isValidDICOMDate()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::isValidDICOMDate ( std::string  str,
bool  allowEmptyStrings = true,
bool  allowOldFormat = true 
)

Checks whether str is a valid DICOM date string and returns an empty string on success or a non empty error/help string otherwise.

Parameters
strThe string to be checked for a valid DICOM date.
allowEmptyStringsIf true (the default) then empty strings are considered as valid date strings.
allowOldFormatFor backward compatibility the format YYYY.MM.DD will be supported if this flag is enabled (the default); otherwise only the format YYYYMMDD will be accepted.
Returns
An empty string if the string is considered a valid date string, otherwise an error and/or help description.

◆ isValidDICOMTime()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::isValidDICOMTime ( const std::string &  str,
bool  allowEmptyStrings = true 
)

Checks whether str is a valid DICOM time string of the formats HHMM, HHMMSS, or HHMMSS.F with HH=hours, MM=minutes, SS=seconds, and F=fractional part of a second.

Parameters
strThe string to be checked.
allowEmptyStringsIf true (the default) then empty strings are considered as valid time strings.
Returns
An empty string on success or a non empty error/help string describing the problem otherwise.

◆ looksLikeValidCSVrValue()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::looksLikeValidCSVrValue ( const std::string &  codedString,
std::string *  explanation = nullptr 
)

Returns true if codedString looks like a string valid for a coded segmentation, otherwise false; if explanation is passed as non-nullptr pointer then is set to an empty string if true is returned, otherwise it is set to an explanation which describes the problem why the string does not look valid.

Ignored if nullptr. An empty codedString is considered valid.

◆ looksLikeValidDICOMUID()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::looksLikeValidDICOMUID ( const std::string &  uidStrToCheck)

Returns true if uidStrToCheck looks like a plausible valid DICOM UID, otherwise false.

◆ manipulateType2Or3Tags()

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.

Parameters
dcmTreeis the DICOM tag tree in which tags shall be manipulated.
modificationModedetermines the way how tags in dcmTree shall be manipulated, for detailed description of modes see OtherTagModificationModes.
modStrValThe tag value to be used in modes where values are replaced, set or expanded with another value.

◆ parseUserTagIdStringVal()

MLDICOMTags_EXPORT MLint ml::DICOMTagTools::parseUserTagIdStringVal ( std::string  tagIdStrVal,
bool  replaceXsByZeros = false 
)

Parses the given string tagIdStrVal and returns it as positive unsigned integer value if the parsed value looks like a valid raw tag id.

Then the return value can be cast to a 32 bit unsigned raw tag id. If parsing failed then a negative value is returned. The tag id string must have a format like (ABCD, EFGH) or (0xABCD, 0xEFGH) where ABCD and EFGH are hexadecimal numbers describing 16 bit unsigned integers where ABCD are the high and EFGH are the low bits of the word. If replaceXXByZeros is true then "x" or "X" characters in the digits ABCDEFG or H are replaced by 0 before parsing them, otherwise they will be handled as error. This can be useful to parse ids of the groups (50xx,0000) or (60xx,0000).
Alternatively the name of standard tags can be specified without spaces in upper camel case notation (for example "PatientsName" instead of (0010,0010).)

◆ printTagId()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::printTagId ( DCMTree::TagId  id,
DCMTree::Const_DictPtr  dict,
bool  printValue = false,
DCMTree::Const_TreePtr  dcmTree = DCMTree::Const_TreePtr(),
const std::string &  valueIntro = " with value '",
const std::string &  valueExtro = "'",
size_t  abbreviateAfter = 15u 
)

Convert a tag name with its id and optionally the tag value to a string by
using the DicomTree dictionary.

Parameters
idThe tag id to print.
dictThe non-nullptr pointer to the DICOM dictionary for name look-up, must be non-nullptr.
printValueIf true and dcmTree exists, and a string-convertible value exists, then it is appended with at most abbreviateAfter characters such that the result is something like "Modality(0008,0060) with value 'MR'" and if necessary too long values are shortened to abbreviateAfter chars + "...", otherwise - if false - no value is appended.
dcmTreeUsed to retrieve the tag value from if printValue is true, otherwise ignored.
valueIntroThe string to be printed between tag id/name and tag value if the value is printed.
valueExtroThe string to be printed after the tag value if the value is printed.
abbreviateAfterIf a printed value is longer then everything after this position is removed and "..." is added. Private tag names are still not decoded but may be supported in future versions.

◆ recursiveRemoveTags()

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.

◆ recursiveSequenceTagCleanUp() [1/2]

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.

◆ recursiveSequenceTagCleanUp() [2/2]

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.

If any sequence afterwards is empty, it removes the entire sequence tag.

◆ recursiveTagManipulate()

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.

Tag whose value cannot be set or whose value representation would have to be changed will not be replaced. Tags which exist and which do not have a value will be extended with the value such the value can be set successfully.

Parameters
treePtrThe DCMTree in which the tags are to be searched.
tagIdThe id of the tag to be searched.
removeIf true then the found tags are removed, otherwise (if false) their values are replaced with newVal if possible. The number of failed tag manipulations is counted in *numBadManips if numBadManips is non nullptr.
newValThe string value used to replace tag values if remove is false.
numGoodManipsIgnored if nullptr; otherwise it is incremented by the number of successfully manipulated (removed or modified) tags.
numBadManipsIgnored if nullptr; if it is non nullptr then it will be set to the number of failed tag manipulations, typically if setting of newVal is no possible due to mismatches of value representation which can not be set from string.
recursionLevelCounts the recursion deepness, shall be 0 on normal calls by user.

◆ removeAllTypesPixelDataTags()

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.

Removed tags are

  • DCMTree_[[Double]Float]PixelData,
  • Spectroscopy data tags (0x7fe1, 0x1010) and (0x5600, 0x0020), and
  • REG VectorGridData tag (0x7fe1, 0x1010).
    Returns
    true is returned if any tag was removed, false otherwise.

◆ removeEmptyItemsAtEnd()

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.

Thus all sequences are shortened starting from the end up to the first entry which has a non empty tree.

◆ removeLargeTags()

MLDICOMTags_EXPORT std::vector<DCMTree::RawTagId> ml::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.

Parameters
treePtrThe DICOM tree in which large tags shall be removed, may be nullptr.
tagSizeToRemoveTags with this size or large will be removed.
Returns
The ids of all removed tags.

◆ removeMaskedTags()

MLDICOMTags_EXPORT void ml::DICOMTagTools::removeMaskedTags ( DCMTree::TreePtr  dcmTree,
MLuint32  idVal,
MLuint32  idMask 
)

Remove all tags from the dcmTree whose ids & idMask == idVal.

Parameters
dcmTreeThe tree from which the tags shall be removed.
idValIf the tag id is masked with idMask matches this value then the tag will be removed.
idMaskThe tag id is masked with this value before comparing it to idVal.

◆ removePixelDataTag()

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.

Returns
true is returned if a tag was removed, false otherwise.

◆ removePrivateCreatorTag()

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.

Parameters
dcmTreeThe tree from which the tag shall be removed; if nullptr the call does nothing.
privateCreatorStringThe string name of the private creator to whose group the tag id belongs.

◆ removePrivateMultiFrameTag()

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.

◆ removePrivateSMFTreeTags()

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.

◆ removePrivateTag()

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.

If not found or nullptr dcmTree, the call will be a no-op.

Parameters
dcmTreeThe tree from which the tag shall be removed; if nullptr the call does nothing.
tagIdLowerEightBitsThe lower eight bits of the private tag to be removed; an error occurs if not in range [0,255].
privateCreatorStringThe string name of the private creator to whose group the tag id belongs.

◆ removePrivateTagGroup()

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.

Parameters
dcmTreeTree from which all tags of a private creator shall be removed.
removeAllPrivateTagsIf true then all private tags will be removed, otherwise the string description of privateCreatorString must match exactly the tag value.
privateCreatorStringIf removeAllPrivateCreators is false then this is the string description of the private creator which must match exactly the tag string; otherwise not used.

◆ removeREGDataTag()

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.

  • DeformableRegistrationSequence (0064,0002)
  • - DeformableRegistrationGridSequence (0064,0005)
  • - - Sequence Items...
  • - - - VectorGridData 0064,0009
    Returns
    true is returned if a tag was removed, false otherwise.

◆ removeSpectDataTag()

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).

Returns
true is returned if a tag was removed, false otherwise.

◆ removeTag()

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).

Parameters
dcmTreeThe DICOM tree from which the tag shall be removed.
tagIdThe id of the tag to be removed.

◆ removeTags()

MLDICOMTags_EXPORT void ml::DICOMTagTools::removeTags ( DCMTree::TreePtr  resultTree,
const DcmTagIdToRemove  srcTagsToRemove[] 
)

Remove the top level tags given by srcTagsToRemove from tree.

Parameters
resultTreeThe tree from which the tags shall be removed.
srcTagsToRemoveThe list of tags to be removed; it must be terminated with a {0, ""} entry.

◆ removeTopLevelFrameOfReferenceTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelFrameOfReferenceTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Frame Of Reference Module tags from dcmTree if they are present.

◆ removeTopLevelGeneralAnatomyOptionalMacro()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelGeneralAnatomyOptionalMacro ( DCMTree::TreePtr  dcmTree)

Removes the DICOM General Anatomy Optional Macro tags from dcmTree if they are present.

◆ removeTopLevelGeneralImageTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelGeneralImageTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM General Image Module tags from dcmTree if they are present.

◆ removeTopLevelGraphicAnnotationModuleTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelGraphicAnnotationModuleTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Graphic Annotation Module tags from dcmTree if they are present.

◆ removeTopLevelImagePixelMacroTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelImagePixelMacroTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Image Pixel Macro tags from dcmTree if they are present.

◆ removeTopLevelImagePlaneTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelImagePlaneTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Image Plane Module tags from dcmTree if they are present.

◆ removeTopLevelModalityLUTTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelModalityLUTTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Modality LUT Module tags from dcmTree if they are present.

◆ removeTopLevelMultiFrameModuleTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelMultiFrameModuleTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Multi-frame Module tags from dcmTree if they are present.

◆ removeTopLevelOverlayPlaneTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelOverlayPlaneTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Overlay Plane Module tags from dcmTree if they are present.

◆ removeTopLevelPixelPaddingValueTag()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelPixelPaddingValueTag ( DCMTree::TreePtr  dcmTree)

Remove tags from tree which could disturb the correct interpretation of the written DICOM file.

◆ removeTopLevelRetiredCurveIETags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelRetiredCurveIETags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Curve IE tags, (see http://medical.nema.org/dicom/2004/04_03PU3.PDF, retired) from dcmTree if they are present.

◆ removeTopLevelSupplementalPaletteColorLookupTableModuleTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelSupplementalPaletteColorLookupTableModuleTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM Supplemental Palette Color Lookup Table Module tags from dcmTree if they are present.

◆ removeTopLevelVOILutTags()

MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelVOILutTags ( DCMTree::TreePtr  dcmTree)

Removes the DICOM VOI LUT Module tags from dcmTree if they are present.

◆ removeType3Tags()

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.

Parameters
dcmTreeis the DICOM tag tree in which tags shall be manipulated.

◆ replaceTagIdPlaceholder()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::replaceTagIdPlaceholder ( DCMTree::Const_TreePtr  dcmTree,
std::string  strToReplace,
bool  correctTagValues = false,
const std::string &  defaultTagContent = "" 
)

Replaces all substrings of the format "$(TAGID(ABCD,EFGH))" by the values of the first occurrence values of the corresponding DICOM tag ids in dcmTree; syntactically correct placeholders will be replaced by found tags values or defaultTagContent, syntactically incorrect placeholders will not be replaced.

Parameters
dcmTreeThe DICOM tree from which the tag values shall be retrieved if possible.
strToReplaceThe string in which all $(TAGID(ABCD,EFGH)) appearances are to be replaced.
correctTagValuesIgnored if false; if true then the following characters in tag values are replaced as follows: '/', '\', ' ' -> '-' '&', '$', '"' -> '.'
defaultTagContentIf the value of a tag value cannot be determined then this value will be used instead.

◆ resizeToNumberOfSequenceEntries()

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.

◆ searchPrivateCreator()

MLDICOMTags_EXPORT unsigned int ml::DICOMTagTools::searchPrivateCreator ( DCMTree::TreePtr  dcmTree,
const std::string &  privateCreatorString = "",
MLuint16  desiredPrivateGroupId = 0x09,
MLuint8  desiredPrivateElementGroupId = 0x10 
)

Determine the first odd group id with private element group id.

  • which is still not used by a private creator, or
  • if the privateCreatorString is not empty - which matches the given private creator. If the desired entry is already used (by another private creator), first the group id is incremented until a free group id is found. If even that that does not help the private element group id is also incremented.
    Parameters
    dcmTreeThe tree in which the private group id and element id shall be searched.
    privateCreatorStringIf the desired private group id exists and its private creator is identical to privateCreatorString then this id will be returned (e.g. to modify an existing private group or tag), otherwise another one will be searched.
    desiredPrivateGroupIdThe preferred group id; if not available then another will be searched; shall be odd and from [0x0009, 0xFFFF].
    desiredPrivateElementGroupIdThe preferred element group id for the private tags; if not available
    then another will be searched, shall be from [0x10, 0xFF].
    Returns
    A non zero DICOM tag id with 16 upper bits describing the odd group id for the private creator and lower byte as private element group id. If no entry could be found then 0 is returned.

◆ setOrAddCreatorAndTag()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::setOrAddCreatorAndTag ( DCMTree::TreePtr  dcmTree,
const std::string &  privateCreatorString,
MLuint16  privateGroupId,
MLuint8  privateElementGroupId,
MLuint8  privateTagIdLowerByte,
const std::string &  privateTagValue,
DCMTree::Vr  privateVR,
bool  splitValue 
)

Add and/or replace the private creator and add/replace the private tags in dcmTree.

Parameters
dcmTreeThe tree in which the private creator and private tags shall be inserted.
privateCreatorStringThe name of the private creator to be inserted if it still not exists) at id given by privateGroupId and privateElementGroupId.
privateGroupIdThe group id of the private creator and of the tag to be inserted, must be odd and from [0x0009, 0xFFFF].
privateElementGroupIdThe element group id to be defined by the private creator and to be used for all inserted private tags, must be from [0x10, 0xFF].
privateTagIdLowerByteThe lower byte to be used for the added/replaced private tag, must be from [0x00, 0xFF].
privateTagValueThe value of the private tag to replace/add.
privateVRThe value representation to be used by the private tag.
splitValueIf true then privateTagValue is split at backslashes into different values, otherwise it is set as one value.
Returns
An empty string on success or a non empty string describing the error. Notes: This function does not apply checks for overwritten tags or whether the resulting tags in the tree are still consistent. For example it also allows the change of an existing private creator string although this probably not useful; at least it should be used with extreme care since dependent tags are not adapted.

◆ setSplitTagStringValue()

MLDICOMTags_EXPORT void ml::DICOMTagTools::setSplitTagStringValue ( DCMTree::TagPtr  tag,
const std::string &  str 
)

If str contains "\\" then it is split at those positions such that multiple values are created.

These value all are used to set the tag values. All other values are removed. Otherwise the value is set as it is.

◆ setTagStringValue() [1/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
const ImageVector vec,
bool  doMultValueAdd 
)

Set the value of tag as string whose six vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string.

All other values are removed. If necessary the value(s) is/are added. If tag is nullptr the call is ignored. maxSize is ignored, it is available only for symmetry with other setStringValue routines. If tag does not have a value representation which can decode this type of coded string a DCMTree::Exception is thrown.

◆ setTagStringValue() [2/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
const Matrix4 mat,
bool  doMultValueAdd,
signed char  maxSize = -1 
)

Set the value of tag as string whose sixteen matrix components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string.

All other values are removed. If necessary the value(s) is/are added. If tag is nullptr the call is ignored. If maxSize < 0 then double value(s) are printed with ReleaseToolsString::toDblStr(val), otherwise the length of each double is tried to be limited to maxSize if it fits sensibly; note that this can lead to precision loss. If tag does not have a value representation which can decode this type of coded string a DCMTree::Exception is thrown.

Referenced by addStringTagToTree().

◆ setTagStringValue() [3/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
const std::string &  str 
)

Set the string value str at value position 0, all other values are removed.

If necessary the value is added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.

◆ setTagStringValue() [4/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
const std::string &  str,
bool  ,
signed char   
)

Set the string value str at value position 0, all other values are removed.

If necessary the value is added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.
The last two arguments are only available for compatibility to other setStringValue functions; its value is ignored. Same as setTagStringValue(DCMTree::TagPtr tag, const std::string &str).

◆ setTagStringValue() [5/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
const Vector2 vec,
bool  doMultValueAdd,
signed char  maxSize = -1 
)

Set the value of tag as string whose two vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string.

All other values are removed. If necessary the value(s) is/are added. If tag is nullptr the call is ignored. If maxSize < 0 then double value(s) are printed with ReleaseToolsString::toDblStr(val), otherwise the length of each double is tried to be limited to maxSize if it fits sensibly; note that this can lead to precision loss. If tag does not have a value representation which can decode this type of coded string a DCMTree::Exception is thrown.

◆ setTagStringValue() [6/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
const Vector3 vec,
bool  doMultValueAdd,
signed char  maxSize = -1 
)

Set the value of tag as string whose three vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string.

All other values are removed. If necessary the value(s) is/are added. If tag is nullptr the call is ignored. If maxSize < 0 then double value(s) are printed with ReleaseToolsString::toDblStr(val), otherwise the length of each double is tried to be limited to maxSize if it fits sensibly; note that this can lead to precision loss. If tag does not have a value representation which can decode this type of coded string a DCMTree::Exception is thrown.

◆ setTagStringValue() [7/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
const Vector6 vec,
bool  doMultValueAdd,
signed char  maxSize = -1 
)

Set the value of tag as string whose six vector components are separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string.

All other values are removed. If necessary the value(s) is/are added. If tag is nullptr the call is ignored. If maxSize < 0 then double value(s) are printed with ReleaseToolsString::toDblStr(val), otherwise the length of each double is tried to be limited to maxSize if it fits sensibly; note that this can lead to precision loss. If tag does not have a value representation which can decode this type of coded string a DCMTree::Exception is thrown.

◆ setTagStringValue() [8/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
double  v0,
double  v1,
bool  doMultValueAdd,
signed char  maxSize = -1 
)

Set the value of tag as string whose components are v0 and v1 as strings separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string.

All other values are removed. If necessary the value(s) is/are added. If tag is nullptr the call is ignored. If maxSize < 0 then double value(s) are printed with ReleaseToolsString::toDblStr(val), otherwise the length of each double is tried to be limited to maxSize if it fits sensibly; note that this can lead to precision loss. If tag does not have a value representation which can decode this type of coded string a DCMTree::Exception is thrown.

◆ setTagStringValue() [9/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
double  val 
)

Sets value val at value position 0, all other values are removed.

If necessary the value is added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.

◆ setTagStringValue() [10/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
float  val 
)

Sets value val at value position 0, all other values are removed.

If necessary the value is added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.

◆ setTagStringValue() [11/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
int  val 
)

Sets value val at value position 0, all other values are removed.

If necessary the value is added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.

◆ setTagStringValue() [12/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
MLint  v0,
MLint  v1,
MLint  v2,
bool  doMultValueAdd 
)

Set the value of tag as string whose components are v0, v1, and v2 as strings separated by backslashes if doMultValueAdd is false; otherwise each one is added as its own value string.

All other values are removed. If necessary the value(s) is/are added. If tag is nullptr the call is ignored. If tag does not have a value representation which can decode this type of coded string a DCMTree::Exception is thrown.

◆ setTagStringValue() [13/13]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagStringValue ( DCMTree::TagPtr  tag,
MLuint16  val 
)

Sets value val at value position 0, all other values are removed.

If necessary the value is added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.

◆ setTagValue() [1/3]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagValue ( DCMTree::TagPtr  tag,
double  v0,
double  v1,
double  v2 
)

Set the three double values v0, v1, and v2 at value positions 0, 1, and 2, respectively, all other values are removed.

If necessary the values are added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.

◆ setTagValue() [2/3]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagValue ( DCMTree::TagPtr  tag,
unsigned int  v0,
unsigned int  v1,
unsigned int  v2 
)

Set the three unsigned int values v0, v1, and v2 at value positions 0, 1, and 2, respectively, all other values are removed.

If necessary the values are added. The call is ignored if tag is nullptr. Throws a DCMTree::Exception if tag vr does not match.

◆ setTagValue() [3/3]

MLDICOMTags_EXPORT void ml::DICOMTagTools::setTagValue ( DCMTree::TreePtr  dcmTree,
std::string *  errStr,
DCMTree::TagId  tagId,
const std::string &  tagStrValue,
const ValueModifyModes  modMode,
bool  splitValue = false 
)

Sets the value of the tag with id tagId in dcmTree with the new value tagStrValue.

The call is ignored if either the tag with id tagId does not exist or dcmTree is nullptr.

Parameters
dcmTreeThe DICOM tree in which the tag value shall be set.
errStrIf nullptr then potential errors will be posted as ML_PRINT_ERROR, otherwise the error description will be appended to *errStr.
tagIdThe DICOM tag id of the tag to manipulate.
tagStrValueThe string value used to manipulate the tag with id tagId.
modModeThe way how the tag value shall be modified.
splitValueIf true then the value is decomposed at backslashes, otherwise one value is set.

Referenced by addTagToTree().

◆ setUpSingleFrameImageStorageSOPClassUIDDerivedFromEnhancedOne()

MLDICOMTags_EXPORT void ml::DICOMTagTools::setUpSingleFrameImageStorageSOPClassUIDDerivedFromEnhancedOne ( DCMTree::Const_TreePtr  dcmMFTree,
DCMTree::TreePtr  singleFrame 
)

Takes the SOPClassUID from dcmMFTree, and writes the corresponding single frame one into singlFrame.

If no SOPClassUID or an invalid one is found in dcmMFTree then the SOPClassUID tag in single frame is deleted. If a non enhanced Image Storage SOPClassUID is found in dcmMFTree, then it is written unchanged into singleFrame.

◆ toDblStrLimited()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::toDblStrLimited ( double  val,
signed char  maxSize 
)

Printing double values can lead to the annoying problem that the fully printed double value does not fit in the allowed size of a value representation, for example a printed double value can easily lead to a value 0.999690871460849, however, the value representation DS allows only 16 bytes per value (stupid, but it is like this, who invented that in the DICOM standard???) This is a tool function which tries to limit a printed double value to a given length by reducing the number of decimal digits passed to toDblStr, which, however has its limitations.

Too small number of resulting spaces in the worst case will lead to a normal print without decimal places to avoid complete information loss or destruction (in cases such as toDblStrLimited(-10, 1) or toDblStrLimited(300,2). Therefore maxSize should always have at least space for the sign and the integer part of the number (for example 4 on -300.6 which results to "-301"). If the full precision can be maintained by removing a "0" before a "." then it will be removed, for example toDblStrLimited(0.123, 4) leads to ".123" or toDblStrLimited(-0.123, 4) leads to "-.12".

Parameters
valThe value to be converted to a string.
maxSizeThe maximum string length to be returned; if <= 0 then ReleaseToolsString::toDblStr(val) is returned.
Returns
The string-converted double value.

◆ translateToSingleFrameSOPClassUID()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::translateToSingleFrameSOPClassUID ( const std::string &  enhancedSOPClassUID)

Returns a single frame SOPClassUID corresponding to enhancedSOPClassUID.

If enhancedSOPClassUID is not a valid UID or is not an enhanced Image Storage one then an empty string is returned.

◆ updateMinMaxFromDICOMTags()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::updateMinMaxFromDICOMTags ( DCMTree::Const_TreePtr  treePtr,
MLdouble minPixVal,
MLdouble maxPixVal 
)

Checks for min/max DICOM tags on top level and - if both are found - updates the passed min/max values.

Parameters
treePtrThe tree to be checked for min/max pixel tags.
minPixValThe minimum value to be updated if a smaller pixel tag is found.
maxPixValThe maximum value to be updated if a larger pixel tag is found.
Returns
true if both min/max pixel tags were found, false if any of both was not found. minPixVal and maxPixVal are left unchanged if false is returned.

◆ usesNegativeNMStacking()

MLDICOMTags_EXPORT bool ml::DICOMTagTools::usesNegativeNMStacking ( DCMTree::Const_TreePtr  treePtr)

Returns true if the tree has tags which indicate that it is NM data and the pixel data is stacked in inverse order and has an MFPixelDataTag.

◆ validatePrivateCreators()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::validatePrivateCreators ( DCMTree::Const_TreePtr  dcmTree,
std::vector< unsigned int > &  privateCreators,
std::vector< unsigned int > *  badPrivateCreators = nullptr 
)

Applies some consistency checks on private creators and returns an empty string if no issues are found, otherwise a text description of the problem(s).

The passed ids in the array are converted such that the lower eight bits are shifted eight bits up, bad ones are removed from the array.

Parameters
dcmTreeThe tree in which the private creator is stored.
privateCreatorsThe private creator ids to be checked and converted, those ones found in the tree and valid are left in array, bad ones are removed and possibly moved into badPrivateCreators, good ones not found in tree are removed but not moved into badPrivateCreators.
badPrivateCreatorsThe private creator ids which were checked and considered bad if passed non-null, otherwise ignored.

◆ validatePrivateTagIds()

MLDICOMTags_EXPORT std::string ml::DICOMTagTools::validatePrivateTagIds ( DCMTree::Const_TreePtr  dcmTree,
std::vector< unsigned int >  privateIds,
std::vector< unsigned int >  privateCreators 
)

Applies some consistency checks on private creators and private tags and returns an empty string if no issues are found, otherwise a text description of the problem(s).

For a correct check all available private creators should be available in privateCreators.

Parameters
dcmTreeThe tree in which the private tags are stored.
privateIdsThe private raw ids to be checked.
privateCreatorsThe private creator ids to which should belong the tags from privateIds.

Variable Documentation

◆ OrientationName

const char* const ml::DICOMTagTools::OrientationName[NumberOfOrientationTypes]
extern

String representations analog to the OrientationType, however, NumberOfOrientationTypes is out of range.

◆ OtherTagModificationModesStrings

MLDICOMTags_EXPORT const char* const ml::DICOMTagTools::OtherTagModificationModesStrings[NumOtherTagModificationModes]
extern

String versions for OtherTagModificationModes.

◆ ValueModifyModesStrings

MLDICOMTags_EXPORT const char* const ml::DICOMTagTools::ValueModifyModesStrings[NumValueModifyModes]
extern

String versions for ModificationModes.