message.setDICOMStrings¶
Signature: message.setDICOMStrings(nodePath, value, instance*, forceNode*)
Returns: void
Set the value as a \\ delimited string of strings of the first node that matches the nodePath.
Note
When the optional instance value is specified, the nodePath should not include an instance identifier.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | nodePath | the DICOM node path | |
| String or String[] | value | the new node value either as a String or a JS Array of JS Strings | |
| Integer | instance* | (optional) the match instance to set. Use 1 for the first instance. | 1 |
| Boolean | forceNode* | (optional) create the node if it doesn't exist | true |
Example¶
// Example: Set DICOM tag values using strings (String or String[])
// assumes `message` is a DICOM message model object
// Example: value as String (single value)
message.setDICOMStrings(
"0008,103E", // nodePath - DICOM tag
"CT Chest" // value (String)
);
// Example: value as String (backslash-delimited multiple values)
message.setDICOMStrings(
"0008,0050", // nodePath
"Study A\\Study B" // value (String with delimiters)
);
// Example: value as String[] (JS array of strings)
message.setDICOMStrings(
"0008,0050", // nodePath
["Study A", "Study B"] // value (String[])
);
// Example: specify instance (1-based index)
message.setDICOMStrings(
"0008,0050", // nodePath
["Study C", "Study D"], // value
1 // instance (first match)
);
// Example: create node if it does not exist (forceNode = true)
message.setDICOMStrings(
"0008,0060", // nodePath (new tag)
"MR", // value
1, // instance
true // forceNode - create if missing
);
// Example: do NOT create node if it does not exist
message.setDICOMStrings(
"0008,0061",
["XRAY"],
1,
false // forceNode - will NOT create tag
);