message.setDICOMUnsignedShorts¶
Signature: message.setDICOMUnsignedShorts(nodePath, value, instance*, forceNode*)
Returns: void
Set the value as a \\ delimited string of unsigned shorts 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 Number[] | value | the new node value either as a String or a JS Array of JS Numbers | |
| 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 unsigned short integers (String or Number[])
// assumes `message` is a DICOM message model object
// Example: value as String (backslash-delimited unsigned shorts)
message.setDICOMUnsignedShorts(
"0013,000C", // nodePath - DICOM tag
"1\\0\\255\\1024" // value (String of unsigned shorts)
);
// Example: value as Number[] (JS array of numbers)
message.setDICOMUnsignedShorts(
"0013,000C", // nodePath
[1, 0, 255, 1024] // value (Number[])
);
// Example: value with larger unsigned short values (0–65535 range)
message.setDICOMUnsignedShorts(
"0013,000C",
[0, 32767, 65535] // value (Number[])
);
// Example: specify instance (1-based index)
message.setDICOMUnsignedShorts(
"0013,000C", // nodePath
[5, 4, 3, 2], // value
1 // instance (first match)
);
// Example: create node if it does not exist (forceNode = true)
message.setDICOMUnsignedShorts(
"0013,000D", // nodePath (new tag)
"10\\20\\30", // value
1, // instance
true // forceNode - create if missing
);
// Example: do NOT create node if it does not exist
message.setDICOMUnsignedShorts(
"0013,000E",
[0, 1],
1,
false // forceNode - will NOT create tag
);