message.setDICOMSignedShorts¶
Signature: message.setDICOMSignedShorts(nodePath, value, instance*, forceNode*)
Returns: void
Sets the value as a \\ delimited string of signed 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 signed short integers (String or Number[])
// assumes `message` is a DICOM message model object
// Example: value as String (backslash-delimited signed shorts)
message.setDICOMSignedShorts(
"0013,000C", // nodePath - DICOM tag
"1\\0\\-1\\0" // value (String of signed shorts)
);
// Example: value as Number[] (JS array of numbers)
message.setDICOMSignedShorts(
"0013,000C", // nodePath
[1, 0, -1, 0] // value (Number[])
);
// Example: specify instance (1-based index)
message.setDICOMSignedShorts(
"0013,000C", // nodePath
[2, 1, -2, 1], // value
1 // instance (first match)
);
// Example: create node if it does not exist (forceNode = true)
message.setDICOMSignedShorts(
"0013,000D", // nodePath (new tag)
"5\\4\\-5\\4", // value
1, // instance
true // forceNode - create if missing
);
// Example: do NOT create node if it does not exist
message.setDICOMSignedShorts(
"0013,000E",
[0, 0],
1,
false // forceNode - will NOT create tag
);