TIEDicomTags.SetTagString
Declaration
procedure SetTagString(Group, Element: Word; const Value: String; ReplaceIfExist: Boolean = True);
Description
Adds or replaces a string tag.
If the tag does not exist, it will be added. If the tag already exists it will be overwritten if ReplaceIfExist is true, or a second instance of the tag added if ReplaceIfExist = False.
Supported
tag types: dvCS, dvAS, dvAE, dvDA, dvDS, dvDT, dvIS, dvLO, dvLT, dvPN, dvSH, dvST, dvTM, dvUI, dvUT
Note:
◼An exception is raised if the tag does not support a string value
◼Unicode values with non-ASCII character sets can be specified for strings, but
CharacterSet must be "ISO_IR 192"
// Add a "Patient Name" tag to the current Dicom file (or replace tag if it already exists)
ImageEnView1.IO.Params.DICOM_Tags.SetTagString( $0010, $0010, 'Joe Bloggs' );
// Add a Unicode tag
ImageEnView1.IO.Params.DICOM_Tags.CharacterSet := 'ISO_IR 192';
ImageEnView1.IO.Params.DICOM_Tags.SetTagString( $0010, $0010, ...Unicode String... );
// Update the value of a nested tag
ImageEnView1.IO.LoadFromFile('D:\tags1.dcm');
Tags := imageenview1.IO.Params.DICOM_Tags.FindNestedTag($0040, $1001, Index);
if Index > -1 then
Tags.SetTagString( Tags.GetTag( Index ).Group, Tags.GetTag( Index ).Element, 'NEW VALUE' );