MeVisLab Toolbox 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< ZTUIndex > | 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. 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 string , 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::TreePtrVector * | 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). 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::MFPixelTag * | 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. 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 std::string | checkForMultipleSeriesInstanceUIDs (DCMTree::Const_TreePtr dcmTree) |
Returns an empty string if the input DCMTree has only one series in its SMF hierarchy and an error string otherwise. More... | |
MLDICOMTags_EXPORT std::string | checkForExpectedModality (DCMTree::Const_TreePtr inTree, const std::string &modalityValue) |
Returns an empty string if the input DCMTree has the modality modalityValue or an error string otherwise. More... | |
MLDICOMTags_EXPORT std::string | checkFor8Or16BitIntType (MLDataType dType, const std::string &errMsgSuffix=" at input 0 for Enhanced MR Image") |
Returns an empty string if dType is of an 8 or 16 bit integer type, otherwise a descriptive error message + msgSuffix. More... | |
MLDICOMTags_EXPORT std::string | checkForMinMaxRangeInDataType (const double minVal, const double maxVal, MLDataType dType, const std::string &errMsgSuffix=" at input 0") |
Returns an empty string if minVal and maxVal are inside range of given data type, otherwise a descriptive error message + msgSuffix. More... | |
MLDICOMTags_EXPORT std::string | checkFor32BitRangedInputImage (const ImageVector &inImgExt, MLDataType dType) |
Returns an empty string if inImgExt is not zero and does not exceed 32 bit range even when allocating it with large dType; otherwise a descriptive error message. 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 std::pair< bool, bool > | isClassicOrEnhancedMultiFrameSOPClass (const std::string &sopClassUID) |
Checks whether sopClassUID is a multi-frame or enhanced one and returns a pair with pair.first = isMulti-frame and the pair.second isEnhanced. 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 SpectComplex * | 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). 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 ®ExLineFilter="", 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::RawTagId > | removeLargeTags (DCMTree::TreePtr treePtr, size_t tagSizeToRemove=0x00040000) |
Removes all top-level tags from the tree which are larger than the given tag size and return a vector 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::TreePtr > | 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. More... | |
MLDICOMTags_EXPORT std::vector< DCMTree::TreePtr > | 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. More... | |
MLDICOMTags_EXPORT std::vector< DCMTree::TreePtr > | 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. 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... | |
A namespace collecting tools related to DICOM tags and tree tools.
A namespace collecting tools related to DICOM tags and dictionaries.
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.
typedef struct ml::DICOMTagTools::DcmTagIdToRemove ml::DICOMTagTools::TagIdDesc |
< Small structure describing a tag to be removed from a DCMTree tree with the helper function - see removeTags.
Do not use, only for backward compatibility.
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.
anonymous enum |
Number of available ValueModifyModes.
Enumerator | |
---|---|
NumValueModifyModes |
Definition at line 333 of file mlDICOMSetAddTagTools.h.
anonymous enum |
Defines the number of available modification modes.
Enumerator | |
---|---|
NumOtherTagModificationModes |
Definition at line 223 of file mlDICOMTreeModificationTools.h.
Enumerator for typical human readable anatomic orientations.
Definition at line 228 of file mlDICOMGetTools.h.
Available modes for tag modifications.
Definition at line 207 of file mlDICOMTreeModificationTools.h.
Ways how to modify a tag with with _modificationStringValue.
Definition at line 325 of file mlDICOMSetAddTagTools.h.
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().
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().
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.
dcmTree | The DICOM tree to which the tag shall be added, must be non nullptr. |
errStr | If nullptr then potential errors will be posted as ML_PRINT_ERROR, otherwise the error description will be appended to *errStr. |
tagId | The DICOM tag id of the tag to manipulate. |
tagStrValue | The string value used to manipulate the tag with id tagId. |
setValue | If true then the value is set from the given string, otherwise no value is set. |
numVals | The number of values to add, default is 1. |
vr | The value representation to use, or - if nullptr - LO for private tags and normal dictionary lookup for standard tags. |
splitValue | If true then the value is decomposed at backslashes, otherwise one value is added. |
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().
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.
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.
dataPtr | Available content is appended as hex dump to resultValStr, may be nullptr. |
numDataBytes | The actual number of bytes from dataPtr to be dumped, dataPtr must contain then if not nullptr. |
resultValStr | The string to which the dump is appended. |
printSpaces | If true then hexadecimal values are separated with spaces, otherwise not. |
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.
MLDICOMTags_EXPORT std::string ml::DICOMTagTools::checkFor32BitRangedInputImage | ( | const ImageVector & | inImgExt, |
MLDataType | dType | ||
) |
Returns an empty string if inImgExt is not zero and does not exceed 32 bit range even when allocating it with large dType; otherwise a descriptive error message.
MLDICOMTags_EXPORT std::string ml::DICOMTagTools::checkFor8Or16BitIntType | ( | MLDataType | dType, |
const std::string & | errMsgSuffix = " at input 0 for Enhanced MR Image" |
||
) |
Returns an empty string if dType is of an 8 or 16 bit integer type, otherwise a descriptive error message + msgSuffix.
MLDICOMTags_EXPORT std::string ml::DICOMTagTools::checkForExpectedModality | ( | DCMTree::Const_TreePtr | inTree, |
const std::string & | modalityValue | ||
) |
Returns an empty string if the input DCMTree has the modality modalityValue or an error string otherwise.
MLDICOMTags_EXPORT std::string ml::DICOMTagTools::checkForMinMaxRangeInDataType | ( | const double | minVal, |
const double | maxVal, | ||
MLDataType | dType, | ||
const std::string & | errMsgSuffix = " at input 0" |
||
) |
Returns an empty string if minVal and maxVal are inside range of given data type, otherwise a descriptive error message + msgSuffix.
MLDICOMTags_EXPORT std::string ml::DICOMTagTools::checkForMultipleSeriesInstanceUIDs | ( | DCMTree::Const_TreePtr | dcmTree | ) |
Returns an empty string if the input DCMTree has only one series in its SMF hierarchy and an error string otherwise.
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.
id | Id of the tag whose value shall be searched in valueList. |
dcmTree | The non-nullptr tree in which the tag with id shall be searched and compared. |
valueList | The non-nullptr list of strings the tag value shall be compared with. |
numValues | The exact number of entries in valueList. |
requiresExistingTag | If 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. |
requiresTextStringValue | If 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. |
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.
dcmTree | The DICOM tree to be duplicated. |
errStr | If non-null a potential error description is appended, otherwise occurring errors will be posted with ML_PRINT_ERROR. |
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.
inputTree1 | The tree whose differences to inputTree2 shall be calculated. |
inputTree2 | The tree whose differences to inputTree1 shall be calculated. |
idsExcludedFromChanged | These ids are not added to changedTags even if they differ. |
unchangedTags | A tree containing all tags which do not differ between inputTree1 and inputTree2. |
addedTags | A tree containing all tags which do not exist in inputTree1 but in inputTree2. |
removedTags | A tree containing all tags which exist in inputTree1 but not in inputTree2. |
changedTags | A tree containing all tags which differ between inputTree1 and inputTree2. |
alsoExcludeFromAdded | If true then added tags with ids found in idsExcludedFromChanged are also ignored. |
alsoExcludeFromRemoved | If true then removed tags with ids found in idsExcludedFromChanged are also ignored. |
compareRecursively | If true then the trees are compared recursively tag by tag, if false then on top level the sequence tags are compared as single tags. |
cleanupEmptyTrailingSequenceTreesInAddedTags | If 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. |
cleanupEmptyTrailingSequenceTreesInRemovedTags | If 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. |
compareMultiplicity | If enabled then the multiplicity of existing tags is compared, otherwise not. |
cleanupEmptyTrailingSequenceTreesInChangedTags | If 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. |
compareMultiFrameData | Since 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). Returned are the trees unchangedTags, addedTags, removedTags, and changedTags in their referenced argument pointers. |
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.
MLDICOMTags_EXPORT std::string ml::DICOMTagTools::createInstanceUID | ( | bool | useFMEUIDPrefix = false | ) |
Generate new IDs for DICOM frames, for example new SOPinstanceUIDs.
useFMEUIDPrefix | if true then the FME prefix is used, otherwise the MMS prefix. |
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.
treePtr | The DCMTree in which the tag is searched. |
tagId | The tag to be searched for as a an id. |
result | The pointer to the found tag or a nullptr pointer otherwise. |
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.
treePtr | The DCMTree in which the tag is searched. |
tagIdStr | The tag to be searched for as a name string. |
result | The pointer to the found tag or a nullptr pointer otherwise. |
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.
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.
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.
treePtr | The DCMTree in which the tags are to be searched. |
tagId | The id of the tag to be searched. |
numTagsToFind | The maximum number of tags to be searched/added. |
tagVector | A vector to which at most numTags pointers to DICOM tags are appended. |
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.
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.
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
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.
treePtr | The DCMTree to be dumped into the returned string. |
prefix | The string added before each line of the dumped tree. |
maxNum | Is the maximum size of the created result string. |
decodePrivateTags | If true then also binary private tag values are decoded and dumped if decoders for them are available, otherwise only basic binary infos are listed. |
numBinDumpEntries | Maximum number of shown elements of binary tags. |
annotate | If true then additional descriptive information is dumped together with the tag listing. |
regExLineFilter | A 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. |
showNumOfTagValues | If true then tag dump also displays the number of values of each tag; otherwise this is not displays. |
hideNULLItems | If 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. |
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.
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.
rawTagId | The 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. |
dcmTree | The DICOM tree in which the sequences are searched. |
tagValuesStringListToExtend | The string at whose end the found values are concatenated (if necessary separated with sep). |
alsoAddTopLevelTags | If true the also tag value(s) found in the root of dcmTree are appended at the end. |
sep | The string separator to be inserted between elements appended to tagValuesStringListToExtend. |
makeUniqueSet | If 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. |
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.
dcmTree | Tree from which all tags of a private creator shall be removed. |
privateCreatorString | If removeAllPrivateCreators is false then this is the string description of the private creator which must match exactly the tag string; otherwise not used. |
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.
tagPtr | The tag whose values are to be converted. |
returnMat | The matrix whose values are filled with values from the tag value. Unchanged if anything in conversion failed. |
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.
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.
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.
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.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::getDoubleFromTag | ( | DCMTree::Const_TagPtr | tagPtr, |
double & | returnDbl | ||
) |
Converts one values of tagPtr to a double values in returnDbl.
tagPtr | The tag whose values are to be converted. |
returnDbl | The double whose value is filled with the value from the tag value. Unchanged if anything in conversion failed. |
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.
tagPtr | The tag whose values are to be converted. |
returnDbls | The 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. |
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.
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.
dcmTree | The DICOM tree from which the values shall be extracted. |
resultOType | Ignored if nullptr, otherwise *resultOType will be set to the OrientationType enumerator of the determined orientation. |
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.
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.
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.
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.
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.
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().
MLDICOMTags_EXPORT unsigned int ml::DICOMTagTools::getNumberOfFrames | ( | DCMTree::Const_TreePtr | dcmTree, |
unsigned int * | fromTagOnly = nullptr |
||
) |
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.
MLDICOMTags_EXPORT DCMTree::PixelData ml::DICOMTagTools::getPixelDataPtrFromTree | ( | DCMTree::Const_TreePtr | treePtr, |
size_t * | valSizeInBytes, | ||
DicomMessageCollector & | dcmMsgCollector | ||
) |
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.
MLDICOMTags_EXPORT DCMTree::Const_TagPtr ml::DICOMTagTools::getPrivateTag | ( | const std::string & | privateCreatorString, |
unsigned short | groupId, | ||
DCMTree::RawTagId | lowerEightBitOfElementId, | ||
DCMTree::Const_TreePtr | dcmTree | ||
) |
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.
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.
tagPtr | The pointer to the tag whose itemIdx'th sequence item shall be returned. |
itemIdx | The index of the sequence item to be returned. |
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).
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.
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.
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();.
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().
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.
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).
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).
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).
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).
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.
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.
MLDICOMTags_EXPORT DCMTree::TagPtr ml::DICOMTagTools::getTagIfItExists | ( | DCMTree::TreePtr | dcmTree, |
DCMTree::TagId | tagId, | ||
std::string * | errStr = nullptr |
||
) |
dcmTree | The DCMTree in which the tag shall be searched; must be non nullptr. |
tagId | The id of the tag to be searched. |
errStr | If nullptr then potential errors will be posted as ML_PRINT_ERROR, otherwise the error description will be appended to *errStr. |
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.
rawTagId | The ID of tag whose value is to be searched in the sequence with tag id sequenceInWhichToSearch. |
sequenceInWhichToSearch | The sequence in which all occurrences of tags with id tagToSearch shall be searched. |
tagValuesStringListToExtend | A string to which all string values of tagToSearch appearances are appended, separated by sep. |
sep | The string to be used as separator between appended values. |
makeUniqueSet | If 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. |
searchAsLower8BitOfPrivateFMETag | If 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. |
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.
inputDcmTree | The DICOM tree in which the tags are searched in the SMF tree frames. |
rawTagIds | The 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. |
appendFrameCount | If true then the counter (starting at "1") for frames are appended. |
appendCoords | If true then the z and t coordinates of the frame are added as first two components. |
tagValuesListToExtend | For 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. |
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.
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.
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.
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.
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.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::getVector2FromTag | ( | DCMTree::Const_TagPtr | tagPtr, |
Vector2 & | returnVec | ||
) |
Converts two values of tagPtr to two Vector2 values in returnVec, respectively.
tagPtr | The tag whose values are to be converted. |
returnVec | The Vector2 whose values are filled with values from the tag value. Unchanged if anything in conversion failed. |
MLDICOMTags_EXPORT bool ml::DICOMTagTools::getVector3FromTag | ( | DCMTree::Const_TagPtr | tagPtr, |
Vector3 & | returnVec | ||
) |
Converts three values of tagPtr to three Vector3 values in returnVec, respectively.
tagPtr | The tag whose values are to be converted. |
returnVec | The Vector3 whose values are filled with values from the tag value. Unchanged if anything in conversion failed. |
MLDICOMTags_EXPORT bool ml::DICOMTagTools::getVector6FromTag | ( | DCMTree::Const_TagPtr | tagPtr, |
Vector6 & | returnVec | ||
) |
Converts six values of tagPtr to six Vector6 values in returnVec, respectively.
tagPtr | The tag whose values are to be converted. |
returnVec | The Vector6 whose values are filled with values from the tag value. Unchanged if anything in conversion failed. |
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.
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.
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.
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.
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.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasNegativeSliceSpacing | ( | DCMTree::Const_TreePtr | treePtr | ) |
Returns true if the tree has a SpacingBetweenSlices tag with a negative value.
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.
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).
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.
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).
MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasSharedOrPerFrameFunctionalGroupSequences | ( | DCMTree::Const_TreePtr | dcmTree | ) |
Returns true if the Shared- or the PerFrameFunctionalGroupSequences are on root level, otherwise false.
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.
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.
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.
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.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::hasValidTagIdRange | ( | MLint | val | ) |
Returns true if the MLint argument val has a valid uint32 range, otherwise false is returned.
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.
MLDICOMTags_EXPORT void ml::DICOMTagTools::initNULLSequenceItemsToEmptyTrees | ( | DCMTree::TagPtr | tag, |
size_t | from, | ||
size_t | to, | ||
std::string & | errStr | ||
) |
Initialize NULL sequence entries in range [from, to[ with default trees, because many tree operations expect at least empty trees but fail with NULL entries; any error will be appended as textual description to errStr which is left unchanged in case of success.
MLDICOMTags_EXPORT void ml::DICOMTagTools::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.
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.
MLDICOMTags_EXPORT std::pair<bool,bool> ml::DICOMTagTools::isClassicOrEnhancedMultiFrameSOPClass | ( | const std::string & | sopClassUID | ) |
Checks whether sopClassUID is a multi-frame or enhanced one and returns a pair with pair.first = isMulti-frame and the pair.second isEnhanced.
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.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::isEnhancedSOPClassUID | ( | const std::string & | enhancedSOPClassUID | ) |
Returns true if the pass UID is an enhanced Image Storage SOPClassUID, otherwise false.
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.
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.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::isKnownRetiredModality | ( | const std::string & | modality | ) |
Returns true if modality is a known retired one, otherwise false.
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.
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
MLDICOMTags_EXPORT bool ml::DICOMTagTools::isPhilips3D | ( | DCMTree::Const_TreePtr | treePtr, |
MLint * | spatialExtent = nullptr |
||
) |
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).
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.
str | The string to be checked for a valid DICOM date. |
allowEmptyStrings | If true (the default) then empty strings are considered as valid date strings. |
allowOldFormat | For 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. |
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.
str | The string to be checked. |
allowEmptyStrings | If true (the default) then empty strings are considered as valid time strings. |
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 string , 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.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::looksLikeValidDICOMUID | ( | const std::string & | uidStrToCheck | ) |
Returns true if uidStrToCheck looks like a plausible valid DICOM UID, otherwise false.
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.
dcmTree | is the DICOM tag tree in which tags shall be manipulated. |
modificationMode | determines the way how tags in dcmTree shall be manipulated, for detailed description of modes see OtherTagModificationModes . |
modStrVal | The tag value to be used in modes where values are replaced, set or expanded with another value. |
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).)
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.
id | The tag id to print. |
dict | The non-nullptr pointer to the DICOM dictionary for name look-up, must be non-nullptr. |
printValue | If 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. |
dcmTree | Used to retrieve the tag value from if printValue is true, otherwise ignored. |
valueIntro | The string to be printed between tag id/name and tag value if the value is printed. |
valueExtro | The string to be printed after the tag value if the value is printed. |
abbreviateAfter | If 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. |
MLDICOMTags_EXPORT void ml::DICOMTagTools::recursiveRemoveTags | ( | DCMTree::TreePtr & | dcmTree, |
const std::vector< DCMTree::TagId > & | listOfIdsToRemove | ||
) |
Remove recursively all appearances of any tags with ids in listOfIdsToRemove from dcmTree.
MLDICOMTags_EXPORT void ml::DICOMTagTools::recursiveSequenceTagCleanUp | ( | DCMTree::TagPtr | seqTagPtr | ) |
Ignores the call if tagPtr is a normal tag or nullptr; if it is a sequence tag then it calls recursiveSequenceTagCleanUp(DCMTree::TreePtr) on each of its entries, however, it does not remove any sequence items directly in seqTagPtr even if they become empty after cleanup.
MLDICOMTags_EXPORT void ml::DICOMTagTools::recursiveSequenceTagCleanUp | ( | DCMTree::TreePtr | treePtr | ) |
Does nothing if treePtr is nullptr, otherwise it recursively removes all entries at the end of all sequence tags which are empty or which have a tree with zero tags in treePtr.
If any sequence afterwards is empty, it removes the entire sequence tag.
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.
treePtr | The DCMTree in which the tags are to be searched. |
tagId | The id of the tag to be searched. |
remove | If 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. |
newVal | The string value used to replace tag values if remove is false. |
numGoodManips | Ignored if nullptr; otherwise it is incremented by the number of successfully manipulated (removed or modified) tags. |
numBadManips | Ignored 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. |
recursionLevel | Counts the recursion deepness, shall be 0 on normal calls by user. |
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
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.
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.
treePtr | The DICOM tree in which large tags shall be removed, may be nullptr. |
tagSizeToRemove | Tags with this size or large will be removed. |
MLDICOMTags_EXPORT void ml::DICOMTagTools::removeMaskedTags | ( | DCMTree::TreePtr | dcmTree, |
MLuint32 | idVal, | ||
MLuint32 | idMask | ||
) |
Remove all tags from the dcmTree whose ids & idMask == idVal.
dcmTree | The tree from which the tags shall be removed. |
idVal | If the tag id is masked with idMask matches this value then the tag will be removed. |
idMask | The tag id is masked with this value before comparing it to idVal. |
MLDICOMTags_EXPORT bool ml::DICOMTagTools::removePixelDataTag | ( | DCMTree::TreePtr | treePtr | ) |
Removes the first top level [[Double]Float]Pixel data data tag DCMTree_[[Double]Float]PixelData from the treePtr if it can be found.
MLDICOMTags_EXPORT 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.
dcmTree | The tree from which the tag shall be removed; if nullptr the call does nothing. |
privateCreatorString | The string name of the private creator to whose group the tag id belongs. |
MLDICOMTags_EXPORT void ml::DICOMTagTools::removePrivateMultiFrameTag | ( | DCMTree::TreePtr & | treePtr | ) |
If the passed tree contains a private MeVis sequence tag with DICOM frame information then the tag will be removed including all other tags of the same private slot.
MLDICOMTags_EXPORT void ml::DICOMTagTools::removePrivateSMFTreeTags | ( | DCMTree::TreePtr | dcmTree, |
bool | alsoRemovePrivateCreator | ||
) |
Removes the three private tags dimensionsOffset, dimensionSequenceOffset and frameIndexOffset of private creator DCMTree::StructuredMF::privateCreator; if alsoRemovePrivateCreator is true then the private creator tag itself is also removed.
MLDICOMTags_EXPORT void ml::DICOMTagTools::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.
dcmTree | The tree from which the tag shall be removed; if nullptr the call does nothing. |
tagIdLowerEightBits | The lower eight bits of the private tag to be removed; an error occurs if not in range [0,255]. |
privateCreatorString | The string name of the private creator to whose group the tag id belongs. |
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.
dcmTree | Tree from which all tags of a private creator shall be removed. |
removeAllPrivateTags | If true then all private tags will be removed, otherwise the string description of privateCreatorString must match exactly the tag value. |
privateCreatorString | If removeAllPrivateCreators is false then this is the string description of the private creator which must match exactly the tag string; otherwise not used. |
MLDICOMTags_EXPORT bool ml::DICOMTagTools::removeREGDataTag | ( | DCMTree::TreePtr | treePtr | ) |
Removes the first found REG modality VectorGridData tag (0x7fe1, 0x1010) from treePtr which is searched from top level under.
MLDICOMTags_EXPORT bool ml::DICOMTagTools::removeSpectDataTag | ( | DCMTree::TreePtr | treePtr | ) |
Removes the first top level spectroscopy data tag (0x7fe1, 0x1010) or - if that one does not exist - the tag (0x5600, 0x0020).
MLDICOMTags_EXPORT 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).
dcmTree | The DICOM tree from which the tag shall be removed. |
tagId | The id of the tag to be removed. |
MLDICOMTags_EXPORT void ml::DICOMTagTools::removeTags | ( | DCMTree::TreePtr | resultTree, |
const DcmTagIdToRemove | srcTagsToRemove[] | ||
) |
Remove the top level tags given by srcTagsToRemove from tree.
resultTree | The tree from which the tags shall be removed. |
srcTagsToRemove | The list of tags to be removed; it must be terminated with a {0, ""} entry. |
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelFrameOfReferenceTags | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM Frame Of Reference Module tags from dcmTree if they are present.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelGeneralAnatomyOptionalMacro | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM General Anatomy Optional Macro tags from dcmTree if they are present.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelGeneralImageTags | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM General Image Module tags from dcmTree if they are present.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelGraphicAnnotationModuleTags | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM Graphic Annotation Module tags from dcmTree if they are present.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelImagePixelMacroTags | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM Image Pixel Macro tags from dcmTree if they are present.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelImagePlaneTags | ( | DCMTree::TreePtr | dcmTree | ) |
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelModalityLUTTags | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM Modality LUT Module tags from dcmTree if they are present.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelMultiFrameModuleTags | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM Multi-frame Module tags from dcmTree if they are present.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelOverlayPlaneTags | ( | DCMTree::TreePtr | dcmTree | ) |
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelPixelPaddingValueTag | ( | DCMTree::TreePtr | dcmTree | ) |
Remove tags from tree which could disturb the correct interpretation of the written DICOM file.
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.
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.
MLDICOMOUTPUTS_EXPORT void ml::DICOMTagTools::removeTopLevelVOILutTags | ( | DCMTree::TreePtr | dcmTree | ) |
Removes the DICOM VOI LUT Module tags from dcmTree if they are present.
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.
dcmTree | is the DICOM tag tree in which tags shall be manipulated. |
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.
dcmTree | The DICOM tree from which the tag values shall be retrieved if possible. |
strToReplace | The string in which all $(TAGID(ABCD,EFGH)) appearances are to be replaced. |
correctTagValues | Ignored if false; if true then the following characters in tag values are replaced as follows: '/', '\', ' ' -> '-' '&', '$', '"' -> '.' |
defaultTagContent | If the value of a tag value cannot be determined then this value will be used instead. |
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.
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.
dcmTree | The tree in which the private group id and element id shall be searched. |
privateCreatorString | If 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. |
desiredPrivateGroupId | The preferred group id; if not available then another will be searched; shall be odd and from [0x0009, 0xFFFF]. |
desiredPrivateElementGroupId | The preferred element group id for the private tags; if not available then another will be searched, shall be from [0x10, 0xFF]. |
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.
dcmTree | The tree in which the private creator and private tags shall be inserted. |
privateCreatorString | The name of the private creator to be inserted if it still not exists) at id given by privateGroupId and privateElementGroupId. |
privateGroupId | The group id of the private creator and of the tag to be inserted, must be odd and from [0x0009, 0xFFFF]. |
privateElementGroupId | The element group id to be defined by the private creator and to be used for all inserted private tags, must be from [0x10, 0xFF]. |
privateTagIdLowerByte | The lower byte to be used for the added/replaced private tag, must be from [0x00, 0xFF]. |
privateTagValue | The value of the private tag to replace/add. |
privateVR | The value representation to be used by the private tag. |
splitValue | If true then privateTagValue is split at backslashes into different values, otherwise it is set as one value. |
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.
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.
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().
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
dcmTree | The DICOM tree in which the tag value shall be set. |
errStr | If nullptr then potential errors will be posted as ML_PRINT_ERROR, otherwise the error description will be appended to *errStr. |
tagId | The DICOM tag id of the tag to manipulate. |
tagStrValue | The string value used to manipulate the tag with id tagId. |
modMode | The way how the tag value shall be modified. |
splitValue | If true then the value is decomposed at backslashes, otherwise one value is set. |
Referenced by addTagToTree().
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.
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".
val | The value to be converted to a string. |
maxSize | The maximum string length to be returned; if <= 0 then ReleaseToolsString::toDblStr(val) is returned. |
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.
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.
treePtr | The tree to be checked for min/max pixel tags. |
minPixVal | The minimum value to be updated if a smaller pixel tag is found. |
maxPixVal | The maximum value to be updated if a larger pixel tag is found. |
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.
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.
dcmTree | The tree in which the private creator is stored. |
privateCreators | The 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. |
badPrivateCreators | The private creator ids which were checked and considered bad if passed non-null, otherwise ignored. |
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.
dcmTree | The tree in which the private tags are stored. |
privateIds | The private raw ids to be checked. |
privateCreators | The private creator ids to which should belong the tags from privateIds. |
|
extern |
String representations analog to the OrientationType, however, NumberOfOrientationTypes is out of range.
|
extern |
String versions for OtherTagModificationModes.
|
extern |
String versions for ModificationModes.